本帖最后由 yxwd315 于 2013-01-10 11:07:55 编辑

解决方案 »

  1.   

    警告一般不会影响程序的,你这里报了个类型转换的警告
    代码跑一下就知道能不能存到map了。
      

  2.   

    已经写了个demo,没用。取不到值:xmlMap.put("result",el.getAttributeValue("result"));
      

  3.   

    跟警告没关系,可能是其他地方有问题。
    比如说root.getChildren()  这里返回的是什么,debug看下。
      

  4.   

     Element root = doc.getRootElement();
               Element urla = root.getChild(a); 
       xmlMap.put(a.toUpperCase(),urla.getText());
       Element urlb = root.getChild(b); 
       xmlMap.put(a.toUpperCase(),urlb.getText());
       Element urlc = root.getChild(c); 
       xmlMap.put(a.toUpperCase(),urlc.getText());
       Element urld = root.getChild(d); 
       xmlMap.put(a.toUpperCase(),urld.getText());
       Element urle = root.getChild(e); 
       xmlMap.put(a.toUpperCase(),urle.getText());
       Element urlf = root.getChild(f); 
       xmlMap.put(a.toUpperCase(),urlf.getText());
    我这样写就获取到了,其中a,b,c,d,e,f是我要取得元素名称(这个方法传过来的参数),但是代码太罗嗦了,有没有好点的方法?