In the xml spec, it says:
[Definition: An element type has mixed content when elements of that type may contain character data, optionally interspersed with child elements.] In this case, the types of the child elements may be constrained, but not their order or their number of occurrences
Is there any way to work around this to make this xml valid:
<parent>
A text node
<child/>
</parent>
but this xml invalid:
<parent>
A text node
<child/>
<child/>
</parent>
Also, do you know any reason for why this is not allowed?
<!ELEMENT parent (#PCDATA,child)>
Alderath,
Up front, I don't know, but I don't think so, not in a DTD... and, if I may say so, you really should be using XML Schema's (i.e. XSD's) instead of DTD's (they're just so 90's;-).
XSD's allow you much tighter control over document content, and I'm pretty sure that restricting the number of occurrences of a particular child element in a "mixed type" complex element is possible (even easy) using an XSD; though I've never had need (touch wood) to do so myself... so treat this as heresay.
Good luck with that.
Cheers. Keith.