I have an xml element vehicle that can have as sub-elements either car XOR truck XOR a combination of multiple #PCDATA OR bus. How do I write the dtd?
<?xml version="1.0" encoding="UTF-8" ?>
<!ELEMENT root (vehicle)*>
<!ELEMENT vehicle (truck|car|(#PCDATA|bus)*)>
The above fails with error
parser error : ContentDecl : Name or '(' expected
It's not possible in XML. Once you need to define a content model allowing text (
#PCDATA
) and elements - also named mixed content - , you MUST define it that way :A workaround for your case can probably be :