Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in RPA by (12.7k points)

I am attempting to select a node based on a value in an element in an XML file that contains a namespace.

I am using Automation Anywhere's Get XML Node command that limits me to using a single line XPath statement.

This is the sample XML file

<IMPORT xmlns="urn:Import">

    <STUFF>

        <STUFF_TYPE>

            <STUFF_TYPE_KEY>1</STUFF_TYPE_KEY>

        </STUFF_TYPE>

        <WALMART>

            <STORE>

                <STORE_ID TYPE="SC" ID="SC-12345">WM000001</STORE_ID>

                <STORE_STATUS>O</STORE_STATUS>

            </STORE>

        </WALMART> 

    </STUFF>

</IMPORT>

I would like to select the STORE_STATUS value where STORE_ID = WM000001

Right now, it is not finding the node.

1 Answer

0 votes
by (29.5k points)

Hi, you can try using the following code below it should work

//*[local-name() = 'STORE']/*[local-name() = 'STORE_ID' and text() = 'WM000001']/following-sibling::*[local-name() = 'STORE_STATUS']

Browse Categories

...