OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: PCDATA VS. CDATA

[ Lists Home | Date Index | Thread Index ]
  • From: "John E. Simpson" <simpson@polaris.net>
  • To: "Dante M. Lee" <dtmlee@pop400.gsfc.nasa.gov>, xml-dev@ic.ac.uk
  • Date: Mon, 28 Jun 1999 15:14:06 -0400

At 01:27 PM 06/28/1999 -0400, Dante M. Lee wrote:
>>>>
Can someone tell me what is the difference between PCDATA and CDATA?
and also...
<<<<

In a DTD, PCDATA and CDATA are used to assert something about the allowable content of elements and attributes, respectively. In an element's content model, #PCDATA says that the element contains (may contain) "any old text." (With exceptions as noted below.) In an attribute's declaration, CDATA is one sort of constraint you can put on the attribute's allowable values (other sorts, all mutually exclusive, include ID, IDREF, and NMTOKEN). An attribute whose allowable values are CDATA can (like PCDATA in an element) contain "any old text."

A potentially really confusing issue is that there's *another* "CDATA," also referred to as marked sections. A marked section is a portion of element (#PCDATA) content delimited with special strings: <![CDATA[ to open the section, and ]]> to close it. If you remember that PCDATA is "parsed character data," a CDATA section is literally the same thing, without the "parsed." Parsers transmit the content of a marked section to downstream applications without hiccupping every time they encounter special characters like < and &. This is useful when you're coding a document that contains lots of those special characters (like scripts and code fragments); it's easier on data entry, and easier on reading, than the corresponding entity reference.

So you can infer that the exception to the "any old text" rule is that PCDATA cannot include any of these unescaped special characters, UNLESS they fall within the scope of a CDATA marked section.

>>>>
Can someone in the XML world tell me what is the difference between the attribute list and the attachment list?
<<<<

I don't know what an attachment list is. An attribute list is simply the list of declarations (in the DTD) for all attributes that a given element may have.


==========================================================
John E. Simpson | The secret of eternal youth
simpson@polaris.net | is arrested development.
http://www.flixml.org | -- Alice Roosevelt Longworth
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To (un)subscribe, mailto:majordomo@ic.ac.uk the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


  • References:



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS