话说有一天,哥要解析XML,于是就百度COPY了一段代码,用的是org.jdom这个包
xml内容如下
[color=red] <?xml version="1.0" encoding="GB2312"?>
<r>
<a>新宏·香榭丽舍</a>
</r>[/color]
简析代码:
SAXBuilder sax = new SAXBuilder();
Document xmlDom = sax.build(new ByteArrayInputStream(xmlStr.getBytes()));
结果简析出来的为:[color=red]新宏?香榭丽舍[/color]
网上搜了些方针:
SAXBuilder sax = new SAXBuilder();
Document xmlDom = sax.build(new InputSource(new StringReader(xmlStr)));
立马OK啦,但原因并未找到
xml内容如下
[color=red] <?xml version="1.0" encoding="GB2312"?>
<r>
<a>新宏·香榭丽舍</a>
</r>[/color]
简析代码:
SAXBuilder sax = new SAXBuilder();
Document xmlDom = sax.build(new ByteArrayInputStream(xmlStr.getBytes()));
结果简析出来的为:[color=red]新宏?香榭丽舍[/color]
网上搜了些方针:
SAXBuilder sax = new SAXBuilder();
Document xmlDom = sax.build(new InputSource(new StringReader(xmlStr)));
立马OK啦,但原因并未找到