MyException - 我的异常网
当前位置:我的异常网» J2SE » xml报错,请帮忙,

xml报错,请帮忙,

www.MyException.Cn,网友分享于:2013-01-01   浏览:27次
xml报错,请帮忙,在线等!!!!
Java code


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);
            }




用的 DOM4J。
报错 Open quote is expected for attribute "id" associated with an element type "row". Nested exception: Open quote is expected for attribute "id" associated with an element type "row".

------解决方案--------------------
String str ="<root><row id=\"123\"><RelySubType >SUN</RelySubType></row></root>";
这样试一下
软件开发程序错误异常ExceptionCopyright © 2009-2014MyException 版权所有