Re: Schema validation of xml document from within an XSL processor

On Wednesday, 05/01/2002 at 04:26 EDT, Noah Mendelsohn/Cambridge/IBM wrote:
> How can I get one of the xsl processors, e.g.,  Xalan-J or Saxon, to
> validate the incoming XML document against its referenced XML Schema
> document?

Can't answer for Saxon, but here's a very brief Xalan answer:

At this time, there is no Xalan switch to control schema validation, and it
does not default to being turned on. (That default may change as the Xerces
team continues to improve the performance of the schema validator.)

The recommended solution for now is to build your own instance of the
parser, configure it for schema validation, and pass its output into Xalan
by wrapping it in a SAXSource. Remember to also turn on Namespace support,
and to set the SAX namespace-prefixes feature to true; Xalan currently
requires both.  This solution ought to work for other processors which
support TrAX; something like it can probably be arranged for those who
don't.


Yes, it might be nice to have a way to request schema validation when Xalan
instantiates the parser. There has also been a request for better control
over when DTD validation does/doesn't occur. I'll log those as enhancement
requests, so we don't forget to address them.

Received on Wednesday, 1 May 2002 16:51:18 UTC