Thanks guys, that fixes it.

I guess this means that version 2.6.0 of the parser had a bug in that it didn't 
handle the Xschema's xs:string data type properly when it was applied to 
attribute values.

Jon

-----Original Message-----
From: Boris Kolpackov [mailto:[EMAIL PROTECTED]
Sent: 04 September 2007 08:25
To: [email protected]
Subject: Re: SAX2 XML Reader in Xerces 2.6 no longer normalizes attributes

Hi Jon,

Jon Pryce <[EMAIL PROTECTED]> writes:

> Yes, I saw that as well. In fact we use XSchema, not DTD. And the
> declarations look like this:
>
>   <xs:attribute name="name" type="xs:string" use="required"/>
>
> I don't *think* that is declaring it as CDATA is it? (I must admit I
> find the XML specifications very hard to decipher!)

To add to what David already have said, the XML 1.0 spec defines attribute 
value normalization only in terms of DTD. XML Schema is on a completely 
separate level and provides a much more flexible mechanisms for value 
normalization (not only in attributes) depending on the type. In your case the 
XML parser treats your attribute as CDATA for value normalization purposes on 
the XML level. Then that value is further normalized on the XML Schema level 
according to the xsd:string type, which means all whitespaces are preserved. If 
you want your attribute value to have the same treatment as DTD-declared 
non-CDATA attribute, then replace xsd:string with xsd:token in your schema.

Boris

--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding


This transmission is intended for the sole use of the individual and entity to 
whom it is addressed, and may contain information that is privileged, 
confidential and exempt from disclosure under applicable law. You are hereby 
notified that any use, dissemination, distribution or duplication of this 
transmission by someone other than the intended addressee or its designated 
agent is strictly prohibited. If you have received this transmission in error, 
please notify this company immediately by reply to this transmission and delete 
it from your computer. Thank You. Credence Systems Corporation.


Reply via email to