public void getXmlDate(){
String content = "<content>"
+ "<field name='wbrybh'>W440111540000200903000019</field>"
+"<field name='csyy'>aaa</field>"
+ "<field name='cssj'>2010-06-23 11:00:00</field>"
+ "<field name='csqx'>bbb</field>"
+ "</content>";
String wbrybh = null;
String csyy = null;
String csqx = null ;
String cssj = null;
Document document = null;
try{
document = DocumentHelper.parseText(content);
} catch (DocumentException e)
{
e.printStackTrace();
return null;
}
Element root = document.getRootElement();
Iterator it = root.elements().iterator();
while (it.hasNext()) {
Element field = (Element) it.next();
Attribute attribute = field.attribute("name");
String attrValue = attribute.getText();
if (attrValue.equals("wbrybh")) {
wbrybh = field.getText();
} else if (attrValue.equals("csyy")) {
csyy = field.getText();
} else if (attrValue.equals("csqx")) {
csqx = field.getText();
} else if (attrValue.equals("cssj")) {
cssj = field.getText();
} }
System.out.println(wbrybh );
System.out.println(csyy );
System.out.println(csqx);
System.out.println(cssj);