CDATA vs character DATA

P

Peter Gerstbach

Jimmy said:
Are they teh same thing in xml 1.0?

There are to different things called CDATA in XML 1.0:

CDATA Section: they are used to escape blocks of text containing
characters which would otherwise be recognized as markup. CDATA sections
begin with the string "<![CDATA[" and end with the string "]]>":]

CDATA Attribute Type: this is the string type of the three attribute
types in a DTD. For example:
<!ATTLIST termdef
name CDATA #IMPLIED>

Peter
 
P

Peter Flynn

Peter said:
Jimmy said:
Are they teh same thing in xml 1.0?

There are to different things called CDATA in XML 1.0:

CDATA Section: they are used to escape blocks of text containing
characters which would otherwise be recognized as markup. CDATA sections
begin with the string "<![CDATA[" and end with the string "]]>":]

CDATA Attribute Type: this is the string type of the three attribute
types in a DTD. For example:
<!ATTLIST termdef
name CDATA #IMPLIED>

That doesn't answer the question, though.
The OP asked if CDATA and "character data" were the same thing.
No, they're not.

CDATA, as Peter rightly says, is an attribute type specifier.
It means your attribute can contain text or character entity
references, but not element markup, so if bar is declared as
a CDATA attribute on the element type foo,

<foo bar="blort"/>
and
<foo bar="bl&ocirc;rt"/>

are well-formed, but

<foo bar="blo<br/>rt">

is not.

Character Data is the generic term for the text content of a document.
It's what gets parsed to see if it contains any [more] markup (whence
the term Parsed Character Data or PCDATA). The term is more commonly
used to mean "unmarked text".

///Peter
 

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,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top