xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Validating a Document against a schema
- From: "Michael Kay" <mike AT saxonica.com>
- To: <elharo AT metalab.unc.edu>, "'Lowell Kirsh'" <lowellk AT gmail.com>
- Cc: XOM-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Validating a Document against a schema
- Date: Wed, 21 May 2008 14:34:21 +0100
> You could stream the document through the validator, but if
> you're creating it with XOM and then validating it, I can't
> think of a better way. Off the top of my head I'm not aware
> of any schema validators that work directly on the XOM model.
Saxon will do so. Using the s9api interface:
Processor p = new Processor(true);
XdmNode doc = p.newDocumentBuilder().wrap(xomDocument);
SchemaManager sm = p.getSchemaManager();
sm.load(...the schema...);
sm.newSchemaValidator().validate(doc.asSource());
or you can rely on xsi:schemaLocation to identify the schema if you prefer.
Michael Kay
http://www.saxonica.com/
-
[XOM-interest] Validating a Document against a schema,
Lowell Kirsh, 05/20/2008
-
Re: [XOM-interest] Validating a Document against a schema,
Elliotte Harold, 05/21/2008
- Re: [XOM-interest] Validating a Document against a schema, Michael Kay, 05/21/2008
-
Re: [XOM-interest] Validating a Document against a schema,
Elliotte Harold, 05/21/2008
Archive powered by MHonArc 2.6.24.