Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java XSD验证器给出org.xml.sax.SAXParseException:schema_reference.4错误_Java_Xml_Xsd - Fatal编程技术网

Java XSD验证器给出org.xml.sax.SAXParseException:schema_reference.4错误

Java XSD验证器给出org.xml.sax.SAXParseException:schema_reference.4错误,java,xml,xsd,Java,Xml,Xsd,当我尝试加载xsd文件时,出现以下异常 例外情况: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'jar:file:/XXX.jar!/lib/yyyy.jar!/resources/copyprocess.xsd', because 1) could not find the document; 2) the document could

当我尝试加载xsd文件时,出现以下异常

例外情况:

    org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document     
   'jar:file:/XXX.jar!/lib/yyyy.jar!/resources/copyprocess.xsd', because 1) could not  
    find the document; 2) the document could not be read; 3) the root element of the 
    document is not <xsd:schema>.
     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.getSchemaDocument(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(SchemaFactory.java:594)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:626)   
copyprocess.xsd

     <?xml version="1.0" encoding="UTF-8"?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
     elementFormDefault="qualified" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
     jaxb:version="2.1">


我已经检查了文件是否存在于yyyy.jar.resources中,根元素如上所述。我如何继续执行此操作?

问题是路径中有两个jar(即jar中的jar),我正在执行getResource。在jar中的jar场景中,getResourceAsStream将起作用

     <?xml version="1.0" encoding="UTF-8"?>
      <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
     elementFormDefault="qualified" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" 
     jaxb:version="2.1">