Friday 15 March 2013

validation - Using a DTD, can an element be declared that allows any XML content? -


I am trying to create a DTD for an XML document. The document has two children- structured data and other unstructured data such as;

  & lt; Doc & gt; & Lt; Structured & gt; & Lt; Foo x = "9" /> & Lt; Foo x = "4" /> & Lt; / Structured & gt; & Lt; Unstructured & gt; & Lt; Hello / & gt; & Lt; World x = "2" & gt; & Lt; Hi msg = "something" /> & Lt; Anything /> & Lt; / World & gt; & Lt; / Unstructed & gt; & Lt; / Doc & gt;   

I want to create a DTD for the above XML which is & lt; Unstructured & gt; Allows the element to contain any valid XML I tried this DTD

    

But the errors are generated in this way;

  No declaration for element is hello element no declaration to the world   

. .etc

I & lt; Unstructured & gt; Do I want to allow any legitimate XML to be included? Is there any way to allow a specific element to contain any reciprocal XML in a DTD?

I am using PHP 5.3 DOMDocument :: validate.

No, it is not.

The closer you come, the DTD can come by using any keyword. But any matches the mix of # PCDATA and each element declared in DTD. It does not accept undeclared elements; There is not much perception of partial validity in DTDs / P>

No comments:

Post a Comment