Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > CDATA vs character DATA

Reply
Thread Tools

CDATA vs character DATA

 
 
Jimmy zhang
Guest
Posts: n/a
 
      08-08-2004
Are they teh same thing in xml 1.0?


 
Reply With Quote
 
 
 
 
Peter Gerstbach
Guest
Posts: n/a
 
      08-16-2004
Jimmy zhang wrote:
> 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
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      08-16-2004
Peter Gerstbach wrote:

> Jimmy zhang wrote:
>> 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
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I un-CDATA my CDATA section and elaborate a transformation for the contained data? troppfigo@excite.it XML 3 03-06-2006 03:01 AM
character encoding +missing character sequence raavi Java 2 03-02-2006 05:01 AM
getting the character code of a character in a string Velvet ASP .Net 9 01-19-2006 09:27 PM
Extracting CDATA Text without CDATA Tags??? John Davison Java 1 07-06-2004 11:00 PM
Character reference "&#c" is an invalid XML character cgbusch XML 6 09-02-2003 07:04 PM



Advertisments