xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Feber, Mark" <Mark_Fe...@bmc.com>
Subject preserving whitespace for xsd:anySimpleType
Date Mon, 10 Mar 2008 20:24:39 GMT
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


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.





View raw message