Im trying to validate my XML file with an external DTD. But I get this error everytime.
Document root element "A", must match DOCTYPE root "test".
i cant figure this out.
The idea of my xml file is that its need to be as short as possible . I thinkt its all good but like i said, i wont validate. Does someone have an idea ?
This is my XML file
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE test SYSTEM "test.dtd">
<A>
<B>
<F>name</F>
</B>
<D>lastname</D>
<F>name</F>
</A>
And my DTD
<!ELEMENT A (B, (C|D), E?, (F, G?)+)>
<!ELEMENT B (F|G)+>
<!ELEMENT D (#PCDATA|C)*>
<!ELEMENT F (#PCDATA)>
<!ELEMENT G (#PCDATA)>
<!ELEMENT C (#PCDATA)>
<!ELEMENT E (#PCDATA)>
Thanks
Declares that the root ELEMENT of the DTD-conformant document is called
test
. You want:The Doctype claims the root element is
<test>
but you have used<A>
Either change the Doctype so it claims the root is
<A>
or change the XML and DTD to use<test>
.