Hi,

 

I have been using castor for the last few months and I am facing an issue
with a particular xml schema. Below is the problematic part of the schema

 

<schema elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="urn:sobject.enterprise.soap.sforce.com">

 

            <import namespace="urn:enterprise.soap.sforce.com"/>

 

 

            <!-- Base sObject (abstract) -->

            <complexType name="sObject">

                <sequence>

                    <element name="fieldsToNull"       type="xsd:string"
nillable="true" minOccurs="0" maxOccurs="unbounded"/>

                    <element name="Id"                 type="tns:ID"
nillable="true" />

                </sequence>

            </complexType>

..

...

...

...

</schema>

<schema elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema";
targetNamespace="urn:enterprise.soap.sforce.com">

 

            <import namespace="urn:sobject.enterprise.soap.sforce.com"/>

 

            <!-- Our simple ID Type -->

            <simpleType name="ID">

                <restriction base="xsd:string">

                    <length value="18"/>

                    <pattern value='[a-zA-Z0-9]{18}'/>

                </restriction>

            </simpleType>

...

..

..

</schema>

 

I have highlighted the parts in question. This is an extract from the types
part of a salesforce wsdl. 

As you can see there are two schema elements present in the types part of
the wsdl. The issue is that each of them as an import which imports the
other. This is where castor fails with the following error

org.exolab.castor.xml.schema.SchemaException: Unable to resolve Schema
corresponding to namespace 'urn:enterprise.soap.sforce.com'.

       at
org.exolab.castor.xml.schema.reader.ImportUnmarshaller.<init>(ImportUnmarsha
ller.java:125)

       at
org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(SchemaUn
marshaller.java:604)

       at
org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(Sax2Com
ponentReader.java:255)

       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)

       at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)

       at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
wn Source)

       at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)

       at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)

       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

       at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)

       at
org.exolab.castor.xml.schema.reader.SchemaReader.read(SchemaReader.java:301)

 

Thanks,

 

Sherwin

Reply via email to