<?xml version="1.0" encoding="GB2312"?>
<crea>
<user ip="192.168.0.220" key="987654321" name="invengo"></user>
<trans id="QUTMGetSCJobIssued">
<field name="enddate" type="String" value=""></field>
<field name="ifjobdevicetype" type="String" value="02"></field>
<field name="entercardno" type="String" value=""></field>
<field name="begindate" type="String" value=""></field>
<field name="status" type="String" value="4"></field>
<field name="ALInfoError" type="ALInfoError">
<ErrR>
<Code value=""></Code>
<Description value=""></Description>
</ErrR>
</field>
<field name="IRowsCount" type="int" value="0"></field>
<field name="ior" type="IOR">
<Sucess value="1"></Sucess>
<ResultCount value="1"></ResultCount>
<ALInfoError></ALInfoError>
<Rslist>
<SubRs>
<Row baseqty="280" baseunitname="升"
baseunituuid="932C4288E4354A75AE647BD71F671B42" bizdate="20140919"
containernumber="" desisrfid="1" desloadpointname=""
desloadpointuuid="" destsectuuid="03579EB02644482B9E9521F4AD28010F"
deststructcode="1004" deststructname="1楼04号位"
deststructuuid="643555CD2D3F434F9E15FF75DAF7C1E3" entercardno=""
finishquantity="90" finishsalverqty="1" ifjobdevicetype="02"
ifjobdevicetypename="入库" isopenvideo=""
materasstattrcode="A0000000000000000000000000000000" materialname="花旗牌调和油8L"
materialuuid="B35E5BEE992A4A6B9DDC09C283365ECE" operatejobuuid="0866F2B8A20241E596F597E3A8939948"
orguuid="52F9EBCAD07247DDA34830023A166B4C" pcsn="20140919"
percentage="257" plansalverqty="1" prsealnum="" quantity="35"
salverqty="90" srcinvcode="PUI2014100136" srcisrfid=""
srcloadpointname="" srcloadpointuuid="" srcsectuuid=""
srcstructcode="" srcstructname="" srcstructuuid="" status="4"
storename="SG-823南仓" storuuid="3E543D11AF214885B103E2EB6C0B0509"
suppliername="" unitname="罐(8.0L)" unituuid="1025A50A31094D45B2B9754EBBC0F7C2"
vehiclecode=""></Row>
<Row baseqty="1600" baseunitname="升"
baseunituuid="932C4288E4354A75AE647BD71F671B42" bizdate="20140919"
containernumber="" desisrfid="1" desloadpointname=""
desloadpointuuid="" destsectuuid="03579EB02644482B9E9521F4AD28010F"
deststructcode="1002" deststructname="1楼02号位"
deststructuuid="B5A042A47ED94D3C8CC6C3A91927D1C4" entercardno=""
finishquantity="0" finishsalverqty="0" ifjobdevicetype="02"
ifjobdevicetypename="入库" isopenvideo=""
materasstattrcode="A0000000000000000000000000000000" materialname="花旗牌调和油8L"
materialuuid="B35E5BEE992A4A6B9DDC09C283365ECE" operatejobuuid="1E31010F393E4A108FC9278AE13C762A"
orguuid="52F9EBCAD07247DDA34830023A166B4C" pcsn="20140919"
percentage="0" plansalverqty="3" prsealnum="" quantity="200"
salverqty="90" srcinvcode="PUI2014100133" srcisrfid=""
srcloadpointname="" srcloadpointuuid="" srcsectuuid=""
srcstructcode="" srcstructname="" srcstructuuid="" status="4"
storename="SG-823南仓" storuuid="3E543D11AF214885B103E2EB6C0B0509"
suppliername="" unitname="罐(8.0L)" unituuid="1025A50A31094D45B2B9754EBBC0F7C2"
vehiclecode=""></Row>
</SubRs>
</Rslist>
</field>
</trans>
</crea>
1 个解决方案
#1
参考:
dom4j解析xml字符串实例
使用 attributes
使用 attributes
Element connections = document.getRootElement();
Iterator<Element> rootIter = connections.elementIterator();
while (rootIter.hasNext()) {
Element connection = rootIter.next();
Iterator<Element> childIter = connection.elementIterator();
Map<String, String> connectionInfo = new HashMap<String, String>();
List<Attribute> attributes = connection.attributes();
for (int i = 0; i < attributes.size(); ++i) { // 添加节点属性
connectionInfo.put(attributes.get(i).getName(), attributes.get(i).getValue());
}
while (childIter.hasNext()) { // 添加子节点
Element attr = childIter.next();
connectionInfo.put(attr.getName().trim(), attr.getText().trim());
}
dbConnections.add(connectionInfo);
}
#1
参考:
dom4j解析xml字符串实例
使用 attributes
使用 attributes
Element connections = document.getRootElement();
Iterator<Element> rootIter = connections.elementIterator();
while (rootIter.hasNext()) {
Element connection = rootIter.next();
Iterator<Element> childIter = connection.elementIterator();
Map<String, String> connectionInfo = new HashMap<String, String>();
List<Attribute> attributes = connection.attributes();
for (int i = 0; i < attributes.size(); ++i) { // 添加节点属性
connectionInfo.put(attributes.get(i).getName(), attributes.get(i).getValue());
}
while (childIter.hasNext()) { // 添加子节点
Element attr = childIter.next();
connectionInfo.put(attr.getName().trim(), attr.getText().trim());
}
dbConnections.add(connectionInfo);
}