XSParser.parse() - referenced Exception - unable to parse if the element has
reference to another schema.
----------------------------------------------------------------------------------------------------------
Key: JAXME-57
URL: http://issues.apache.org/jira/browse/JAXME-57
Project: JaxMe
Type: Bug
Components: JaxMeXS
Versions: current (nightly)
Environment: win 2000 server, jdk 1.4.2_06.
Reporter: Kumar Raja
Hi
I am in the process of parsing the WSDL's schema definitions and generating
the Input SOAP request message for the Webservice call. So for that I am just
parsing the schema using the JaxMeXS and I am able to parse some the schemas
and I have problem parsing the schema which has the "ref" pointing to a
different schema. I am using XSParser.setValidating(false). Can the XSParser
handle this kind of situation or what should I need to do to prevent the
exception and I can't modify the schema since it is part of the WSDL.
** please see the comments for #JAXME56.
Any help would be greatly appreciated.
Thanks
code.
----
FileInputStream fs = new FileInputStream(args[0]);
InputSource is = new InputSource(fs);
XSParser parser = new XSParser();
parser.setValidating(false);
XSSchema schema = parser.parse(is);
*********** schema that I am trying to parse ***********************
<xsd:schema
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://namespaces.softwareag.com/eii/wsquery"
xmlns:intf="http://namespaces.softwareag.com/eii/wsquery"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://namespaces.softwareag.com/eii/wsquery"
elementFormDefault="unqualified">
<xsd:import namespace="http://www.customerinvoices.org"/>
<xsd:element name="query">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Region" type="xsd:string"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="result">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0"
maxOccurs="unbounded" ref="oens:Region"
xmlns:oens="http://www.customerinvoices.org"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
*********** schema that being referenced by ***********************
<xsd:schema targetNamespace="http://www.customerinvoices.org"
elementFormDefault="qualified">
<xsd:element name="Region">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Name" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="RegionRevenue" type="xsd:double"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Countries_1" minOccurs="0"
maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Code" type="xsd:string" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="CountryRevenue" type="xsd:double"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="CountryName" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
*********************** exception trace ******************
Exception in thread "main" org.apache.ws.jaxme.xs.parser.impl.LocSAXException:
At line 21, column 118: The referenced element
{http://www.customerinvoices.org}Region is undefined.
at
org.apache.ws.jaxme.xs.impl.XSGroupImpl.addParticle(XSGroupImpl.java:201)
at
org.apache.ws.jaxme.xs.impl.XSGroupImpl.addParticle(XSGroupImpl.java:158)
at
org.apache.ws.jaxme.xs.impl.XSGroupImpl.initParticles(XSGroupImpl.java:144)
at
org.apache.ws.jaxme.xs.impl.XSGroupImpl.validate(XSGroupImpl.java:282)
at
org.apache.ws.jaxme.xs.impl.XSTypeImpl$XSSequenceComplexTypeImpl.<init>(XSTypeImpl.java:398)
at org.apache.ws.jaxme.xs.impl.XSTypeImpl.validate(XSTypeImpl.java:698)
at
org.apache.ws.jaxme.xs.impl.XSElementImpl.validate(XSElementImpl.java:194)
at
org.apache.ws.jaxme.xs.impl.XSSchemaImpl.validate(XSSchemaImpl.java:431)
at
org.apache.ws.jaxme.xs.impl.XSSchemaImpl.validate(XSSchemaImpl.java:452)
at
org.apache.ws.jaxme.xs.impl.XSContentHandlerImpl.endDocument(XSContentHandlerImpl.java:83)
at org.apache.xerces.parsers.SAXParser.endDocument(SAXParser.java:1230)
at
org.apache.xerces.validators.common.XMLValidator.callEndDocument(XMLValidator.java:1080)
at
org.apache.xerces.framework.XMLDocumentScanner$EndOfInputDispatcher.dispatch(XMLDocumentScanner.java:1499)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at
org.apache.ws.jaxme.xs.impl.XSLogicalParser.parse(XSLogicalParser.java:662)
at org.apache.ws.jaxme.xs.XSParser.parse(XSParser.java:156)
at MyParser.main(MyParser.java:22)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]