I'm trying to create a DTD for an XML document. The document has two children - one contains structured data and the other unstructured data eg;
<doc>
<structured>
<foo x="9"/>
<foo x="4"/>
</structured>
<unstructured>
<hello/>
<world x="2">
<hi msg="something"/>
<anything/>
</world>
</unstructured>
</doc>
I want to create a DTD for the above XML that allows the <unstructured>
element to contain any valid XML. I tried this DTD;
<!ELEMENT doc (structured,unstructured)
<!ELEMENT structured (foo*)
<!ELEMENT foo EMPTY>
<!ATTLIST foo x CDATA #REQUIRED>
<!ELEMENT unstructured ANY>
But errors are generated like this;
No declaration for element hello
No declaration for element world
..etc
I want to allow <unstructured>
to contain any valid XML. Is there a way in a DTD to allow a specified element to contain any parsable XML?
I'm using PHP 5.3 DOMDocument::validate.