Java 找不到元素';soapenv:Envelope';
我发现错误,无法找到元素soapenv:Envelope的声明Java 找不到元素';soapenv:Envelope';,java,xml,soap,Java,Xml,Soap,我发现错误,无法找到元素soapenv:Envelope的声明 '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlso
'<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/ /tmp/checkxsd.xsd"><soapenv:Body>
<ns:getEntitiesByFilterResponse xmlns:ns="http://services" xmlns:ax21="http://objects.services/xsd">
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1065798192</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1065835163</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1317237376</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
</ns:getEntitiesByFilterResponse></soapenv:Body></soapenv:Envelope>'
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new File("/tmp/checkxsd.xsd"));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(new File("/home/my-pc/MyXMLFile.xml")));
我发现错误,无法找到元素soapenv:Envelope的声明
'<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/ /tmp/checkxsd.xsd"><soapenv:Body>
<ns:getEntitiesByFilterResponse xmlns:ns="http://services" xmlns:ax21="http://objects.services/xsd">
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1065798192</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 001</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1065835163</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Project SoapUI 002</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
<ns:return xsi:type="ax21:EntityObj">
<ax21:entityId>1317237376</ax21:entityId>
<ax21:entityTypeId>4</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>436</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>100461</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>CopyTask_project_1448004605927</ax21:elementValue>
<ax21:id>400015</ax21:id>
</ax21:methodValues>
</ns:return>
</ns:getEntitiesByFilterResponse></soapenv:Body></soapenv:Envelope>'
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(new File("/tmp/checkxsd.xsd"));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(new File("/home/my-pc/MyXMLFile.xml")));
我的xsd是--
描述问题并提供正确完整的checkxsd.xsd
和MyXMLFile.xml
,请注意我已经发布了我的xsd和xml文件,非常感谢您的帮助。。