You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by madhu sekhar <ma...@gmail.com> on 2013/03/26 13:04:17 UTC

BeanShell_Script.

Hi Team,

We have API Request as below:

 <list>
      <val name="DatabaseID">ABC</val>
      <val name="QueryLanguage">en</val>
      <val name="UID">ABC:00013564789</val>
      <list name="Editions">
        <map>
          <val name="Collection">ABC</val>
          <val name="Edition">CBI</val>
          <val name="Begin">1991-01-01</val>
          <val name="End">2009-12-31</val>
        </map>
      </list>


Could any one please suggest, What should be the bean shell script to
capture the dynamic Value.

*< val name="UID">ABC:00013564789</val>?*

Thanks & Regards,
Madhu

Re: BeanShell_Script.

Posted by Madhu Sekhar <ma...@gmail.com>.
Team, Any Responses Please..?

Regards,
Madhu

On Tue, Mar 26, 2013 at 6:50 PM, madhu sekhar <ma...@gmail.com>wrote:

> Hi Xenofon Papadopoulos<https://plus.google.com/u/0/103801370580587502122?prsrc=4>
> ,
>
> Could you give complete solution for the same request?
>
> What should be replace at <val name="UID">ABC:00013564789</val> by XPath
> Extractor( /list/val[@name="UID"]/text() or //val[@name="UID"]/text())
>
>
> Thanks & Regards,
> Madhu
>
>
>
> On Tue, Mar 26, 2013 at 6:28 PM, Xenofon Papadopoulos <xp...@gmail.com>wrote:
>
>> If there is a single val element below list with name="UID", you can use
>> the following XPath expression to get its value:
>>
>> /list/val[@name="UID"]/text()
>>
>> If this is only a chunk of your XML and there are other wrapper elements,
>> you might have to use something like:
>>
>> //val[@name="UID"]/text()
>>
>> (again, assuming the val with name="UID" is unique)
>>
>>
>>
>>
>> On Tue, Mar 26, 2013 at 2:37 PM, madhu sekhar <madhuvchandana@gmail.com
>> >wrote:
>>
>> > Darren,
>> >
>> > In My request what could be the *XPath Query*?
>> >
>> > Thanks & Regards,
>> > Madhu
>> >
>> > On Tue, Mar 26, 2013 at 5:45 PM, Darren Bown <da...@gmail.com>
>> wrote:
>> >
>> > > Madhu,
>> > >
>> > > Parsing [X|H]TML with scripts is very tricky, especially when trying
>> to
>> > use
>> > > a regex to do it - which you undoubtedly would end up attempting.
>> You're
>> > > much better off using an XPath extractor:
>> > >
>> > >
>> > >
>> >
>> http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor
>> > >
>> > > Cheers,
>> > > Darren.
>> > >
>> > >
>> > > On 26 March 2013 12:04, madhu sekhar <ma...@gmail.com>
>> wrote:
>> > >
>> > > > Hi Team,
>> > > >
>> > > > We have API Request as below:
>> > > >
>> > > >  <list>
>> > > >       <val name="DatabaseID">ABC</val>
>> > > >       <val name="QueryLanguage">en</val>
>> > > >       <val name="UID">ABC:00013564789</val>
>> > > >       <list name="Editions">
>> > > >         <map>
>> > > >           <val name="Collection">ABC</val>
>> > > >           <val name="Edition">CBI</val>
>> > > >           <val name="Begin">1991-01-01</val>
>> > > >           <val name="End">2009-12-31</val>
>> > > >         </map>
>> > > >       </list>
>> > > >
>> > > >
>> > > > Could any one please suggest, What should be the bean shell script
>> to
>> > > > capture the dynamic Value.
>> > > >
>> > > > *< val name="UID">ABC:00013564789</val>?*
>> > > >
>> > > > Thanks & Regards,
>> > > > Madhu
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Darren Bown
>> > > tel:* +44(0)*7873 163 452
>> > > tel: *+44(0)7971 078 445*
>> > >
>> >
>> >
>> >
>> > --
>> > madhu kk
>> >
>>
>
>
>
> --
> madhu kk
>



-- 
madhu kk

Re: BeanShell_Script.

Posted by madhu sekhar <ma...@gmail.com>.
Hi Xenofon Papadopoulos<https://plus.google.com/u/0/103801370580587502122?prsrc=4>
,

Could you give complete solution for the same request?

What should be replace at <val name="UID">ABC:00013564789</val> by XPath
Extractor( /list/val[@name="UID"]/text() or //val[@name="UID"]/text())


Thanks & Regards,
Madhu


On Tue, Mar 26, 2013 at 6:28 PM, Xenofon Papadopoulos <xp...@gmail.com>wrote:

> If there is a single val element below list with name="UID", you can use
> the following XPath expression to get its value:
>
> /list/val[@name="UID"]/text()
>
> If this is only a chunk of your XML and there are other wrapper elements,
> you might have to use something like:
>
> //val[@name="UID"]/text()
>
> (again, assuming the val with name="UID" is unique)
>
>
>
>
> On Tue, Mar 26, 2013 at 2:37 PM, madhu sekhar <madhuvchandana@gmail.com
> >wrote:
>
> > Darren,
> >
> > In My request what could be the *XPath Query*?
> >
> > Thanks & Regards,
> > Madhu
> >
> > On Tue, Mar 26, 2013 at 5:45 PM, Darren Bown <da...@gmail.com>
> wrote:
> >
> > > Madhu,
> > >
> > > Parsing [X|H]TML with scripts is very tricky, especially when trying to
> > use
> > > a regex to do it - which you undoubtedly would end up attempting.
> You're
> > > much better off using an XPath extractor:
> > >
> > >
> > >
> >
> http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor
> > >
> > > Cheers,
> > > Darren.
> > >
> > >
> > > On 26 March 2013 12:04, madhu sekhar <ma...@gmail.com> wrote:
> > >
> > > > Hi Team,
> > > >
> > > > We have API Request as below:
> > > >
> > > >  <list>
> > > >       <val name="DatabaseID">ABC</val>
> > > >       <val name="QueryLanguage">en</val>
> > > >       <val name="UID">ABC:00013564789</val>
> > > >       <list name="Editions">
> > > >         <map>
> > > >           <val name="Collection">ABC</val>
> > > >           <val name="Edition">CBI</val>
> > > >           <val name="Begin">1991-01-01</val>
> > > >           <val name="End">2009-12-31</val>
> > > >         </map>
> > > >       </list>
> > > >
> > > >
> > > > Could any one please suggest, What should be the bean shell script to
> > > > capture the dynamic Value.
> > > >
> > > > *< val name="UID">ABC:00013564789</val>?*
> > > >
> > > > Thanks & Regards,
> > > > Madhu
> > > >
> > >
> > >
> > >
> > > --
> > > Darren Bown
> > > tel:* +44(0)*7873 163 452
> > > tel: *+44(0)7971 078 445*
> > >
> >
> >
> >
> > --
> > madhu kk
> >
>



-- 
madhu kk

Re: BeanShell_Script.

Posted by Xenofon Papadopoulos <xp...@gmail.com>.
If there is a single val element below list with name="UID", you can use
the following XPath expression to get its value:

/list/val[@name="UID"]/text()

If this is only a chunk of your XML and there are other wrapper elements,
you might have to use something like:

//val[@name="UID"]/text()

(again, assuming the val with name="UID" is unique)




On Tue, Mar 26, 2013 at 2:37 PM, madhu sekhar <ma...@gmail.com>wrote:

> Darren,
>
> In My request what could be the *XPath Query*?
>
> Thanks & Regards,
> Madhu
>
> On Tue, Mar 26, 2013 at 5:45 PM, Darren Bown <da...@gmail.com> wrote:
>
> > Madhu,
> >
> > Parsing [X|H]TML with scripts is very tricky, especially when trying to
> use
> > a regex to do it - which you undoubtedly would end up attempting. You're
> > much better off using an XPath extractor:
> >
> >
> >
> http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor
> >
> > Cheers,
> > Darren.
> >
> >
> > On 26 March 2013 12:04, madhu sekhar <ma...@gmail.com> wrote:
> >
> > > Hi Team,
> > >
> > > We have API Request as below:
> > >
> > >  <list>
> > >       <val name="DatabaseID">ABC</val>
> > >       <val name="QueryLanguage">en</val>
> > >       <val name="UID">ABC:00013564789</val>
> > >       <list name="Editions">
> > >         <map>
> > >           <val name="Collection">ABC</val>
> > >           <val name="Edition">CBI</val>
> > >           <val name="Begin">1991-01-01</val>
> > >           <val name="End">2009-12-31</val>
> > >         </map>
> > >       </list>
> > >
> > >
> > > Could any one please suggest, What should be the bean shell script to
> > > capture the dynamic Value.
> > >
> > > *< val name="UID">ABC:00013564789</val>?*
> > >
> > > Thanks & Regards,
> > > Madhu
> > >
> >
> >
> >
> > --
> > Darren Bown
> > tel:* +44(0)*7873 163 452
> > tel: *+44(0)7971 078 445*
> >
>
>
>
> --
> madhu kk
>

Re: BeanShell_Script.

Posted by madhu sekhar <ma...@gmail.com>.
Darren,

In My request what could be the *XPath Query*?

Thanks & Regards,
Madhu

On Tue, Mar 26, 2013 at 5:45 PM, Darren Bown <da...@gmail.com> wrote:

> Madhu,
>
> Parsing [X|H]TML with scripts is very tricky, especially when trying to use
> a regex to do it - which you undoubtedly would end up attempting. You're
> much better off using an XPath extractor:
>
>
> http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor
>
> Cheers,
> Darren.
>
>
> On 26 March 2013 12:04, madhu sekhar <ma...@gmail.com> wrote:
>
> > Hi Team,
> >
> > We have API Request as below:
> >
> >  <list>
> >       <val name="DatabaseID">ABC</val>
> >       <val name="QueryLanguage">en</val>
> >       <val name="UID">ABC:00013564789</val>
> >       <list name="Editions">
> >         <map>
> >           <val name="Collection">ABC</val>
> >           <val name="Edition">CBI</val>
> >           <val name="Begin">1991-01-01</val>
> >           <val name="End">2009-12-31</val>
> >         </map>
> >       </list>
> >
> >
> > Could any one please suggest, What should be the bean shell script to
> > capture the dynamic Value.
> >
> > *< val name="UID">ABC:00013564789</val>?*
> >
> > Thanks & Regards,
> > Madhu
> >
>
>
>
> --
> Darren Bown
> tel:* +44(0)*7873 163 452
> tel: *+44(0)7971 078 445*
>



-- 
madhu kk

Re: BeanShell_Script.

Posted by Darren Bown <da...@gmail.com>.
Madhu,

Parsing [X|H]TML with scripts is very tricky, especially when trying to use
a regex to do it - which you undoubtedly would end up attempting. You're
much better off using an XPath extractor:

http://jmeter.apache.org/usermanual/component_reference.html#XPath_Extractor

Cheers,
Darren.


On 26 March 2013 12:04, madhu sekhar <ma...@gmail.com> wrote:

> Hi Team,
>
> We have API Request as below:
>
>  <list>
>       <val name="DatabaseID">ABC</val>
>       <val name="QueryLanguage">en</val>
>       <val name="UID">ABC:00013564789</val>
>       <list name="Editions">
>         <map>
>           <val name="Collection">ABC</val>
>           <val name="Edition">CBI</val>
>           <val name="Begin">1991-01-01</val>
>           <val name="End">2009-12-31</val>
>         </map>
>       </list>
>
>
> Could any one please suggest, What should be the bean shell script to
> capture the dynamic Value.
>
> *< val name="UID">ABC:00013564789</val>?*
>
> Thanks & Regards,
> Madhu
>



-- 
Darren Bown
tel:* +44(0)*7873 163 452
tel: *+44(0)7971 078 445*