Skip to Content
1
May 27, 2013 at 01:45 PM

Retrieve multiple rows from a rowset matching a criteria using XPath in SAP MII 12.2.5

683 Views

Dear Experts,

Need a way to query a local XML type property and get all rows of a rowset that match a criteria. We need to do this without using a loop on a result set because using loops currently is making the transaction hang and the gives a transaction timeout error after some time. Example of what we intend to do: Bookstore_XML is a local property of XML type containing:

<?xml version='1.0'?>

<bookstore>

<book> <title>abc</title> <author>Enid</author> <price>10</price> </book>

<book> <title>def</title> <author>Enid</author> <price>20</price> </book>

<book> <title>ghi</title> <author>Jone</author> <price>30</price> </book>

<book> <title>jkl</title> <author>Jone</author> <price>40</price> </book>

</bookstore>

I need to select all books from the bookstore where author = 'Enid'. Output like below:

<?xml version='1.0'?> <bookstore>

<book> <title>abc</title> <author>Enid</author> <price>10</price> </book>

<book> <title>def</title> <author>Enid</author> <price>20</price> </book>

</bookstore>

I try doing like:

Local.Bookstore_XML{//bookstore/book[author='Enid']}

... and assign XML to an XML type property. But I get a blank result.

Any pointers would be highly appreciated.

Regards,

Saumya Govil