xml报错请帮忙,在线等,谢谢大家!!!
String str ="<root><row id=123><RelySubType >SUN</RelySubType></row></root>";Document dom = DocumentHelper.parseText(str);Element root = dom.getRootElement();Iterator i= root.elementIterator("row");while(i.hasNext()){ Element foo= (Element)i.next(); String str1 = foo.attributeValue("id") ; System.out.println(str1); }
String str ="<root><row id=\"123\"><RelySubType >SUN</RelySubType></row></root>";
[解决办法]
String str ="<root><row id=\"123\"><RelySubType >SUN</RelySubType></row></root>";
xml中要求必须带有引号的