Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Validating Against Relax NG Schemas?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: Randall R Schulz <rschulz AT sonic.net>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Validating Against Relax NG Schemas?
  • Date: Wed, 25 Oct 2006 10:59:54 -0700

RelaxNG, XOM and *SAX* can be combined via the Nux method nux.xom.pool.BuilderFactory.createMSVBuilder(InputStream schema, URI systemID). See http://dsd.lbl.gov/nux/api/nux/xom/pool/ BuilderFactory.html

Example usage:

nu.xom.Builder builder = new BuilderFactory().createMSVBuilder (null, new URI("http://www.docbook.org/docbook-ng/ipa/docbook.rng";));
//Builder builder = new BuilderFactory().createMSVBuilder(null, new File("/tmp/docbook/docbook.rng").toURI());
Document doc = builder.build(new File("/tmp/mybook.xml"));
System.out.println(doc.toXML());

Alternatively, RelaxNG, XOM and *StaX* can be combined via the Nux method nux.xom.io.StaxUtil.createBuilder(XMLInputFactory inputFactory, NodeFactory factory) where XMLInputFactory means Woodstox StAX configured to validate against RelaxNG. See the woodstox documentation for examples, as well as See http:// dsd.lbl.gov/nux/api/nux/xom/io/StaxUtil.html

Example usage:

XMLInputFactory inputFactory = ... woodstox configured to use relaxng
nu.xom.Builder builder = nux.xom.io.StaxUtil.createBuilder (inputFactory, null);
Document doc = builder.build(new File("/tmp/mybook.xml"));
System.out.println(doc.toXML());

Both SAX and StAX Builder implementations use the Sun-MSV validator behind the scenes.

Wolfgang.


On Oct 25, 2006, at 10:41 AM, Randall R Schulz wrote:

Hi,

I'm just getting started with my first real XML project. As part of
learning the landscape, I created a W3C XML Schema for my domain
(first-order logic formulas and knowledge bases holding them). It was a
rather frustrating exercise and it does not seem amenable to quite
capturing my ideal representation for this content, though it's
entirely possible I overlooked options not apparent to a novice.

So I kept surveying the XML and XML+Java processing landscape and found
XOM and, of course, Relax NG. It seems that they might be a good choice
for me but as part of deciding the precise set of technologies I'll
use, I need to know what's involved with mixing XOM with Relax NG.

Is it possible? If so, is it straightforward? I could not find anything
specific or definitive addressing this issue.

Thanks in advance for any information, advice or pointers.


Randall Schulz
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page