XML如何解析啊。万分感激! 今天刚下的XML的书,说不定改天才知道! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 root = doc.getRootElement(); items = root.getChildren(item);for(int i=0;i<items.size();i++){ Element item = (Element) items.get(i);item.getAttribute(id);}就可以了 取id的值就需要 idvalue = item.getAttribute(id).getValue();id 为你在xml文件里的那个标志 及<item id="1700">这个id 如果是别的标志,同时根改即可 采用sax解析,去研究一下DefaultHandler和Attributes public Element(String namespace,String localname,Attributes atts) { this.namespace = namespace; this.localname = localname; int i; for(i=0;i<atts.getLength();i++) { XMLAttribute att = new XMLAttribute(atts.getLocalName(i),atts.getValue(i)); attributes.add(att); } status = 1; }XMLAttribute 是一个名值对!研究一下吧! 帮我分析一下这个正则表达式 JfreeChart 时间格式问题 自己实现jQuery.getJSON()方法 各位前辈们,原谅我的无知~~~关于源码下载怎么使用~~~ 哪里有J2EE SDK! websphere 中部署 web service 问题 struts显示列表出错!大家帮帮手 有个问题,奇怪,关于下载j2ee sdk 这么常见的问题为什么没人回答?(EJB--分布式数据库) 我的tomcat不能访问了,我看了一下日志文件,大家能不能帮我分析一下原因? 你表现的机会来了 j2ee 与 J2ME 有何区别???????????????
items = root.getChildren(item);for(int i=0;i<items.size();i++)
{
Element item = (Element) items.get(i);
item.getAttribute(id);}
就可以了
id 为你在xml文件里的那个标志 及<item id="1700">这个id 如果是别的标志,同时根改即可
public Element(String namespace,String localname,Attributes atts)
{
this.namespace = namespace;
this.localname = localname;
int i;
for(i=0;i<atts.getLength();i++)
{
XMLAttribute att = new XMLAttribute(atts.getLocalName(i),atts.getValue(i));
attributes.add(att);
}
status = 1;
}
XMLAttribute 是一个名值对!
研究一下吧!