I'm creating a DTD for an xml document. I have an Enumerated attribute for an xml element. My question is: Can the attribute Type have spaces?
eg:
<!ELEMENT Link (#PCDATA)>
<!ATTLIST Link Type (Amendment|Reference|Superseded|Modified|
Corrigendum|Corresponds|Endorsement|Equivalent|Identical|Modified|
Not Equivalent|Note taken of|Related|Similar) "Reference">
So what I would like is:
<Link Type="Not Equivalent" \>
But that seems to barf. When I say barf, I mean that when I try to validate the document (Eg Open it in a web browser) I get an error message:
Invalid character found in ATTLIST enumeration. Error processing resource 'file:///C:/myxmldocument.xml'. ...
Is there some magic voodoo I need to do for spaces? Or is it just tough luck?
The short answer is no. Xml attributes are name tokens and name tokens cannot contain spaces. The relevant specs are linked:
Attribute Types (see NotationType)
The invalid character is the space. You can use '.' or '-' as a separator if you like.