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

Java SAXException=XML文档结构必须在同一实体中开始和结束,java,soap,xml-parsing,Java,Soap,Xml Parsing,有人能告诉我为什么会出现这个解析错误吗?XML在我看来很好。由于SAXException=XML文档结构必须在同一实体中开始和结束,因此失败。 在这一行: Document doc = builder.parse(inputSource); //fails here 代码如下: String soapIn = "<?xml version='1.0' encoding='UTF-8' ?>\n" + "<soapenv:Envelope xmlns:soap

有人能告诉我为什么会出现这个解析错误吗?XML在我看来很好。由于
SAXException=XML文档结构必须在同一实体中开始和结束,因此失败。
在这一行:

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);
String soapIn=“\n”+
“\n”+
“\n”+
“\n”+
“\n”+
“一个\u控制器\n”+
“正确\n”+
“\n”+
“\n”+

“你错过了
上的
”你错过了
上的
“哦,天哪,盯着看太久了。谢谢!哦,天哪,盯着看太久了。谢谢!