P
peter greaves
hi everyone
i am having a bad time with an entity resolver. my application uses a
resolver to locally-cache the nested schemas that the basic xsd
includes to a local directory. however i am getting an exception when
the parser tries to parse one of the included xsds which it has
downloaded, because (as far as i can tell from the stack trace) it is
trying but failing to handle other included xsds. the exception is
here:
java.lang.NullPointerException
at org.apache.xerces.validators.schema.TraverseSchema.traverseImport(TraverseSchema.java:1953)
at org.apache.xerces.validators.schema.TraverseSchema.traverseIncludedSchema(TraverseSchema.java:1227)
at org.apache.xerces.validators.schema.TraverseSchema.traverseInclude(TraverseSchema.java:1135)
<.. stuff omitted for brevity ..>
basically my xsds are all located on a remote server - i want to cache
them locally while i parse a series of docs. so i have a top level
schema which *imports *another schema with a namespace:
<xs:import namespace="http://w3.ibm.com/cc/rdf/v1"
schemaLocation="cc-rdf.xsd"/>
.... and this imported schema is downloaded. but i think the exception
occurs when the imported schema is parsed, and the parser sees this in
it:
<xs:schema targetNamespace="http://w3.ibm.com/cc/rdf/v1"
xmlns="http://w3.ibm.com/cc/rdf/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="cc-rdf-documentTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-industryTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-languageTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-countriesTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-geographySimpleTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-productTypes.xsd"/>
the entity resolver does not resolve and locally cache these files at
all, so i am guessing that it's in parsing cc-rdf.xsd that the
exception occurs. the first of these files has this as its header
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://w3.ibm.com/cc/rdf/v1"
xmlns="http://w3.ibm.com/cc/rdf/v1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
am wondering if some mismatch in namespaces is causing this but am not
sure. i can see that other included xsds are downloaded and parsed
fine. it seems that it is only the imported schema that fails. anyone
got any experience with this problem?
peter
i am having a bad time with an entity resolver. my application uses a
resolver to locally-cache the nested schemas that the basic xsd
includes to a local directory. however i am getting an exception when
the parser tries to parse one of the included xsds which it has
downloaded, because (as far as i can tell from the stack trace) it is
trying but failing to handle other included xsds. the exception is
here:
java.lang.NullPointerException
at org.apache.xerces.validators.schema.TraverseSchema.traverseImport(TraverseSchema.java:1953)
at org.apache.xerces.validators.schema.TraverseSchema.traverseIncludedSchema(TraverseSchema.java:1227)
at org.apache.xerces.validators.schema.TraverseSchema.traverseInclude(TraverseSchema.java:1135)
<.. stuff omitted for brevity ..>
basically my xsds are all located on a remote server - i want to cache
them locally while i parse a series of docs. so i have a top level
schema which *imports *another schema with a namespace:
<xs:import namespace="http://w3.ibm.com/cc/rdf/v1"
schemaLocation="cc-rdf.xsd"/>
.... and this imported schema is downloaded. but i think the exception
occurs when the imported schema is parsed, and the parser sees this in
it:
<xs:schema targetNamespace="http://w3.ibm.com/cc/rdf/v1"
xmlns="http://w3.ibm.com/cc/rdf/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="cc-rdf-documentTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-industryTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-languageTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-countriesTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-geographySimpleTypes.xsd"/>
<xs:include schemaLocation="cc-rdf-productTypes.xsd"/>
the entity resolver does not resolve and locally cache these files at
all, so i am guessing that it's in parsing cc-rdf.xsd that the
exception occurs. the first of these files has this as its header
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://w3.ibm.com/cc/rdf/v1"
xmlns="http://w3.ibm.com/cc/rdf/v1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
am wondering if some mismatch in namespaces is causing this but am not
sure. i can see that other included xsds are downloaded and parsed
fine. it seems that it is only the imported schema that fails. anyone
got any experience with this problem?
peter