没有值的xml属性有效吗? [英] Is an xml attribute without a value, valid?
本文介绍了没有值的xml属性有效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个不带任何值的XML属性,当它存在或不存在时,它仅具有一种含义.
I want to have an XML attribute without any value, which simply has one meaning when it exists or does not exist.
有效吗?
推荐答案
必须使用以下语法指定属性:
An attribute must be specified with the following syntax:
名称Et AttValue
Name Eq AttValue
其中Name是合法的XML名称,Eq是 =可选,在空格之前或之后,并且AttValue是
where Name is a legal XML name, Eq is = optionally preceded or followed by whitespace, and AttValue is a legal attribute value.
如果您尝试指定如下属性:
If you are trying to specify an attribute as below:
<car owned/>
然后不,那是无效的.如果您尝试以这种方式指定它:
then no, that is not valid. If you are trying to specify it this way:
<car owned=""/>
然后是的,那是有效的.
then yes, that is valid.
这篇关于没有值的xml属性有效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文