xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Glavassevich <mrgla...@ca.ibm.com>
Subject Re: preserving whitespace for xsd:anySimpleType
Date Tue, 11 Mar 2008 04:12:23 GMT
Hi Mark,

xs:anySimpleType doesn't have any facets (not even whiteSpace) so this
sounds like there may have been a bug in the 2.7.1 release. You should be
able to work around it by setting the
"http://apache.org/xml/features/validation/schema/normalized-value" [1]
feature to false.

Thanks.

[1]
http://xerces.apache.org/xerces2-j/features.html#validation.schema.normalized-value

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Feber, Mark" <Mark_Feber@bmc.com> wrote on 03/10/2008 04:24:39 PM:

> Question about preserving whitespace in the result when the schema
> type declaration of an element is xsd:anySimpleType.
>
> Environment: Java 1.4.2, xerces 2.7.1
>
> I am parsing a document described by an externally defined schema.
> There are several elements whose type is declared as xsd:
> anySimpleType, for example:
>
> <xsd:element name="literal" type="xsd:anySimpleType"/>
>
> In the xml document I am consuming, when the content of this element
> is text containing forward or following spaces, e.g.:
>
> <literal>  has spaces  </literal>
>
> I need to be able to get the value of the element with the spaces
> preserved.  Unfortunately, both with SAX parsing and DOM parsing,
> the element is returned as ?has spaces? rather than ?  has spaces
> ?.  Changing the element type in the xsd to xsd:string (which is,
> however, not an option in the final deliverable) results in the
> desired (?  has spaces  ?) value being returned.
>
> Is there any way to get the desired value when the type is xsd:
> anySimpleType?
>
> As an additional piece of information, the value ?  has spaces  ? is
> returned in a c++ environment that is using xercesc even when the
> type is xsd:anySimpleType.
>
> Thanks,
>             Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Mime
View raw message