"Imiro" <da*******@hotmail.com> wrote in message
news:b6**************************@posting.google.c om...
Trying to validate this dtd example with xml-spy 5 pro:
This works:
<!ELEMENT note (#PCDATA|body)*>
<!ELEMENT body (#PCDATA)>
This doesnt:
<!ELEMENT note (#PCDATA|body)>
<!ELEMENT body (#PCDATA)>
The SP parser (nsgmls program) reports the error "#PCDATA in model group
that does not have REP occurrence indicator".
The "SGML Handbook" offers this explanation: "#PCDATA should be used in a
content model only when the intention of the content model is to allow
inter-mixed data with whatever elements are permitted - in other words,
where the content model is a repeatable OR group."
If you really need to restrict the note element to contain one body, you
might want to avoid the mixed content model altogether. (Mixed content means
parsed character data may be mixed with element content.) Something like
this:
<!ELEMENT note (comment?, body, comment?)>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT body (#PCDATA)>
/kmc