locating schemas with catalog w/out instance schemaLocations
Posted: Sun Mar 11, 2007 8:59 am
Is the following scenario possible with oXygen? (I'm using the Eclipse version.)
1. I have a schema that starts like:
2. I have an instance document that starts like:
3. I have a catalog that starts like:
4. oXygen sees the namespace declaration in the instance document, looks in the catalog and finds out the location of the local copy of the schema for that namespace, and uses it to validate the instance document.
Note that I do not have the xsi:schemaLocation attributes in the instance document. I strongly prefer to omit those, and have validation triggered in the way I have described.
If this is not possible with oXygen out of the box, would it be possible for me to make oXygen use a different parser implementation that would be able to do this? Norm Walsh has a new version of the xml resolver code in the works, and I've been able to get it to work in this fashion. The only additional requirement is to "decorate" the catalog like this:
I like that a lot better than having to pollute my instance documents with all that xsi:schemaLocation stuff that is just intended to "fake out" the parser.
Would oXygen pay attention to the settings of these properties:
? If so, it might be possible to swap in the new xml resolver stuff and get this kind of validation to work. Or is there a simpler way to accomplish this without such tweaking?
Thanks!
1. I have a schema that starts like:
Code: Select all
<xs:schema xmlns="http://my.tld/something" targetNamespace="http://my.tld/something" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" xml:lang="EN">
Code: Select all
<something xmlns="http://my.tld/something">
Code: Select all
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<uri name="http://my.tld/something" uri="schemas/something.xsd"/>
Note that I do not have the xsi:schemaLocation attributes in the instance document. I strongly prefer to omit those, and have validation triggered in the way I have described.
If this is not possible with oXygen out of the box, would it be possible for me to make oXygen use a different parser implementation that would be able to do this? Norm Walsh has a new version of the xml resolver code in the works, and I've been able to get it to work in this fashion. The only additional requirement is to "decorate" the catalog like this:
Code: Select all
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xmlns:r="http://www.rddl.org/" prefer="system">
<uri r:nature="http://www.w3.org/2001/XMLSchema"
r:purpose="http://www.rddl.org/purposes#schema-validation" name="http://my.tld/something" uri="schemas/something.xsd"/>
Would oXygen pay attention to the settings of these properties:
Code: Select all
javax.xml.parsers.SAXParserFactory
javax.xml.stream.XMLInputFactory
javax.xml.parsers.DocumentBuilderFactory
Thanks!