簡體   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