You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Sander Bos <sa...@x-hive.com> on 2003/02/21 11:29:06 UTC

XMLDocumentHandler and ignorable white-space with XML Schema Validation

Hi there,

I am looking at removing ignorable whitespace from documents parsed
(through the XNI XMLDocumentHandler) with XML Schema validation. I first
tried it with the ignorableWhitespace callback, but that does not get
called for documents validated against an XML schema, only for DTDs. I
could get a confirmation for that in Bugzilla,
	http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9496
although that item is related to DOM, not to XNI.

>From that bugreport I make out that apparently ignorable white space is
not defined for XML Schema, but what I mean with it is that when you
have a schema-fragment like

 <xsd:element name="person">
   <xsd:complexType mixed="false">
     <xsd:sequence>
       <xsd:element name="address" type="xsd:string"/>
       <xsd:element name="name"  type="xsd:string"/>
     </xsd:sequence>
   </xsd:complexType>
 </xsd:element>

And an instance fragment like
  <person><address>    </address>     <name>Sander</name>
  </person>

then the spaces, reported as characters by XMLDocumentHandler, between
<address> and </address> are in my mind significant while the spaces are
between </address> and <name> are not, in my mind anyway. But if mixed
were true, both sets of whitespace would (or at least could) be
significant.

Does anybody have any idea how I could see the difference between the
different types of whitespace, using XMLDocumentHandler? I for instance
looked at the augmentations that get passed in the call to the
characters callback method, but they are always null.

(By the way, the use case is that we want to take out insignificant
whitespace (there is usually a lot of indenting in input XML) to
preserve memory, but keep whitespace that could be relevant for
validation.)

Kind regards,

--Sander.

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