Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

DTD creation  RSS feed

 
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)
 
Leverager of our synergies
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).]
 
My, my, aren't you a big fella. Here, have a tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!