Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] in-memory validation

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Cc: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Subject: Re: [XOM-interest] in-memory validation
  • Date: Tue, 7 Sep 2004 16:55:14 -0700

Also, perhaps one of the more useful implementations for RELAX and Schematron is MSV with JAXP masquerading:

http://www.ibiblio.org/osprey/trove/validator/JAXPmasquerading.html

Copied from the above page:

If your application is using SAX, it must have some code to create a new instance of SAXParserFactory:
// create a new parser
SAXParserFactory factory = SAXParserFactory.newInstance();

factory.setNamespaceAware(true);

SAXParser parser = factory.newSAXParser();

// parse the document
parser.parse(new File("abc.xml"),myHandler);


To use JAXP masquerading, change the above code as shown in the following example:
// create a new parser
SAXParserFactory factory =
com.sun.msv.verifier.jaxp.SAXParserFactoryImpl();

factory.setNamespaceAware(true);

SAXParser parser = factory.newSAXParser();
factory.setProperty("http://www.sun.com/xml/msv/schema";,
schemaUrl);

// parse the document
parser.parse(new File("abc.xml"),myHandler);

On Sep 7, 2004, at 4:42 PM, Wolfgang Hoschek wrote:

On Sep 7, 2004, at 3:56 PM, Elliotte Rusty Harold wrote:

I'm not convinced this is on the right side of 80/20. Nor am I convinced this is the right API. (Is validation always done via a Builder? What about RELAX and Schematron?) If you can convince me of both of these points, I might consider it post 1.0, but I might also leave it as a third party opportunity.

I'm not convinced either that this is the right API, but do I think that in-memory validation is important and tricky/confusing enought to warrant some built-in help by XOM. How would suggest it should be done? My app would appreciate catching it's own bugs as early as possible, and validating before sending docs onto the network would help here.

BTW, I've heard (from far away) that, RELAX and Schematron, etc. can be done with SAX via some SAX Bridge, see

http://www.relaxng.org/
http://www.kohsuke.org/

Hence it might be a good idea to let the user pass a Builder on input, so the user can configure it as needed by whatever schema languages is in use, and XOM does not need to care.






Archive powered by MHonArc 2.6.24.

Top of Page