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

Reply via email to