Nutz提供的Xmls,怎么解析xml字符串!!!
3 回复
public class XmlsTest {
@Test
public void testAsMap() {
String xmlStr = "<root><name>wendal</name><age>29</age><skills><java>good</java><lua>ok</lua></skills></root>";
Document doc = Xmls.xml(new ByteArrayInputStream(xmlStr.getBytes()));
Element root = doc.getDocumentElement();
Map<String, Object> map = Xmls.asMap(root);
assertEquals("wendal", map.get("name").toString());
}
}
@wendal 3Q
添加回复
请先登陆