0

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

  • "I can't understand meaning": maybe because the quoted text does not make much sense. Where does it come from? – Henry Jun 22 '14 at 08:22
  • 1
    I guess what it tries to say is that you cannot define an element that behaves like CDATA (i.e. unparsed content). – Henry Jun 22 '14 at 08:32
  • i.e. CDATA doesn't work inside PCDATA? –  Jun 22 '14 at 08:37
  • ' <!ELEMENT BOOK (#PCDATA)> ] > <![CDATA[Hi! Can you <> see me?]]> The <![CDATA[Can you <title>title see me?]]> book somebody ' works –  Jun 22 '14 at 09:13
  • possible duplicate of [what actually is PCDATA and CDATA?](http://stackoverflow.com/questions/857876/what-actually-is-pcdata-and-cdata) – helderdarocha Jun 22 '14 at 14:49

1 Answers1

3

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.

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
Nic Gibson
  • 7,051
  • 4
  • 31
  • 40