jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronan Klyne <>
Subject Re: Odd behaviour in XPath Extractor
Date Thu, 31 Jan 2008 15:34:42 GMT
sebb wrote:
> On 31/01/2008, Ronan Klyne <> wrote:
>> Hello all,
>> I'm having a little trouble with the XPath Extractor.
>> The problem presents itself whenspecified element is not present in the
>> page. Instead of the expression returning my default value of "ERROR",
>> it returns "". This looks to me like a bug in the substring-* functions.
>> This expression works as expected:
>> //a[@class="tabLinkFunc"]/@href
>> There is no such element, so it returns "ERROR". Correct.
>> The second, which does not:
>> substring-before(substring-after(//a[@class="tabLinkFunc"]/@href,
>> "@as_id="), "&")
>> There is no such element, so it should also return "ERROR". But it
>> returns "" instead.
>> Any thoughts/suggestions, anyone?
> Are there any errors reported in jmeter.log?
> If not, then it is most likely that the behaviour is determined by the
> XPath implementation.

There are no related errors in jmeter.log.

I observe (in that unless the XPath library returns 
an XObject identifying itself as a CLASS_NODESET, the result is 
converted to a string and stored in the appropriate variable. The 
default is only used in exceptional cases.

There are classes of XPath object which are not 'successful' responses 
which do not throw exceptions.

These are the XPath types that the Xalan library defines:

I think that the last three should result in either an error condition 
or the default value being used.

I believe I saw the behaviour I did because the final result of my XPath 
expression was coming from applying a function to an empty nodeset, 
rather than returning said nodeset.

	# r

Ronan Klyne
Business Collaborator Developer
Tel: +44 01189 028518

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message