We are extensively using JAXB 2.x to generate data objects from schema systems (42 xsd files) Are there. This whole process runs fine, there is no problem but instead of changing it instead of the JACAP verification framework, remove the entire JACB verification framework (and removed it from implementation). (All this is located in the javax.xml.validation
package.)
All the files given in the dependency order I have javax.xml.validation.SchemaFactory
, And verified that they are in correct order The problem is that a file is not generating errors that do not know the references from namespace defined in another file. It's actually acting like an import. (I am not completely convinced, as per the XML schema specification, a failed import is not an error, so I can not verify that the import is failing, it does not generate any warning or error. What is happening in this, because if I make a reference comment, then this complaint closes. Here is the basic code:
import javax.xml.transform.Source; Last java.util.ArrayList & lt; source & gt; XsdSources = New java.util.ArrayList & lt; source & gt; (); / * Make a list with all xsds in the order dardardness order, that is, no jury is showing in lower index. use xml.transform.stream.StreamSource therefore I am giving it Strims the java.util.jar.JarFile # getInputStream (Jerentry). * / final javax.xml.validation.SchemaFactory schema Factor = javax.xml.validation .SchemaFactory.newInstance (javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI); SchemaFactory.setErrorHandler (New SchemaErrorHandler ()); Return SchemaFactor. Envecchremia (xsds.serre (new source [] {}));
The errors provided by the error handler show only those signals that the references are not found. Here's the XSD dependency list that looks like a file:
xsds / import / foo / thing.xsd (& lt; xsd: element name = "object" & gt; .. xsd: element & gt;) xsds / import / foo / otherthing.xsd (& lt; xsd: include schema location = "thing.xsd" />) xsds / import / foo / all. Xsd (& lt; xsd: included schema location = "other thing.exd" />) xsds / mystuff / main.xsd (
errors and Stackets look like this:
org.xml.sax.SAXParseException: src -resolve: element declaration element for a (n) com.sun.org.apache.xerces.internal Com on com.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:195): can not resolve the name 'talk foo'. On .sun.org.apache.xerces.internal.uti l.ErrorHandlerWrapper.error com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (ErrorHandlerWrapper.java:131) (XMLErrorReporter.java:384) com On .sun.org.apache.xerces.internal On impl.xs.traversers.XSDHandler.reportSchemaErr com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError (XSDHandler.java:2528) (XSDHandler.java:2537) on com.sun. org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl (XSDHandler.java:1472) on com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal (XSDElementTraverser.java : 160) on com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements (XSDHandler.java:2049) on com.sun.org.apache.xerces.internal.impl.xs.traversers on .XSDHandler.parseSchema (XSDHandler.java:582) com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema (XMLSchemaLoader.java:552) on com.sun.org.apache.xerces.internal .impl.xs.XMLSchemaL oader.loadGrammar com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar on (XMLSchemaLoader.java:519) (XMLSchemaLoader.java:485) com.sun.org.apache On .xerces.internal. Jaxp.validation.XMLSchemaFactory.newSchema (XMLSchemaFactory.java, 10)
main.xsd
does similar things for other files, with almost the same way, and They all work fine, what is the special reason why someone is giving the error?
Do you have a base near the source to create Java Util.jar.JarFile # getInputStream (JarEntry) URL, such as can resolve relative URLs in your schema and you can have all the schema in the same issue?
Did you file it? If the file system or from an exploded Classpath, how to work it from the inside of the jar, please refer to another question about it.
Comments
Post a Comment