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


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
PCDATA element type and CDATA attribute type

PCDATA element type and CDATA attribute type

This seems to be a good old question asked a lot and often answered
incorrectly outside this mailing list. Please correct me if I'm wrong
in the following.

Having an element type called PCDATA and an attribute type called
CDATA is misleading since they are exactly the same for all practical
purposes. They are both parsed in the sense that character references
are replaced with the character and named references are expanded and
in the sense that we get wellformedness errors in both if they contain

One could just as well have decided to call both PCDATA or CDATA. The
background for the two types are probably that it was called PCDATA
for elements to contrast it with a CDATA section escaping markup ...
forgetting to call it PCDATA also in attributes. A more sensible
working group would probably have decided for having just one "string"
data type to be used in both elements and attributes, and just one

The only real difference I can think of is that the CDATA attribute
type ends up partly whitespace normalized, linefeeds becoming just
spaces. But this is more a question of being an attribute and an
element than of having two types.  Also, in attributes we can't use
quotation marks directly except if we delimit the attribute value with
apostrophes instead of quotation marks.

Do we have any real differences after all?

Jesper Tverskov

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

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

Copyright 1993-2007 XML.org. This site is hosted by OASIS