You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Chris Hansen <tc...@xmission.com> on 2006/07/27 21:15:54 UTC

Question on Jmeter XPATH extraction

My name is Chris Hansen; nice to meet you!

I'm working for the first time with  Jmeter and while I've got most of
what I need from the website and wiki, I have a case I can't quite
figure out how to make work and I was wondering if you knew how to do it
or if you had a ready reference you could refer me to.

I've been using the Regular Expression Extractor from the Post
Processors and it works fine for me except in one case.  My regular
expression matches in two places in the returning XML where I need it to
match in one.

<CAPs>
  <CAP>
    <Keys>
      <Key>KEY1</Key>
      <Key>KEY2</Key>
      <Key>KEY3</Key>
    </Keys>
...
    <Parcels>
      <Parcel>
        <CAPs>
            <CAP>
              <Keys>
                <Key>KEY1</Key>
                <Key>KEY2</Key>
                <Key>KEY3</Key>
              </Keys>
...

I'd rather use the XPATH extractor but using this as my value:

/GovXML/GetCAPsResponse/CAPs/CAP/Keys/text()

gets the value of the first <Key> element, not the set.  I'd like to use

/GovXML/GetCAPsResponse/CAPs/CAP/Keys/

To extract the elements contained in the reference element, but I can't
seem to get it to work.  The structure at that point is like this

<CAP>
        <Keys>
                <Key>KEY1</Key>
                <Key>KEY2</Key>
                <Key>KEY3</Key>
        </Keys>
…

And I'd like to be able to extract the entire <Keys>…</Keys> if possible.

Also, a second question:  is there any way with the XPATH extractor to
pull out a set like you can do with the Regular Expression Extractor?

Thanks for any assistance you can provide.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question on Jmeter XPATH extraction

Posted by Chris Hansen <tc...@xmission.com>.
>> >>> <CAPs>
>> >>>  <CAP>
>> >>>    <Keys>
>> >>>      <Key>KEY1</Key>
>> >>>      <Key>KEY2</Key>
>> >>>      <Key>KEY3</Key>
>> >>>    </Keys>
>> >>> ...
>> >>>    <Parcels>
>> >>>      <Parcel>
>> >>>        <CAPs>
>> >>>            <CAP>
>> >>>              <Keys>
>> >>>                <Key>KEY1</Key>
>> >>>                <Key>KEY2</Key>
>> >>>                <Key>KEY3</Key>
>> >>>              </Keys>
>> >>> ...
>> >
>> > Sorry, I wasn't very clear there was I.
>> >
>> > It is actually a list of CAPs and each CAP can have a list of Parcels
>> > which in turn can have a list of attached CAPs.  The application won't
>> > recurse beyond that, but what I need to get is the Keys element out of
>> > the CAP list, but not include the Keys element out of the CAPs attached
>> > to the Parcels.
>> >
> 
> If the Parcels always appear after the plain CAPs, surely you can just
> match the 1st Keys element?

That works if I'm only trying to get one - however, since multiple CAPs
are returned I'm trying to get a set of the CAPs.CAP keys but not the
CAPs.CAP.Parcels.Parcel.CAPs.CAP keys.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question on Jmeter XPATH extraction

Posted by sebb <se...@gmail.com>.
On 28/07/06, Chris Hansen <tc...@xmission.com> wrote:
> It just occurred to me that I could use a regular expression that
> utilizes a 'lookbehind' aspect - except that it doesn't seem to work.
> Does the JMeter/ORO support lookbehind as a regular expression?

No, I don't think it does.

>
> chris
>
> Chris Hansen wrote:
> > sebb wrote:
> >> On 27/07/06, Chris Hansen <tc...@xmission.com> wrote:
> >>> My name is Chris Hansen; nice to meet you!
> >>>
> >>> I'm working for the first time with  Jmeter and while I've got most of
> >>> what I need from the website and wiki, I have a case I can't quite
> >>> figure out how to make work and I was wondering if you knew how to do it
> >>> or if you had a ready reference you could refer me to.
> >>>
> >>> I've been using the Regular Expression Extractor from the Post
> >>> Processors and it works fine for me except in one case.  My regular
> >>> expression matches in two places in the returning XML where I need it to
> >>> match in one.
> >> Surely that is not a problem - just choose the appropriate match, either
> >> 1 or 2?
> >>
> >>> <CAPs>
> >>>  <CAP>
> >>>    <Keys>
> >>>      <Key>KEY1</Key>
> >>>      <Key>KEY2</Key>
> >>>      <Key>KEY3</Key>
> >>>    </Keys>
> >>> ...
> >>>    <Parcels>
> >>>      <Parcel>
> >>>        <CAPs>
> >>>            <CAP>
> >>>              <Keys>
> >>>                <Key>KEY1</Key>
> >>>                <Key>KEY2</Key>
> >>>                <Key>KEY3</Key>
> >>>              </Keys>
> >>> ...
> >
> > Sorry, I wasn't very clear there was I.
> >
> > It is actually a list of CAPs and each CAP can have a list of Parcels
> > which in turn can have a list of attached CAPs.  The application won't
> > recurse beyond that, but what I need to get is the Keys element out of
> > the CAP list, but not include the Keys element out of the CAPs attached
> > to the Parcels.
> >

If the Parcels always appear after the plain CAPs, surely you can just
match the 1st Keys element?

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question on Jmeter XPATH extraction

Posted by Chris Hansen <tc...@xmission.com>.
It just occurred to me that I could use a regular expression that
utilizes a 'lookbehind' aspect - except that it doesn't seem to work.
Does the JMeter/ORO support lookbehind as a regular expression?

chris

Chris Hansen wrote:
> sebb wrote:
>> On 27/07/06, Chris Hansen <tc...@xmission.com> wrote:
>>> My name is Chris Hansen; nice to meet you!
>>>
>>> I'm working for the first time with  Jmeter and while I've got most of
>>> what I need from the website and wiki, I have a case I can't quite
>>> figure out how to make work and I was wondering if you knew how to do it
>>> or if you had a ready reference you could refer me to.
>>>
>>> I've been using the Regular Expression Extractor from the Post
>>> Processors and it works fine for me except in one case.  My regular
>>> expression matches in two places in the returning XML where I need it to
>>> match in one.
>> Surely that is not a problem - just choose the appropriate match, either
>> 1 or 2?
>>
>>> <CAPs>
>>>  <CAP>
>>>    <Keys>
>>>      <Key>KEY1</Key>
>>>      <Key>KEY2</Key>
>>>      <Key>KEY3</Key>
>>>    </Keys>
>>> ...
>>>    <Parcels>
>>>      <Parcel>
>>>        <CAPs>
>>>            <CAP>
>>>              <Keys>
>>>                <Key>KEY1</Key>
>>>                <Key>KEY2</Key>
>>>                <Key>KEY3</Key>
>>>              </Keys>
>>> ...
> 
> Sorry, I wasn't very clear there was I.
> 
> It is actually a list of CAPs and each CAP can have a list of Parcels
> which in turn can have a list of attached CAPs.  The application won't
> recurse beyond that, but what I need to get is the Keys element out of
> the CAP list, but not include the Keys element out of the CAPs attached
> to the Parcels.
> 
> thanks!
> 
> chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question on Jmeter XPATH extraction

Posted by Chris Hansen <tc...@xmission.com>.
sebb wrote:
> On 27/07/06, Chris Hansen <tc...@xmission.com> wrote:
>> My name is Chris Hansen; nice to meet you!
>>
>> I'm working for the first time with  Jmeter and while I've got most of
>> what I need from the website and wiki, I have a case I can't quite
>> figure out how to make work and I was wondering if you knew how to do it
>> or if you had a ready reference you could refer me to.
>>
>> I've been using the Regular Expression Extractor from the Post
>> Processors and it works fine for me except in one case.  My regular
>> expression matches in two places in the returning XML where I need it to
>> match in one.
> 
> Surely that is not a problem - just choose the appropriate match, either
> 1 or 2?
> 
>> <CAPs>
>>  <CAP>
>>    <Keys>
>>      <Key>KEY1</Key>
>>      <Key>KEY2</Key>
>>      <Key>KEY3</Key>
>>    </Keys>
>> ...
>>    <Parcels>
>>      <Parcel>
>>        <CAPs>
>>            <CAP>
>>              <Keys>
>>                <Key>KEY1</Key>
>>                <Key>KEY2</Key>
>>                <Key>KEY3</Key>
>>              </Keys>
>> ...

Sorry, I wasn't very clear there was I.

It is actually a list of CAPs and each CAP can have a list of Parcels
which in turn can have a list of attached CAPs.  The application won't
recurse beyond that, but what I need to get is the Keys element out of
the CAP list, but not include the Keys element out of the CAPs attached
to the Parcels.

thanks!

chris

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Question on Jmeter XPATH extraction

Posted by sebb <se...@gmail.com>.
On 27/07/06, Chris Hansen <tc...@xmission.com> wrote:
> My name is Chris Hansen; nice to meet you!
>
> I'm working for the first time with  Jmeter and while I've got most of
> what I need from the website and wiki, I have a case I can't quite
> figure out how to make work and I was wondering if you knew how to do it
> or if you had a ready reference you could refer me to.
>
> I've been using the Regular Expression Extractor from the Post
> Processors and it works fine for me except in one case.  My regular
> expression matches in two places in the returning XML where I need it to
> match in one.

Surely that is not a problem - just choose the appropriate match, either 1 or 2?

> <CAPs>
>  <CAP>
>    <Keys>
>      <Key>KEY1</Key>
>      <Key>KEY2</Key>
>      <Key>KEY3</Key>
>    </Keys>
> ...
>    <Parcels>
>      <Parcel>
>        <CAPs>
>            <CAP>
>              <Keys>
>                <Key>KEY1</Key>
>                <Key>KEY2</Key>
>                <Key>KEY3</Key>
>              </Keys>
> ...
>
> I'd rather use the XPATH extractor but using this as my value:
>
> /GovXML/GetCAPsResponse/CAPs/CAP/Keys/text()
>
> gets the value of the first <Key> element, not the set.  I'd like to use
>
> /GovXML/GetCAPsResponse/CAPs/CAP/Keys/
>
> To extract the elements contained in the reference element, but I can't
> seem to get it to work.  The structure at that point is like this
>
> <CAP>
>        <Keys>
>                <Key>KEY1</Key>
>                <Key>KEY2</Key>
>                <Key>KEY3</Key>
>        </Keys>
> …
>
> And I'd like to be able to extract the entire <Keys>…</Keys> if possible.
>
> Also, a second question:  is there any way with the XPATH extractor to
> pull out a set like you can do with the Regular Expression Extractor?

Sorry, can't help here, I don't know XPath.

> Thanks for any assistance you can provide.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org