This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTD creation

 
Anoop Krishnan
Ranch Hand
Posts: 163
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to implement the following idea in dtd creation

ie a ELEMENT x can contain either another element a or a String(#PCDATA)
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is called "mixed content" and will look like
<!ELEMENT x (#PCDATA,a) >
or
<!ELEMENT x (#PCDATA | a)* >
(not sure the first declaration is correct. I fished it out of some book, and this book is currently under my suspicion Can somebody verify, is the first declaration correct or not?)
But it is not excluding "or", the model above allows both PCDATA and "a" elements to be presented in an XML document in any sequence and any number.
If you need excluding "or",i.e. "either PCDATA or "a" element, but not both", then I am not sure DTD can specify this. If I am wrong, somebody will correct me.
[This message has been edited by Mapraputa Is (edited June 15, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic