Esempio n. 1
0
 /**
  * 获取重复数据
  *
  * @param xmlBaseReader 读写xml类
  * @param xpath 层次结构路径名称
  * @return
  */
 private static List getXmlLevelItemList(XMLBaseReader xmlBaseReader, String xmlLevelItemXPath) {
   List onlyattrlist = new ArrayList();
   int count = xmlBaseReader.xmlDomElementCount(xmlLevelItemXPath);
   for (int i = 0; i < count; i++) {
     Iterator it = xmlBaseReader.xmlDomElementLeafIterator(xmlLevelItemXPath, i);
     List elementList = new ArrayList();
     if (null != it) {
       while (it.hasNext()) {
         Entry entry = (Entry) it.next();
         XMLNode xn = entry.xmlNode;
         Map map = new HashMap();
         map.put(xn.getName(), xn.getValue());
         System.out.println(xn.getName() + " : " + xn.getValue().trim());
         elementList.add(map);
       }
     }
     onlyattrlist.add(elementList);
   }
   return onlyattrlist;
 }