Hi Deepak,
Thank you very much for your help and support:-)

Deepak Shetty wrote:
> 
> Hi
> Beanshell (almost) same as java
> 
> ThreadGroup
> +Request Returning XML
> ++XPATH extractor (ref name=itemIds,
> query=/OrderItems/Items/ItemDesc/OrderItemId)
> ++BeanShell Listener
> +Debug Sampler
> +View Results Tree
> 
> Paste the following into the Beanshell listener (Pseudoish code, assumes
> there is always 1 id, doesnt check errors etc)
> 
> int count = Integer.parseInt(vars.get("itemIds_matchNr")); //itemIds is
> the
> ref name in xpath extractor, if you change it, change this
> StringBuffer sb = new StringBuffer();
> for(int i=1;i<=count;i++){
>     sb.append(vars.get("itemIds_" + i)); //itemIds is the ref name in
> xpath
> extractor, if you change it, change this
>      if(i!=count){
>        sb.append(',');
>     }
> }
> vars.put("finalResult",sb.toString());
> 
> 
> The final result is available in ${finalResult} or
> vars.get("finalResult");
> 
> regards
> deepak
> 
> On Thu, Dec 10, 2009 at 10:49 AM, Pradeep_s83
> <[email protected]>wrote:
> 
>>
>> Can you please suggest how to concatenate the values using bean sheel
>> scripting?
>>
>> Deepak Shetty wrote:
>> >
>> > select /OrderItems/Items/ItemDesc/OrderItemId and then concatenate
>> using
>> > Beanshell is one option.
>> > The other option would have been to use XPATH 2.0 and the string-join
>> > function, but I dont think JMeter supports that (unless someone else
>> knows
>> > how to get Jmeter to recognise 2.0 functions)
>> >
>> > regards
>> > deepak
>> >
>> > On Thu, Dec 10, 2009 at 9:29 AM, Pradeep_s83
>> > <[email protected]>wrote:
>> >
>> >>
>> >> ?xml version="1.0"?>
>> >> <OrderItems>
>> >> <ItemId>12122</ItemId>
>> >> <Items>
>> >>  <ItemDesc>
>> >>  <Name>fdf</Name>
>> >>   <Desc>dsfdsfdsf</Desc>
>> >>   <OrderItemId>0123</OrderItemId>
>> >>  </ItemDesc>
>> >>  <ItemDesc>
>> >>  <Name>gbgfb</Name>
>> >>  <Desc>654654</Desc>
>> >>  <OrderItemId>123</OrderItemId>
>> >>  </ItemDesc>
>> >> </Items>
>> >> </OrderItems>
>> >>
>> >> This is my response for a httprequest.It can contain multiple
>> OrderItemId
>> >> tags.I need to get the data inside all the OrderItemId tags and append
>> >> each
>> >> value using a comma.
>> >> If order item ids A AND B are returned i need to form A,B.
>> >> How can i use Xpath for achieving the same?
>> >>
>> >> --
>> >> View this message in context:
>> >> http://old.nabble.com/Help-needed-with-xpath-tp26731317p26731317.html
>> >> Sent from the JMeter - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: [email protected]
>> >> For additional commands, e-mail: [email protected]
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Help-needed-with-xpath-tp26731317p26732525.html
>> Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Help-needed-with-xpath-tp26731317p26748847.html
Sent from the JMeter - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to