• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dtd generation

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
How do I generate DTD when the root tag is the same and child tags vary depending on certain condition like in the following example.
if(child1) {
<parent>
<child1>
<parent>
}
if(child2) {
<parent>
<child2>
<parent>
}
Note: Both if(child1) and/or if(child2) conditions may be true.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am also interested in this answer. BTW how do we generate the DTD's automatically, if at all, in the first place?
------------------
Thanks,
Hirdesh
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are tools for automatic DTD generation, check http://www.xmlsoftware.com/ for example.
Regarding Sreeni's example: there are (very limited) features for conditional processing in DTD - INCLUDE and IGNORE declaration, but they do not provide for varying processing depending on run-time information. And I suspect this is what you want. What are your (child1) and (child2) conditions anyway?
You can make both documents valid by writing something like
<!ELEMENT parent (child1 | child2)
but I guess this is not enough for your requirements. If you want some of your documents to valid or invalid depending on some data in this document, then it cannot be done with DTD in general sense. But there may be some workarounds, like to add "wrapping" elements to your documents (if have control on how they are generated), like
<!ELEMENT parent (parent1 | parent2)>
<!ELEMENT parent1 (child1)>
<!ELEMENT parent2 (child2)>

[This message has been edited by Mapraputa Is (edited September 17, 2001).]
 
Squanch that. And squanch this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic