[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Attribute normalisation and character entities

  • From: "Thomas B. Passin" <tpassin@i...>
  • To: <xml-dev@i...>
  • Date: Tue, 25 Jan 2000 15:54:24 -0500

x20 character

Richard Tobin wrote, following uo on a number of previous posts:

> Another strangeness: if my interpretation of section 3.3.3 is right,
> and character entities for tab, cr and lf are not normalised to spaces,
> then this is a valid NMTOKENS attribute:
>
>   "foo &#x9; bar"
>
> but is not normalised to have a space character between the two
> tokens, which is "obviously" intended.
>
> It seems to me that it would make sense for tab, cr and lf entities to
> get normalised to spaces (and then compressed to a single space) for
> non-CDATA attributes.
>

The XML rec says

"4.4.5 Included in Literal
When an entity reference appears in an attribute value, or a parameter
entity reference appears in a literal entity value, its replacement text is
processed in place of the reference itself as though it were part of the
document at the location the reference was recognized, except that a single
or double quote character in the replacement text is always treated as a
normal data character and will not terminate the literal. "

This says that the processor will replace the entity with its value when the
entity is used in the value of an attribute.  Seems clear enough.

The rec also says

"3.3.3 Attribute-Value Normalization
Before the value of an attribute is passed to the application or checked for
validity, the XML processor must normalize it as follows:

a character reference is processed by appending the referenced character to
the attribute value
an entity reference is processed by recursively processing the replacement
text of the entity
a whitespace character (#x20, #xD, #xA, #x9) is processed by appending #x20
to the normalized value, except that only a single #x20 is appended for a
"#xD#xA" sequence that is part of an external parsed entity or the literal
entity value of an internal parsed entity
other characters are processed by appending them to the normalized value
If the declared value is not CDATA, then the XML processor must further
process the normalized attribute value by discarding any leading and
trailing space (#x20) characters, and by replacing sequences of space (#x20)
characters by a single space (#x20) character.

All attributes for which no declaration has been read should be treated by a
non-validating parser as if declared CDATA. "

This clearly says that normalizing down to a single space IS part of the
processing when an entity is used in an attribute value.


Tom Passin









xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Unsubscribe by posting to majordom@i... the message
unsubscribe xml-dev  (or)
unsubscribe xml-dev your-subscribed-email@your-subscribed-address

Please note: New list subscriptions now closed in preparation for transfer to OASIS.



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.