Extact values from XML tags

Hi Team,

<cd_rsn_pol seq="1" desc="Failed Cutoff - Cat 4">R324</cd_rsn_pol>

<cd_rsn_pol seq="2" desc="Refer - Cat 4">R124</cd_rsn_pol>

<cd_rsn_pol seq="3" desc="Fails Servicing">R540</cd_rsn_pol>

From the above xml tag i need to extract the “desc” attribute and the body content and map it into string list. The main tag dec_pol might will contain a max of 8 cd_rsn_pol tags. Pleas help me in the above.i queried the above xml using queryXML service and converted it into a doc of which will coontain cd_rsn_pol documents in below format:

@seq : 1
@desc: Failed CutOff-Cat 4
*body: R324
Kindly help me in extractin the desc and body values and map it into a string list.Its very urgent pls.

Ragav J

Hi Ragav,

You can just convert the xml string to IS document using the built in XML services. Refer the Build-in service reference guide. The resulting document will have the exact structure of the XML with cd_rsn_pol as document list. You can then just map the @desc and *body to your list.


Hi Suren,

I did tried that way to convert it to docuement of below structure.

cd_rsn_pol(docuement List)
cd_rsn_pol 1 (docuemnt)
@seq :
@desc :
Since the cd_rsn_pol might contain more than one element i created a document list of above structure and i am able to get the data in IS document format. But when i map the @desc and body to 2 seperate string list it s showing null values :mad:… Not sure why this is coming like this.
Should i use a loop while mapping as it is document list…Kindly advise.

Thanks for you previous reply…:slight_smile:

Ragav J


I would suggest first to use a loop over the document list that you created. Step in to the service and see whether it enters the loop or not. I suspect it wont enter the loop as there might be somethign wrong when you mapped the output of the nodetoDocument service to your document.

If it enters then compare the path (e.g: dec_pol/cd_rsn_pol[0]/@desc) of the @desc variable from the pipeline of the map step to the actual runtime pipeline at that point in time. My second bet, they wont match.

There is already a post for a similar issue here in this forum.


Thanks for you reply Suren…

It does enter into the loop for mapping:)

But your second bet is correct :slight_smile: it shows a document different than the one i created. Any idea of why it is like this…?

Can you please also let me know the thread name which contains the same problem…

Once again thanks Suren for your quick responses.

Ragav J

Hi Suren,

I got that thing fixed.

I jus removed the loop and converted the docuement to an XML node and queried it.
The results were mapped direclty to a string list and i am gettin the expected output.

Thanks for your advice and help.

Ragav J

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.