AnsweredAssumed Answered

Parsing SOAP Response XML

Question asked by VarunPahuja on Jan 9, 2013
Latest reply on Jan 9, 2013 by mikael.hamstrom
Hi All,

I need help to parse XML.
I have an XML like

getFormRateItemValuesResponse xmlns="urn:usmRequestService" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:usmRequestService" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<getFormRateItemValuesReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:FormItem">
<fileName xsi:type="xsd:string">12872</fileName>
<form xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" soapenc:arrayType="ns1:FormElement[87]" xsi:type="soapenc:Array">
<form xsi:type="ns1:FormElement">
<ID xsi:type="xsd:string">txtProjectCode</ID>
<label xsi:type="xsd:string">Project Code</label>
<labelValue xsi:nil="true" xsi:type="xsd:string"/>
<type xsi:type="xsd:int">5</type>
<value xsi:type="xsd:string">s</value>
</form>
<form xsi:type="ns1:FormElement">
<ID xsi:type="xsd:string">txtPrjDescription</ID>
<label xsi:type="xsd:string">Project Description</label>
<labelValue xsi:nil="true" xsi:type="xsd:string"/>
<type xsi:type="xsd:int">8</type>
<value xsi:type="xsd:string">sd</value>
</form>
<form xsi:type="ns1:FormElement">
<ID xsi:type="xsd:string">txtTPOC</ID>
<label xsi:type="xsd:string">SE/TPOC</label>
<labelValue xsi:nil="true" xsi:type="xsd:string"/>
<type xsi:type="xsd:int">5</type>
<value xsi:type="xsd:string">s</value>
</form>
<form xsi:type="ns1:FormElement">
<ID xsi:type="xsd:string">txtPdM</ID>
<label xsi:type="xsd:string">PM/PdM</label>
<labelValue xsi:nil="true" xsi:type="xsd:string"/>
<type xsi:type="xsd:int">5</type>
<value xsi:type="xsd:string">dsd</value>
</form>



I need to get the value of label PM/PdM directly.
Till now I am storing label as well value in an string array and then parsing that array in a loop to get the value. Is there anything when I can get the value directly rather then going for the loop and string array??

Regards,
Varun

Outcomes