File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes dtd confusion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "dtd confusion" Watch "dtd confusion" New topic
Author

dtd confusion

Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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

Joined: Jun 06, 2002
Posts: 1056
You need to change one of the <Name> elements to something else.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Steven Broadbent
Ranch Hand

Joined: Dec 10, 2002
Posts: 400
I believe only the first definition will
be used.


"....bigmouth strikes again, and I've got no right to take my place with the human race...."<p>SCJP 1.4
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
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


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dtd confusion
 
Similar Threads
DTD Conventions
DTD questions
problem simply stated
i have written code for dom but output given from the exception caught in the code
parsing error with XML DTD, help!