DTD element type declaration

I

Imiro

Hi,

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)>

Is this a bug when 'char or char' is allowed when repeating zero or more times?

Thanks,

Imiro
 
K

Keith M. Corbett

Imiro said:
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
 
I

Imiro

Thanks, this was what i needed to know. I'm Converting old sgml DTD
thats loaded with mixed content, that won't validate :p

--Imiro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top