Java如何解析由String类型拼接的XML格式

2024-11-30 09:13:39
推荐回答(1个)
回答1:

用jdom
StringReader read = new StringReader(xml);
InputSource source = new InputSource(read);
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(source);
Element root = doc.getRootElement();
List nodes = root.getChildren();