Is an xml attribute without a value, valid?

前端 未结 3 543
执念已碎
执念已碎 2020-11-30 10:47

I want to have an XML attribute without any value, which simply has one meaning when it exists or does not exist.

Is that valid?

3条回答
  •  难免孤独
    2020-11-30 11:37

    An attribute must be specified with the following syntax:

    Name Eq AttValue

    where Name is a legal XML name, Eq is = optionally preceded or followed by whitespace, and AttValue is a legal attribute value.

    This definition is true for both XML 1.0 and XML 1.1.

    If you are trying to specify an attribute as below:

    
    

    then no, that is not valid. If you are trying to specify it this way:

    
    

    then yes, that is valid.

提交回复
热议问题