File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "dtd confusion" Watch "dtd confusion" New topic

dtd confusion

Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
came across this one:
I have the following xml file:

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

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."

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:
subject: dtd confusion
It's not a secret anymore!