zoukankan      html  css  js  c++  java
  • 解析xml的单个节点值和循环节点消息体

         //获取单个节点文本内容
                String total = doc.selectSingleNode("/message/body/params/total").getText();

    //获取xml循环消息体
                List<Node> beannodes = doc.selectNodes("/message/body/paramlist/bean");
               
                Eperson[] epersonList = new Eperson[beannodes.size()];
               
                for (int i = 0; i < beannodes.size(); i++)
                {
                    Eperson eperson = new Eperson();
                    //有node节点再获取单个节点文本内容
                    String staffid = beannodes.get(i).selectSingleNode("./staffno").getText();
                    String name = beannodes.get(i).selectSingleNode("./name").getText();
                    String staffaccount = beannodes.get(i).selectSingleNode("./staffaccount").getText();
                    String staffno = beannodes.get(i).selectSingleNode("./staffno").getText();
                    String sex = beannodes.get(i).selectSingleNode("./sex").getText();
                    String mobile = beannodes.get(i).selectSingleNode("./mobile").getText();
                    String homephone = beannodes.get(i).selectSingleNode("./homephone").getText();
                    String fax = beannodes.get(i).selectSingleNode("./fax").getText();
                    String email = beannodes.get(i).selectSingleNode("./email").getText();
                    String bindno = beannodes.get(i).selectSingleNode("./bindno").getText();
                    String shortphone = beannodes.get(i).selectSingleNode("./shortphone").getText();
                    String officephone = beannodes.get(i).selectSingleNode("./officephone").getText();
                   
                    String credit = beannodes.get(i).selectSingleNode("./credit").getText();
                    ;
                    String underWrite = beannodes.get(i).selectSingleNode("./underwrite").getText();
                    ;
                    String voip = beannodes.get(i).selectSingleNode("./voip").getText();
                    ;
                    String addr = beannodes.get(i).selectSingleNode("./addr").getText();
                    ;
                    String otherPhone = beannodes.get(i).selectSingleNode("./otherphone").getText();
                    ;
                    String zip = beannodes.get(i).selectSingleNode("./zip").getText();
                    ;
                    String seat = beannodes.get(i).selectSingleNode("./seat").getText();
                    ;
                   
                    eperson.setStaffid(staffid);
                    eperson.setName(name);
                    eperson.setStaffaccount(staffaccount);
                    eperson.setStaffno(staffno);
                    eperson.setSex(sex);
                    eperson.setMobile(mobile);
                    eperson.setHomephone(homephone);
                    eperson.setFax(fax);
                    eperson.setEmail(staffaccount + Configuration.getInstance().getEmailTail());
                    eperson.setBindno(bindno);
                    eperson.setShortphone(shortphone);
                    eperson.setOfficephone(officephone);
                   
                    eperson.setCredit(credit);
                    eperson.setUnderWrite(underWrite);
                    eperson.setVoip(voip);
                    eperson.setAddr(addr);
                    eperson.setOtherPhone(otherPhone);
                    eperson.setZip(zip);
                    eperson.setSeat(seat);
                    epersonList[i] = eperson;
                    epersonBean.setEpersonList(epersonList);
                }

  • 相关阅读:
    【CF741D】Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths(dsu on tree)
    【CF600E】Lomsat gelral(dsu on tree)
    【Vijos】lxhgww的奇思妙想(长链剖分)
    【HDOJ6586】String(枚举)
    【HDOJ6578】Blank(DP)
    【HDOJ6583】Typewriter(SAM,DP)
    JAVA 集合 List 分组的两种方法
    HashMap的实现原理
    HashMap, HashTable, CurrentHashMap的区别
    java ThreadLocal(应用场景及使用方式及原理)
  • 原文地址:https://www.cnblogs.com/qqzy168/p/2665108.html
Copyright © 2011-2022 走看看