繁体   English   中英

SAXException = XML文档结构必须在同一实体内开始和结束

[英]SAXException=XML document structures must start and end within the same entity

有人可以告诉我为什么会出现此解析错误吗? XML对我来说看起来不错。 由于SAXException=XML document structures must start and end within the same entity.失败,因此SAXException=XML document structures must start and end within the same entity. 在这一行:

Document doc = builder.parse(inputSource);  //fails here

这是代码:

        String soapIn = "<?xml version='1.0' encoding='UTF-8' ?>\n" +
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:vid=\"http://videocontrollerchannelmap.queryservice.vcwh.oss.my.company.com/\">\n" +
"   <soapenv:Header/>\n" +
"   <soapenv:Body>\n" +
"      <vid:getInneoquestChannelMap>\n" +
"         <appkey>ONE_CONTROLLER</appkey>\n" +
"         <forceUpdate>true</forceUpdate>\n" +
"      </vid:getInneoquestChannelMap>\n" +
"   </soapenv:Body>\n" +
"</soapenv:Envelope";
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        SOAPMessage newMsg = null;
        try {
            DocumentBuilder builder = factory.newDocumentBuilder();
            InputSource inputSource = new InputSource(new StringReader(soapIn));
            Document doc = builder.parse(inputSource);  //fails here
            DOMSource domSource = new DOMSource(doc);

你缺少>"</soapenv:Envelope"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM