[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xom-interest
Subject:    Re: [XOM-interest] Validating a Xom graph
From:       "Michael Kay" <mike () saxonica ! com>
Date:       2006-04-12 10:35:57
Message-ID: 20060412103616.C58FC4C00B () lists ! ibiblio ! org
[Download RAW message or body]

> 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/


_______________________________________________
XOM-interest mailing list
XOM-interest@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic