首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

xml报错请帮忙,多谢大家!

2012-03-28 
xml报错请帮忙,在线等,谢谢大家!!!Java codeString str rootrow id123RelySubType SUN/RelySubT

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".



[解决办法]
Java code
String str ="<root><row id=\"123\"><RelySubType >SUN</RelySubType></row></root>";
[解决办法]
String str ="<root><row id=\"123\"><RelySubType >SUN</RelySubType></row></root>";
xml中要求必须带有引号的

热点排行