Using ignorableWhitespace in SAX parser with XML Schema



I've been twiddling with Java's SAX parsing, trying to parse a document I've written in a schema I've defined in XSD. I've come across a problem: whitespace. Specifically, I'm having issues figuring out the best way to get ignorableWhitespace() working in a ContentHandler.


I've been applying Google-fu for the last few hours and I've gathered the following:



  • You have to validate the document in order for ignorableWhitespace to be called

  • You have to validate it against a DTD; XML Schema won't make it happen


The trouble is, I really want to use XML Schema for validation. I assume there's a good way around this, since there's no way nobody else has had to do this before, but despite the aforementioned Google-fu I was unable to find any good examples.


So basically, in three parts:



  1. Are the results of my Google-fu correct?

  2. If so, what are my options for dealing with the problem? Specifically, are there any elegant solutions?

  3. Can you point me to any good examples?


My thanks in advance to anyone who responds.


No comments:

Post a Comment