DTD. Content model is not determenist

I need to your advice. How to describe same elements in alternative choises. For example :

<!DOCTYPE offers [
<!ELEMENT offers (offer+)>
<!ELEMENT offer ((name, cost) | (id?, name, tag, desc?) | (prefix, title, desc?))>
<!ELEMENT name (#PCDATA)>
<!ELEMENT cost (#PCDATA)>
<!ELEMENT tag (#PCDATA)>
<!ELEMENT desc (#PCDATA)>
<!ELEMENT prefix (#PCDATA)>
<!ELEMENT title (#PCDATA)>
] >

<offers>
    <offer>
        <name>Name1</name>
        <cost>123</cost>
    </offer> 
    <offer>
        <id>123</id>
        <name>Name2</name>
        <tag>sale</tag>
        <desc>Some Description</desc>
    </offer>
    <offer>
        <prefix>Book</prefix>
        <title>Little Pony</title>
    </offer>    
</offers>

Tag name repeated in two variants, how to solve this problem during describe elements in dtd.
Thx for help


Source: xml

Leave a Reply