Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dtd confusion

 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
came across this one:
I have the following xml file:
<Relation>
<Me>
<Name>
Axel
</Name>
</Me>
<Other>
<Name>
<First>
Joe
</First>

<Last>
Stranger
</Last>
</Name>
</Other>
</Relation>
When I now write a dtd it would look like this:
<!Element Relation (Me, Other) >
<!Element Me (Name) >
<!Element Name (#PCDATA)>
<!Element Other (Name) >
<!Element Name (First, Last) >
<!Element First (#PCDATA)>
<!Element Last (#PCDATA)>
Now there are TWO Name definitions in dtd.
(O.k. I can test it. Will do it later today.)
How does dtd-validator find right definition for tag <name> in dtd for that element. There are 2 definitions?
Or must every tag-name in structure be unique if we use dtd?
Found nothing about this problem in dtd chapter of xml2 by wrox.
Thanks. Axel
[ January 19, 2003: Message edited by: Axel Janssen ]
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to change one of the <Name> elements to something else.
 
Steven Broadbent
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe only the first definition will
be used.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extensible Markup Language (XML) 1.0 (Second Edition):
"Validity constraint: Unique Element Type Declaration
No element type may be declared more than once."
http://www.w3.org/TR/REC-xml#elemdecls
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic