CDATA inside PCDATA

295 views Asked by At

I read this text and didn't ubderstand it:

PCDATA means parsed character data, so in this case the declared element is allowed to have character data inside of it now ,you might be wondering if there is a way to define an element that has a CDATA section in it, which is unparsed.
And the answer is, remember, CDATA tag itself is in fact parsed. It's only the text content inside the CDATA section that's unparsed. So there's no way to say, it's only a CDATA section. What you would define is the #PCDATA. And then that indicates the elements can have parse carriage data inside of it.

How can I say it in other words? What is meant?
PCDATA - Parsed Character Data
CDATA - (Unparsed) Character Data

PCDATA can parse tags. So PCDATA can parse CDATA: PCDATA will understand CDATA. And CDATA leaves inner text as is. That is CDATA will work in PCDATA. Right?

This

So there's no way to say, it's only a CDATA section. What you would define is the #PCDATA. And then that indicates the elements can have parse carriage data inside of it.

kill me. I can't understand meaning.

Thanks

1

There are 1 answers

0
Nic Gibson On

I'm not 100% certain that I'm actually answering your question here because I'm not 100% certain what your question is.

The first thing you should remember about CDATA is that it is simply an authorial tool that makes entering markup that would cause problems for that parser easier.

For example, if I wanted to have a para element that contained the text "children < 12 years and adults > 80 years old"

<para>children &lt; 12 years and adults &gt; 80 years old</para>

That's just PCDATA. But it is a bit tedious to type. So I might want to do:

<para><![CDATA[children < 12 years and adults > 80 years old]]></para>

That's still PCDATA but you have used the CDATA section to avoid the problematic text.

So, the statements you quoted are correct but unclear. For element content, #PCDATA is the data type and CDATA is simply a convention to simplify authoring. The <![CDATA ... ]]> is parsed but the content is not.