I need to validate xml files against a DTD.
Sometimes the child elements can be more and I dont know what child elements will come up next time, I tried the following:
<!ELEMENT Story (StoryPara+ , ANY+)+>
but this didn’t work, how to validate for any child elements using DTD?
You can’t mix “ANY” with anything else in your content model. (You would use it just like you would use “EMPTY”.)
What your current element declaration is saying is: at least one occurrence of: one or more “StoryPara” element(s) followed by one or more “ANY” element(s)
Change your element declaration to this:
Do note that any child of “Story” must also be defined.
For example, this is valid:
but this is not because “bar” is not defined: