Go Premium for a chance to win a PS4. Enter to Win


DTD - spaces in (enumerated) attribute type list

Posted on 2004-10-27
Medium Priority
Last Modified: 2013-11-19
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.
Question by:pw05
  • 2
LVL 26

Accepted Solution

rdcpro earned 2000 total points
ID: 12427131
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.

Mike Sharp
LVL 26

Expert Comment

ID: 12427173
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.  

Mike Sharp

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question