Hi Ken, There's no native support in Xerces for loading schemas from a WSDL so presumably you're trying to do this by extracting the individual schema documents and then passing them to the schema loader. Am I right?
How to get it working probably isn't obvious, particularly if there are imports between the inline schemas. You might find this JIRA issue [1] (from a few years back) helpful. Thanks. [1] http://issues.apache.org/jira/browse/XERCESJ-1100 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Ken Wang <kensxsdquest...@gmail.com> wrote on 08/19/2009 05:49:13 PM: > Hi there, > > The file passed the validation in both XMLSpy and soapUI. However, > when I call > XMLSchemaLoader parser = new XMLSchemaLoader(); > XSGrammarPool grammarPool = new XSGrammarPool(); > parser.setProperty(GRAMMAR_POOL, grammarPool); > parser.setErrorHandler(errHandler); > parser.loadGrammar(inputSrcArry) where inputSrcArry is an > XMLInputSource array containing schema definitions as element > > from my java application using Xerces-J 2.8.0. I received a long > list of errors. Most of them are like: > > [Error] askOrderService.wsdl:7:102: src-resolve: Cannot resolve the > name 'java:AbstractType' to a(n) 'type definition' component. > [Error] askOrderService.wsdl:27:95: src-resolve: Cannot resolve the > name 'java:AbstractBean' to a(n) 'type definition' component. > [Error] askOrderService.wsdl:7:26: cos-ct-extends.1.4.3.2.2.1.a: The > content type of a derived type and that of its base must both be > mixed or both be element-only. Type 'Service' is element only, but > its base type is not. > [Error] askOrderService.wsdl:43:26: cos-ct-extends.1.4.3.2.2.1.a: > The content type of a derived type and that of its base must both be > mixed or both be element-only. Type 'LineOfBusiness' is element > only, but its base type is not. > [Error] askOrderService.wsdl:52:26: cos-ct-extends.1.4.3.2.2.1.a: > The content type of a derived type and that of its base must both be > mixed or both be element-only. Type 'DataReference' is element only, > but its base type is not. > > The WSDL contains 18 schemas in total. I loaded Xerces2.8.0 source > code into my IDE, found the "src-resolve" error was thrown from > XSDHandler.java(Ln:1392). It seems the parser only looks for > referenced schema from the schemas it has traversed earlier ( in > fGrammarBucket), when a referenced schema is positioned after the > current schema in the file, the parser won't look for it, even if an > <import namespace=""> has existed in the current schema definition. > I then changed the sequence of schema definition positions in the > file, and got errors about different elements. > > Can anybody shed some light on this? > > Thanks.