DTD names root element?

C

Christian

HI NG,

AFAIK, a dtd names the root element, i.e.

<!DOCTYPE test SYSTEM "SomeURL">

must be followed by the root element named "test".
However, Xerces 2.4.0 does not complain, if SomeURL refers to a
DTDefinition which's root element name is different.

Bug in Xerces or in my understanding???

Any help appreciated!
Thx
Christian
 
J

Johannes Koch

Christian said:
HI NG,

AFAIK, a dtd names the root element, i.e.

<!DOCTYPE test SYSTEM "SomeURL">

must be followed by the root element named "test".
Yep

However, Xerces 2.4.0 does not complain, if SomeURL refers to a
DTDefinition which's root element name is different.

Bug in Xerces or in my understanding???

A DTD does not define a root element. Several elements defined in a DTD
can act as root elements for XML documents based on this DTD.
 
C

Christian

Johannes Koch said:
Nope! As far as Xerces is concerned. Using the example above, Xerces
does not complain about a root element named 'toast' or whatever.
 
B

Bob Foster

Really? Then Xerces is wrong (if it is validating). The name used in the
DOCTYPE declaration and the root element name are required to be the same.
Validity constraint: Root Element Type.

This has nothing to do with the DTD.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top