Reputation: 11
I am a student of an official Network Computing degree here in my country through an online platform. Things are a bit difficult this way because the teachers cannot expend much time attending students, so this is pretty much like being self-taught. Because of this, I think I am having some basic errors while doing my work, so that's why I am asking here.
Currently I am creating an XML DTD to set some constraints to an XML document. I need to set an element that can contains text and other elements. I am doing it this way:
<!ELEMENT element (#PCDATA, subelement1, subelement2)>
<!ELEMENT subelement1 (#PCDATA)>
<!ELEMENT subelement2 (#PCDATA)>
I tried an online DTD validator and it said that this is not valid so, what would be the way to do this properly?
Thanks.
Upvotes: 1
Views: 394
Reputation: 52848
You can't specify order when you have mixed content (http://www.w3.org/TR/xml/#sec-mixed-content).
You have to declare element
like this:
<!ELEMENT element (#PCDATA|subelement1|subelement2)*>
Upvotes: 2