Details

Description

I have WSDL file which imports XSD files and these XSD files import or include another XSD files etc.
I call XmlBeans.compileXsd method on List of XmlObject of this WSDL file.
If some XmlObject contains XS:INCLUDE then XmlException occurs.

I think that in StscImporter.DownloadTable.resolveImportsAndIncludes(boolean) method should be
Schema included = downloadSchema(includes[i], sourceNamespace, includes[i].getSchemaLocation());
instead of
Schema included = downloadSchema(includes[i], null, includes[i].getSchemaLocation());
because if I make this change then it works ok.

Activity

I have a similar problem. It looks like the include doesn't work with local file paths. I get the an org.apache.xmlbeans.XmlException with the text: error: Could not load resource "./included.xsd" (network downloads disabled). If I enabled the XmlOption.setCompileDownloadUrls() then the code complains the I have a badly formed URI.

xsd:import works fine with a local path; it's just xsd:include that is broken.

Chris White
added a comment - 27/Apr/12 14:47 - edited I have a similar problem. It looks like the include doesn't work with local file paths. I get the an org.apache.xmlbeans.XmlException with the text: error: Could not load resource "./included.xsd" (network downloads disabled). If I enabled the XmlOption.setCompileDownloadUrls() then the code complains the I have a badly formed URI.
xsd:import works fine with a local path; it's just xsd:include that is broken.
What was the exception you were getting?

Jacob Danner
added a comment - 04/May/12 23:08 When using this API, I believe you are simply missing an additional flag on the XmlOptions object
http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlOptions.html#setCompileDownloadUrls( )
When I ran your code with the following:
XmlBeans.compileXsd(schemas.toArray(new XmlObject [schemas.size()] ), XmlBeans.getBuiltinTypeSystem(), new XmlOptions().setCompileNoUpaRule().setCompileDownloadUrls() );
I got past the error noted. Instead I got the following output.
Retrieving document at './data-in/egon/wsdl/IszrRobCtiAifo.wsdl'.
Retrieving schema at '../xsd/IszrRobCtiAifo.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/./data-in/egon/wsdl/IszrRobCtiAifo.wsdl'.
Retrieving schema at 'ref/RuianCtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
Retrieving schema at '../../../ruian/xsd/cti_pro_rob/CtiProRob.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/ref/RuianCtiProRob.xsd'.
Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
Retrieving schema at 'XopInclude.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/RegTypy.xsd'.
Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
Retrieving schema at '../../../ruian/xsd/cti/CtiAdresa.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti_pro_rob/CtiProRob.xsd'.
Retrieving schema at '../../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
Retrieving schema at '../../../ruian/xsd/typy/CommonTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/typy/CommonTypy.xsd'.
Retrieving schema at '../../../ruian/xsd/typy/BaseTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/ruian/xsd/cti/CtiAdresa.xsd'.
Retrieving schema at 'IszrAbstract.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrAbstract.xsd'.
Retrieving schema at '../../rob/xsd/RobDotazyData.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/egon/xsd/IszrRobCtiAifo.xsd'.
Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'.
Retrieving schema at 'RobTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobDotazyData.xsd'.
Retrieving schema at '../../RegTypy.xsd', relative to 'file:/D:/ide/eclipse/IncludeBug/foo/IncludeBug/data-in/rob/xsd/RobTypy.xsd'.
org.apache.xmlbeans.XmlException: error: URL "XopInclude.xsd" is not well-formed
at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
at org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553)
at bug.Main.main(Main.java:50)