File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes how to write a DTD for this scenario? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to write a DTD for this scenario?" Watch "how to write a DTD for this scenario?" New topic

how to write a DTD for this scenario?

Ajay Xavier
Ranch Hand

Joined: Jan 03, 2005
Posts: 109

consider the following xml

<set after = "A">
<item name="A" ></item>
<item name="B" ></item>

The DTD for the "item" element is

<!ATTLIST item name (A | B| C| D| E ) #REQUIRED >

The attribute "after" of "set" can hold a single valid name like
<set after = "A">
a collection of valid names seperated by coma like <set after = "A,B,C">

how to write DTD for the "after" attibute such that it will contain a single valid name or collection of names?
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

There is not really a way to do that with a DTD. You can make the attribute-type a list of possible values (as you ahve done) but the values would have to also include the CVS lists of possible values, which isn't very good.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: how to write a DTD for this scenario?
jQuery in Action, 3rd edition