Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] XSD Schema and Validation problems

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: peter murray-rust <pm286 AT cam.ac.uk>
  • To: Steve Loughran <steve.loughran AT gmail.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] XSD Schema and Validation problems
  • Date: Mon, 19 Dec 2005 14:21:04 +0000

At 13:30 19/12/2005, Steve Loughran wrote:

sometimes xerces doesnt like spaces in filenames. Those schema
locations should not have spaces in, but %20 bits where they go. You
can use File.toURI or something to create valid uris. But personally,
I'd leave them out altogether.

Thanks - I hate spaces in filenames and never use them - I think they are being added by some relative addressing process

>


you need to look at how you can point xerces at schema locations.
There are properties for that, and for generic JAXP parsers (as a
fallback)

http://cvs.sourceforge.net/viewcvs.py/smartfrog/core/components/xml/src/org/smartfrog/services/xml/utils/XmlConstants.java?view=markup

This is Ant 1.7's schemavalidate task:
https://svn.apache.org/viewcvs.cgi/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java?view=markup

I use a catalog myself, which registers the stuff with xerces, but
also registers itself to resolve any URL, and returns the files that
are included on the classpath:

http://cvs.sourceforge.net/viewcvs.py/smartfrog/core/extras/cdl/src/org/smartfrog/sfcore/languages/cdl/CdlCatalog.java?view=markup
http://cvs.sourceforge.net/viewcvs.py/smartfrog/core/components/xml/src/org/smartfrog/services/xml/utils/XmlCatalogResolver.java?view=markup

I've found that matching on the last thing on the path works best, for
reasons I dont understand.



> I would be grateful for pointers as to how to mend this and also ways
> of schema validation which do not require embedding absolute or
> relative addresses within the XML instances.

use a catalog; hand it off to your parser to resolve things and return
files on the classpath; add **/*.xsd to your JAR. Add some logging to
the catalog for extra diagnostics of trouble.

Thanks again,
This has given me courage to return to catalogs (which I used under SGML but for which there was limited support at the time). Sounds like they have a better toolkit now.

P.




Peter Murray-Rust
Unilever Centre for Molecular Sciences Informatics
University of Cambridge,
Lensfield Road, Cambridge CB2 1EW, UK
+44-1223-763069




Archive powered by MHonArc 2.6.24.

Top of Page