Is an xml attribute without a value, valid?

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:

<car owned/>

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

<car owned=""/>

then yes, that is valid.

Leave a Comment