Hi Sherwin,

I am not sure whether this is actually allowed by the XML Schema spec, but for the Castor XML source generator, this is currently something which is not supported.

Kind Regards
Werner

On 30.08.2013 22:15, Sherwin wrote:
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>(_ImportUnmarshaller.java:125_)

        at
org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startElement(_SchemaUnmarshaller.java:604_)

        at
org.exolab.castor.xml.schema.reader.Sax2ComponentReader.startElement(_Sax2ComponentReader.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(Unknown
Source)

        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to