locked
xpath of a field (loop) RRS feed

  • Question

  • Hi I have the following xml, I want to loop through each of the item record and get the value of Description from it.

    intCount = intMakeCnt + 1;

    strXPath = System.String.Format("string(//*[local-name()='item'][{0}]/*[local-name()='Description']/text())", intCount );

    But it is giving strXPath as empty . Please advice

    <root type="object">
    	<ValuationProvider type="string">Geico</ValuationProvider>
    	<Data type="array">
    		<item type="object">
    			<Id type="string">Acura</Id>
    			<Description type="string">Acura</Description>
    			<AdditionalId type="string"/>
    		</item>
    		<item type="object">
    			<Id type="string">Audi</Id>
    			<Description type="string">Audi</Description>
    			<AdditionalId type="string"/>
    		</item>
    		<item type="object">
    			<Id type="string">BMW</Id>
    			<Description type="string">BMW</Description>
    			<AdditionalId type="string"/>
    		</item>
    		
    	</Data>
    	<ContinueActionAfterException type="boolean">false</ContinueActionAfterException>
    	
    </root>


    RH

    Thursday, October 29, 2020 11:31 PM

All replies