Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Validating a Xom graph

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Michael Kay" <mike AT saxonica.com>
  • To: "'Steve Loughran'" <steve.loughran AT gmail.com>, "'xom-interest'" <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Validating a Xom graph
  • Date: Wed, 12 Apr 2006 11:35:57 +0100

> Is there an easy way to validate a Xom graph other than by serializing
> it into an XML document and then reparsing it through a validating
> parser? I'd really just like something to walk the graph and compare
> it to the (sorry) XSD files.

Using the Saxon-SA schema validator, you can do something like this:

Configuration config = new SchemaAwareConfiguration();
config.setValidationMode(Validation.STRICT);
PipelineConfiguration pipe = config.getPipelineConfiguration();
new Sender(pipe).send(new DocumentWrapper(document), new Sink(), true);

where "document" is the XOM document.

(Not the world's most brilliant API, I know!)

Michael Kay
http://www.saxonica.com/






Archive powered by MHonArc 2.6.24.

Top of Page