public Map readStringXmlOut(String xml) {
ApplicationContext context =new FileSystemXmlApplicationContext("/WebRoot/WEB-INF/applicationContext.xml");
iURLinsertDAO= (IURLinsertDAOImpl) context.getBean("iURLinsertDAO");
URLinsert Uit = new URLinsert();
Map map = new HashMap();
Document doc = null;
try {
doc = DocumentHelper.parseText(xml);
Element root = doc.getRootElement();
int key=0;
for ( Iterator i = root.elementIterator(); i.hasNext(); ) {
Element element = (Element) i.next();
Map customer = new HashMap();
for ( Iterator j = element.elementIterator(); j.hasNext(); ) {
Element elementson = (Element) j.next();
customer.put(elementson.getName(), elementson.getText());
}
map.put(key,customer);
key++;
}
System.out.println("共"+map.size()+"条记录");
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
ApplicationContext context =new FileSystemXmlApplicationContext("/WebRoot/WEB-INF/applicationContext.xml");
iURLinsertDAO= (IURLinsertDAOImpl) context.getBean("iURLinsertDAO");
URLinsert Uit = new URLinsert();
Map map = new HashMap();
Document doc = null;
try {
doc = DocumentHelper.parseText(xml);
Element root = doc.getRootElement();
int key=0;
for ( Iterator i = root.elementIterator(); i.hasNext(); ) {
Element element = (Element) i.next();
Map customer = new HashMap();
for ( Iterator j = element.elementIterator(); j.hasNext(); ) {
Element elementson = (Element) j.next();
customer.put(elementson.getName(), elementson.getText());
}
map.put(key,customer);
key++;
}
System.out.println("共"+map.size()+"条记录");
} catch (Exception e) {
e.printStackTrace();
}
return map;
}