Reputation: 23027
I want to create a document type definition for an XML document.
I have the XML document in the following form:
<parent>
<first>Some PCDATA</first>
<a>The elements aye...</a>
<c>see</c>
<b>and bee</b>
<c>can occur in random order</c>
<a>and with a random frequency</a>
<last>Some PCDATA</last>
</parent>
I just want element first to be the first element (and only occurring once), the element last to be the last child element (and only occurring once), and elements a, b and c zero or more times occurring in a mixed order.
Can I achieve that? If yes, how? If not, what may be a workaround which comes close to this?
Upvotes: 0
Views: 39
Reputation: 17238
this should work:
<!DOCTYPE parent [
<!ELEMENT parent (first, (a|b|c)*, last) >
<!ELEMENT first #PCDATA >
<!ELEMENT a ANY >
<!ELEMENT b ANY >
<!ELEMENT c ANY >
<!ELEMENT last #PCDATA >
]>
Upvotes: 1