j-users@xerces.apache.org
[Top] [All Lists]

Re: preserving whitespace for xsd:anySimpleType

Subject: Re: preserving whitespace for xsd:anySimpleType
From: Michael Glavassevich
Date: Tue, 11 Mar 2008 00:12:23 -0400
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@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx

"Feber, Mark" <Mark_Feber@xxxxxxx> 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-users-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • Re: preserving whitespace for xsd:anySimpleType, Michael Glavassevich <=