[Fatal Error] :1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException: Content is not allowed in prolog.
private Document getMsgDoc(String xmlData) throws WOWException
{
Document document= null;
if ( xmlData==null || xmlData.trim().length()<=0 )
throw new Exception( "INVALID_XML_ERROR"+ xmlData );
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( new InputSource(new StringReader(xmlData)) );
} catch (SAXException sxe) {
Log.println(sxe);
} catch (ParserConfigurationException pce) {
Log.println(pce);
} catch (IOException ioe) {
Log.println(ioe);
}
请问是什么原因?
return document;
}
解析xml字符串时。xml字符串有什么规则吗。
当然有。
你把XML贴出来看看
<WW050WW CustName="H S CHINA LTD " CustLocn="CHINA"/>
up
应该是有不符合xml规则的符号
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 文件 解析 xmlData xml catch new document Log.println |
注册
个人空间
