You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by mahima <ma...@hotmail.com> on 2007/01/31 14:42:04 UTC
XPath Query
Hi All,
I want to use an XPath Query to parse an XML File.
The XML File which I am parsing with XPath Query is:
<Packages>
<Package>
<ItineraryItems>
<RoomRates>
<RoomRate>
<TPA_Extensions>
<Floor Amount = 100.00>
<Ceiling Amount = 110.00>
<PrePromoFloor Amount =
105.00>
<Pre PromoCeiling Amount =
115.00>
</TPA_Extensions>
</Roomrate>
</RoomRates>
</ItineraryItems>
</Package>
<Package>
<ItineraryItems>
<RoomRates>
<RoomRate>
<TPA_Extensions>
<Floor Amount = 110.00>
<Ceiling Amount = 120.00>
<PrePromoFloor Amount =
0.00>
<Pre PromoCeiling Amount =
0.00>
</TPA_Extensions>
</Roomrate>
</RoomRates>
</ItineraryItems>
</Package>
<Package>
<ItineraryItems>
<RoomRates>
<RoomRate>
<TPA_Extensions>
<Floor Amount = 120.00>
<Ceiling Amount = 130.00>
<PrePromoFloor Amount =
0.00>
<Pre PromoCeiling Amount =
0.00>
</TPA_Extensions>
</Roomrate>
</RoomRates>
</ItineraryItems>
</Package>
<Package>
<ItineraryItems>
<RoomRates>
<RoomRate>
<TPA_Extensions>
<Floor Amount = 130.00>
<Ceiling Amount = 140.00>
<PrePromoFloor Amount =
135.00>
<Pre PromoCeiling Amount =
145.00>
</TPA_Extensions>
</Roomrate>
</RoomRates>
</ItineraryItems>
</Package>
</Packages>
The XPath Query which I am using is:
//Packages/Package/ItineraryItems/RoomRates/RoomRate/TPA_Extensions[descendant::
PrePromoFloor/@Amount>0]
This XPath Query will return the following:
<TPA_Extensions>
<Floor Amount = 100.00>
<Ceiling Amount = 110.00>
<PrePromoFloor Amount =
105.00>
<Pre PromoCeiling Amount =
115.00>
</TPA_Extensions>
<TPA_Extensions>
<Floor Amount = 130.00>
<Ceiling Amount = 140.00>
<PrePromoFloor Amount =
135.00>
<Pre PromoCeiling Amount =
145.00>
</TPA_Extensions>
My objective is:
(a) To Parse an XML File and retrieve all the <TPA_Extensions> Nodes where
the Amount attribute of the <PrePromoFloor> Element is greater than zero.
(b) Once I have all the <TPA_Extensions> nodes which meet the conditions
defined in (a) above, then I want to perform some computation on Amount
attribute of all the elements in <TPA_Extensions> Node.
Now my questions are like this:
(1) Can I use a variable (in Reference Field) in XPath Extractor to retrieve
the XPath Query Response? If yes, how can I use it in Beanshell Post
Processor?
(2) If I can't use a variable to retrieve the above mentioned XPath Query
Response, then how do I use the XPath Query?
--
View this message in context: http://www.nabble.com/XPath-Query-tf3148800.html#a8729164
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org