Hi Craig, The CXF code you've shown is not setting a system ID on the DOMSource it's passing to the SchemaFactory. This is a common programming error and I suspect that's the reason why this is failing. The relative URIs in the schema (embedded in the WSDL) require a base URI for resolution. CXF should be providing one by calling DOMSource.setSystemId() [1].
Thanks. [1] http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/transform/dom/DOMSource.html#setSystemId (java.lang.String) Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Craig Tataryn <crai...@tataryn.net> wrote on 09/09/2009 11:18:14 PM: > Hi, having problems with Xerces. I'm using CXF's wsdl2java build > plugin to generate java classes. Xerces seems to be choking with the > following error: > > Caused by: org.xml.sax.SAXParseException: src-resolve: Cannot resolve > the name 'hl7:FICR_IN610104CA' to a(n) 'element declaration' > component. > at > org > .apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown > Source) > at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown > Source) > at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown > Source) > at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown > Source) > at > org > .apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown > Source) > at > org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown > Source) > at > org > .apache > .xerces.impl.xs.traversers.XSDElementTraverser.traverseLocal(Unknown > Source) > at > org > .apache > .xerces.impl.xs.traversers.XSDHandler.traverseLocalElements(Unknown > Source) > at > org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown > Source) > at > org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source) > at > org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source) > at > org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source) > at > org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown > Source) > at javax.xml.validation.SchemaFactory.newSchema(Unknown Source) > at > org > .apache > .cxf > .tools > .wsdlto > .databinding.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java: > 642) > > The line of code where this error is caught is in JAXBDataBinding, the > SchemaFactory is indeed a Xerces one > (org.apache.xerces.jaxp.validation.XMLSchemaFactory) at runtime and > it's failing on the newSchema(domSrc) call: > > public void validateSchema(Element ele) throws ToolException { > SchemaFactory schemaFact = > SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); > DOMSource domSrc = new DOMSource(ele); > try { > schemaFact.newSchema(domSrc); > } catch (SAXException e) { > if (e.getLocalizedMessage().indexOf("src-resolve.4.2") > > -1) { > //Ignore schema resolve error and do nothing > } else { > throw new ToolException("Schema Error : " + > e.getLocalizedMessage(), e); > } > } > } > > Now for sake of brevity I've only attached the wsdl and the schema > that contains the FICR_IN610104CA element. Xerces doesn't seem to be > able to cope with the "urn:hl7-org:v3" namespace, it doesn't seem to > realize that it's the targetNamespace for the FICR_IN610104CA.xsd... > If anyone needs the fullset of schemas let me know, I can send them > directly to you. > > Any help would be greatly appreciated, XMLSpy and Eclipse don't seem > to have any problems, they validate the wsdl and schema without > problem. The version of XercesImpl being used is: 2.8.1, although I > did try with 2.9 as well but with the same effect. > > Any other detail someone might need, let me know. > > Craig. > > -- > Craig Tataryn > site: http://www.basementcoders.com/ > podcast:http://feeds.feedburner.com/TheBasementCoders > irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin > twitter: craiger > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org