有人可以告诉我为什么我得到这个解析错误? XML看起来很好。 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);
答案 0 :(得分:3)
您错过了>
上的"</soapenv:Envelope"
。