This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTD creation

 
Anoop Krishnan
Ranch Hand
Posts: 163
  • 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
  • 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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic