At 07:30 PM 10/19/99 +0530, Anand Raman wrote:
> The difference between CDATA and PCDATA is really confusing me.The book i am
> referring to uses PCDATA to define the data type of element contents and
> CDATA to define the attribute values of elements.. I am sure this is not the
> true logic behind this.
The distinction is sort of arbitrary - CDATA is 'character data' while PCDATA
is 'parsed character data' - but it's one of those rules you have to follow.
XML 1.0 requires you to use PCDATA (actually, #PCDATA) in element type
declarations and CDATA in attribute declarations or the parser won't
what you're doing.
> When i tried to define the element content to be of the type CDATA the xml
> parser complained.
> ../xml/cdata.xml: 8, 12: Element "<contents>" is not valid because it does
> not follow the rule, "(CDATA)".
> Excerpts of the simple XML page i wrote
> <!ELEMENT head (contents)>
> <!ELEMENT contents (CDATA)>]>
The parser is looking for a CDATA element in your document, and since there
isn't one, it's complaining. Declare:
<!ELEMENT contents (#PCDATA)>
instead, and you'll have much better luck.
XML: A Primer, 2nd Ed.
Building XML Applications
Inside XML DTDs: Scientific and Technical
Sharing Bandwidth / Cookies