今天刚下的XML的书,说不定改天才知道!

解决方案 »

  1.   

    root = doc.getRootElement();
     items = root.getChildren(item);for(int i=0;i<items.size();i++)
    {
     Element item = (Element) items.get(i);
    item.getAttribute(id);}
    就可以了
      

  2.   

    取id的值就需要 idvalue = item.getAttribute(id).getValue();
    id 为你在xml文件里的那个标志 及<item id="1700">这个id 如果是别的标志,同时根改即可
      

  3.   

    采用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 是一个名值对!
    研究一下吧!