Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.
XPath and price filter
LegacyForum
Posts: 1,664 ✭✭
Hi all,
There is any way to insert an price filter (like "/bookstore/book[price>35]/price") in the XPAth above?
/*[local-name(.)="Envelope" and namespace-uri(.)="http://.../"]
/*[local-name(.)="Body" and namespace-uri(.)="http://.../"]
/*[local-name(.)="response" and namespace-uri(.)="http://..."]
/*[local-name(.)="price" and namespace-uri(.)="http://..."]
/*[local-name(.)="totalAmount" and namespace-uri(.)="..."]
There is any way to insert an price filter (like "/bookstore/book[price>35]/price") in the XPAth above?
/*[local-name(.)="Envelope" and namespace-uri(.)="http://.../"]
/*[local-name(.)="Body" and namespace-uri(.)="http://.../"]
/*[local-name(.)="response" and namespace-uri(.)="http://..."]
/*[local-name(.)="price" and namespace-uri(.)="http://..."]
/*[local-name(.)="totalAmount" and namespace-uri(.)="..."]
0
Comments
-
I've created a sample .tst file for you that has a very simple XML for books and prices. The XPath I used is in the XML Transformer, and I've copied it below:CODE/*[local-name(.)="Envelope" and namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"]
/*[local-name(.)="Body" and namespace-uri(.)="http://schemas.xmlsoap.org/soap/envelope/"]
/*[local-name(.)="root" and namespace-uri(.)=""]
/*[local-name(.)="book" and namespace-uri(.)=""][price<13]
/*[local-name(.)="price" and namespace-uri(.)=""]/text()
Hope this helps.0 -
Thanks Joseph.
Yes, it works. The final query:
/*[local-name(.)="Envelope" ]
/*[local-name(.)="Body" ]
/*[local-name(.)="response" ]
/*[local-name(.)="lineItemList" ]
/*[local-name(.)="lineItem" ]
/*[local-name(.)="price" ]
/*[local-name(.)="totalAmount" ][.>0]0