DTD - spaces in (enumerated) attribute type list

Hi, I would like to have the following attribute list:

<!ATTLIST elementName attrName (two words|more than one word) #REQUIRED>

but it seems spaces are not valid in the enumerated list.  I also tried:

<!ENTITY % twoWords "two words">
<!ENTITY % moreThanOneWord "more than one word">
<!ATTLIST elementName attrName(%twoWords;|%moreThanOneWord;) #REQUIRED>

but was also unable to validate the DTD.  How can I solve this?  Thanks.
pw05Asked:
Who is Participating?
 
rdcproCommented:
DTD's are quite limited in what they can do.  Attributes can only have a few datatypes.  The enumerated type only allows name tokens (NMTOKEN).  You can use a NOTATION type for an attribute, then specify (using a <!NOTATION> declaration) an external reference, but I don't think you'll be able to validate that way.  Notation is mainly used to help an external application understand a custom datatype.  For example, you might declare a notation to assist your external application in handling an unparsed external entity, such as an image file in JPEG or GIF file format.

You're really better of defining this sort of thing in a Schema, such as a W3C XML Schema.

Regards,
Mike Sharp
0
 
rdcproCommented:
I didn't explicitly say, but you've probably already realized, a NMTOKEN is a single word, with no whitespace.  They are essentially like character data (CDATA) except they cannot contain whitespace characters such as space, tab, newline etc.  

Regards,
Mike Sharp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.