<collection xmlns:y="http://tail-f.com/ns/rest">
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>510HLW045330</serviceid>
<upMbps>20</upMbps>
<downMbps>65</downMbps>
<rd>64672:861660001</rd>
<rt>17622:667520001</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ZTE</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/510HLW045330/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/510HLW045330/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/510HLW045330/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/510HLW045330/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/510HLW045330/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/510HLW045330/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/510HLW045330/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>510HLW045367</serviceid>
<servstate>run</servstate>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:861660002</rd>
<rt>17622:667520002</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-CSR1KV</device>
</sr>
<y:operations>
<check-sync>/api/running/yunwangtong/510HLW045367/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/510HLW045367/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/510HLW045367/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/510HLW045367/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/510HLW045367/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/510HLW045367/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/510HLW045367/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>510HLW045368</serviceid>
<servstate>run</servstate>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:861660001</rd>
<rt>17622:667520001</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-CSR1KV</device>
</sr>
<y:operations>
<check-sync>/api/running/yunwangtong/510HLW045368/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/510HLW045368/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/510HLW045368/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/510HLW045368/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/510HLW045368/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/510HLW045368/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/510HLW045368/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>510HLW045369</serviceid>
<servstate>run</servstate>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:861660000</rd>
<rt>17622:667520000</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-CSR1KV</device>
</sr>
<y:operations>
<check-sync>/api/running/yunwangtong/510HLW045369/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/510HLW045369/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/510HLW045369/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/510HLW045369/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/510HLW045369/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/510HLW045369/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/510HLW045369/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>BRAS-ZTE-001</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:561660001</rd>
<rt>17622:567520001</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ZTE</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/BRAS-ZTE-001/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/BRAS-ZTE-001/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/BRAS-ZTE-001/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/BRAS-ZTE-001/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/BRAS-ZTE-001/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/BRAS-ZTE-001/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/BRAS-ZTE-001/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>BRAS-ZTE-004</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:561660004</rd>
<rt>17622:567520004</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ZTE</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/BRAS-ZTE-004/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/BRAS-ZTE-004/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/BRAS-ZTE-004/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/BRAS-ZTE-004/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/BRAS-ZTE-004/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/BRAS-ZTE-004/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/BRAS-ZTE-004/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-CISCO-BRAS-HW-001</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:888112301</rd>
<rt>17622:888112301</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-CSR1KV</device>
</sr>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-HW</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-CISCO-BRAS-HW-001/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-HW-0001</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>1234:1234</rd>
<rt>1762:667520101</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-HW</device>
</sr>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-HW-0001/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-HW-0001/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-HW-0001/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-HW-0001/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-HW-0001/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-HW-0001/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-HW-0001/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-HW-0002</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>1234:123400002</rd>
<rt>1762:667520102</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-HW</device>
</sr>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-HW-0002/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-HW-0002/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-HW-0002/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-HW-0002/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-HW-0002/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-HW-0002/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-HW-0002/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-HW-BRAS-ALU-001</serviceid>
<upMbps>15</upMbps>
<downMbps>45</downMbps>
<rd>64672:888122301</rd>
<rt>17622:888122301</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-HW</device>
</sr>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU-TEST</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-HW-BRAS-ALU-001/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-HW-BRAS-ZTE-001</serviceid>
<upMbps>25</upMbps>
<downMbps>50</downMbps>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-001/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SR-HW-BRAS-ZTE-002</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>64672:888122202</rd>
<rt>17622:888122202</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-HW</device>
</sr>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ZTE</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SR-HW-BRAS-ZTE-002/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>SRHWBRASZTE0033</serviceid>
<upMbps>12</upMbps>
<downMbps>24</downMbps>
<rd>64672:888122233</rd>
<rt>17622:888122233</rt>
<sr xmlns="http://example.com/yunwangtong">
<device>SR-HW</device>
</sr>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ZTE</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/SRHWBRASZTE0033/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>alutestvprn9121</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>17816:12340006</rd>
<rt>64672:12340006</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU-TEST</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/alutestvprn9121/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/alutestvprn9121/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/alutestvprn9121/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/alutestvprn9121/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/alutestvprn9121/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/alutestvprn9121/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/alutestvprn9121/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>alutestvprn9122</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>17816:12340022</rd>
<rt>64672:12340022</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU-TEST</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/alutestvprn9122/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/alutestvprn9122/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/alutestvprn9122/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/alutestvprn9122/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/alutestvprn9122/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/alutestvprn9122/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/alutestvprn9122/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>vprn9127test</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>17816:12340007</rd>
<rt>64672:12340007</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/vprn9127test/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/vprn9127test/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/vprn9127test/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/vprn9127test/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/vprn9127test/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/vprn9127test/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/vprn9127test/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>vprn9128test</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>17816:12340008</rd>
<rt>64672:12340008</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/vprn9128test/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/vprn9128test/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/vprn9128test/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/vprn9128test/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/vprn9128test/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/vprn9128test/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/vprn9128test/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
<yunwangtong xmlns="http://example.com/yunwangtong">
<serviceid>vprn9129test</serviceid>
<upMbps>10</upMbps>
<downMbps>20</downMbps>
<rd>17816:12340009</rd>
<rt>64672:12340009</rt>
<bras xmlns="http://example.com/yunwangtong">
<device>BRAS-ALU</device>
</bras>
<y:operations>
<check-sync>/api/running/yunwangtong/vprn9129test/_operations/check-sync</check-sync>
<deep-check-sync>/api/running/yunwangtong/vprn9129test/_operations/deep-check-sync</deep-check-sync>
<re-deploy>/api/running/yunwangtong/vprn9129test/_operations/re-deploy</re-deploy>
<reactive-re-deploy>/api/running/yunwangtong/vprn9129test/_operations/reactive-re-deploy</reactive-re-deploy>
<touch>/api/running/yunwangtong/vprn9129test/_operations/touch</touch>
<get-modifications>/api/running/yunwangtong/vprn9129test/_operations/get-modifications</get-modifications>
<un-deploy>/api/running/yunwangtong/vprn9129test/_operations/un-deploy</un-deploy>
</y:operations>
</yunwangtong>
</collection>
上文为接口开发中返回的字符串格式,下文为封装的bean对象
public class Operations {
private String check_sync;
private String deep_check_sync;
private String re_deploy;
private String reactive_re_deploy;
private String touch;
private String get_modifications;
private String un_deploy;
public String getCheck_sync() {
return check_sync;
}
public void setCheck_sync(String check_sync) {
this.check_sync = check_sync;
}
public String getDeep_check_sync() {
return deep_check_sync;
}
public void setDeep_check_sync(String deep_check_sync) {
this.deep_check_sync = deep_check_sync;
}
public String getRe_deploy() {
return re_deploy;
}
public void setRe_deploy(String re_deploy) {
this.re_deploy = re_deploy;
}
public String getReactive_re_deploy() {
return reactive_re_deploy;
}
public void setReactive_re_deploy(String reactive_re_deploy) {
this.reactive_re_deploy = reactive_re_deploy;
}
public String getTouch() {
return touch;
}
public void setTouch(String touch) {
this.touch = touch;
}
public String getGet_modifications() {
return get_modifications;
}
public void setGet_modifications(String get_modifications) {
this.get_modifications = get_modifications;
}
public String getUn_deploy() {
return un_deploy;
}
public void setUn_deploy(String un_deploy) {
this.un_deploy = un_deploy;
}
@Override
public String toString() {
return "Operations [check_sync=" + check_sync + ", deep_check_sync=" + deep_check_sync + ", re_deploy="
+ re_deploy + ", reactive_re_deploy=" + reactive_re_deploy + ", touch=" + touch + ", get_modifications="
+ get_modifications + ", un_deploy=" + un_deploy + "]";
}
}
public class Bras {
private String device;
public String getDevice() {
return device;
}
public void setDevice(String device) {
this.device = device;
}
@Override
public String toString() {
return "Bras [device=" + device + "]";
}
}
public class Sr {
private String device;
public Sr() {
}
public String getDevice() {
return device;
}
public void setDevice(String device) {
this.device = device;
}
@Override
public String toString() {
return "Sr [device=" + device + "]";
}
}
public class Yunwangtong {
private String serviceid;
private String upMbps;
private String downMbps;
private Sr sr;
private String rd;
private String rt;
private Bras bras;
private Operations operation;
private String servstate;
public Yunwangtong() {
}
public String getServiceid() {
return serviceid;
}
public void setServiceid(String serviceid) {
this.serviceid = serviceid;
}
public String getUpMbps() {
return upMbps;
}
public void setUpMbps(String upMbps) {
this.upMbps = upMbps;
}
public String getDownMbps() {
return downMbps;
}
public void setDownMbps(String downMbps) {
this.downMbps = downMbps;
}
public Sr getSr() {
return sr;
}
public void setSr(Sr sr) {
this.sr = sr;
}
public String getRd() {
return rd;
}
public void setRd(String rd) {
this.rd = rd;
}
public String getRt() {
return rt;
}
public void setRt(String rt) {
this.rt = rt;
}
public Bras getBras() {
return bras;
}
public void setBras(Bras bras) {
this.bras = bras;
}
public Operations getOperation() {
return operation;
}
public void setOperation(Operations operation) {
this.operation = operation;
}
public String getServstate() {
return servstate;
}
public void setServstate(String servstate) {
this.servstate = servstate;
}
@Override
public String toString() {
return "Yunwangtong [serviceid=" + serviceid + ", upMbps=" + upMbps + ", downMbps=" + downMbps + ", sr=" + sr
+ ", rd=" + rd + ", rt=" + rt + ", bras=" + bras + ", operation=" + operation + ", servstate="
+ servstate + "]";
}
}
先将xml字符串转换成document对象,然后获得根元素,获得子元素集合,遍历集合,获取值。
public static List<Yunwangtong> getReasultList(String xmlString) throws DocumentException{
// 获取document对象
Document doc = DocumentHelper.parseText(xmlString);
// 获取文件的根节点 collection
Element root = doc.getRootElement();
List<Yunwangtong> list = new ArrayList<>();
// 获取1级子节点元素集合 yunwangton
List<Element> children = root.elements();
for (Element child : children) {
// 遍历集合,只有一个元素,不做判断
Yunwangtong ywt = new Yunwangtong();
// 获取2级子节点 集合 serviceid、upMbps等
List<Element> children2 = child.elements();
// 遍历集合
for (Element child2 : children2) {
// 获取3级子节点元素集合,有些没有,"bras"、"operations"、"sr"
List<Element> children3= child2.elements();
if("bras".equals(child2.getName())){
Bras bras = new Bras();
for (Element child3 : children3) {
// 一个元素,不判断 device
bras.setDevice(child3.getText());
}
ywt.setBras(bras);
}else if("operations".equals(child2.getName())){
Operations operations = new Operations();
for (Element child3 : children3) {
if("check-sync".equals(child3.getName())){
operations.setCheck_sync(child3.getText());
}
if("deep-check-sync".equals(child3.getName())){
operations.setDeep_check_sync(child3.getText());
}
if("re-deploy".equals(child3.getName())){
operations.setRe_deploy(child3.getText());
}
if("reactive-re-deploy".equals(child3.getName())){
operations.setReactive_re_deploy(child3.getText());
}
if("touch".equals(child3.getName())){
operations.setTouch(child3.getText());
}
if("get-modifications".equals(child3.getName())){
operations.setGet_modifications(child3.getText());
}
if("un-deploy".equals(child3.getName())){
operations.setUn_deploy(child3.getText());
}
}
ywt.setOperation(operations);
}else if("sr".equals(child2.getName())){
Sr sr = new Sr();
for (Element child3 : children3) {
sr.setDevice(child3.getText());
}
ywt.setSr(sr);
}
else{
if("serviceid".equals(child2.getName())){
ywt.setServiceid(child2.getText());
}
if("upMbps".equals(child2.getName())){
ywt.setUpMbps(child2.getText());
}
if("downMbps".equals(child2.getName())){
ywt.setDownMbps(child2.getText());
}
if("rd".equals(child2.getName())){
ywt.setRd(child2.getText());
}
if("rt".equals(child2.getName())){
ywt.setRt(child2.getText());
}
if("servstate".equals(child2.getName())){
ywt.setServstate(child2.getText());
}
}
}
list.add(ywt);
}
return list;
};
}