You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by freesky <hw...@windowslive.com> on 2011/09/28 11:11:39 UTC

XPath Extractor doesn't work if I check 'Use Tidy'

JMeter version is 2.4, the test plan is : 

Test Plan
     |_login(http)
     |_init(xml-rpc)
     |_read(xml-rpc)
     |    |_XPath Extractor
     |_update(xml-rpc)

In 'XPath Extractor', the 'Reference name' is 'a', in 'update' sampler, I
used 'id="${a_1}" '.  But if I check the 'Use Tidy' in 'XPath Extractor',
then I can't get the value of a, such as the 'a_1' should be '5', but in
'update' sampler, the expression  is still 'id="${a_1}" '.  While if I
uncheck the 'Use Tidy', then I can get the correct value of id in 'update'
sampler, such as ' id="5" '.  Why?  Thanks in advance.

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4848485.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by Deepak Shetty <sh...@gmail.com>.
Don't use tidy for xml. Only use it when the response is html
On Sep 28, 2011 4:00 AM, "freesky" <hw...@windowslive.com> wrote:
> There are more than one return value, so I have to use ${a_1}, ${a_2}.....
>
> The response data of 'read' sampler is like this :
> <records _actions_="true">
> <record id="2"></record>
> </records>
>
> The XPath Extractor is :
> Reference name : a
> XPath : //record/@id
>
> The sampler use the the 'Reference name' is like this :
> <?xml version="1.0" encoding="UTF-8"?><request id="${a_1}"></request>
>
> --
> View this message in context:
http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4848724.html
> 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
>

Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
If I used ' objectId="${a}" ' in the 'update' sampler, then in 'View Result
Tree', I found the real request is ' objectId="" '.

It's a valid XML, I just wanted to try the 'Use Tidy'.  I have no clue why
this error will happen if I use 'Use Tidy'.


--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851610.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
Thank you for telling me some knowledge of XML !

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-resolved-tp4848485p4881843.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by sebb <se...@gmail.com>.
There are two aspects to XML correctness:

- well-formed
- valid

Well-formed just means matching end-tags and no syntax errors, which
is probably all you were expecting.

Valid means that the XML agrees with its DTD.
For XHTML, Tidy knows what the DTD is.

Tidy does not know what the DTD for arbitrary XML is unless you tell
it, so it cannot know if <xyz> is valid or not.



On 29 September 2011 05:08, freesky <hw...@windowslive.com> wrote:
> Thanks, after I checked the 'Report errors' and 'Show warnings', the
> assertion of 'read' sampler is false, the Assertion failure message is '
> //record/@id -> tidy : 4 errors, 9 warnings.
>
> And Sorry, the real response data is like next, I didn't think there is
> errors, so I simplified the response data   :
>
> <records _actions_="true"><read control="{"objs":[],"mode":""}"
> totalRecords="2"><record
> des="{"shili":[{"enabled":true,"name":"editable"}]}"
> id="6"/></read></records>, I
>
>
> Then I checked the log, it's :
>
> jmeter.util.XPathUtil: TidyException: line 1 column 1 - Warning: <records>
> attribute "_actions_" has invalid value "true"
> line 1 column 1 - Error: <records> is not recognized!
> line 1 column 1 - Warning: missing &lt;!DOCTYPE&gt; declaration
> line 1 column 1 - Warning: discarding unexpected <records>
> line 1 column 27 - Error: <read> is not recognized!
> line 1 column 27 - Warning: discarding unexpected <read>
> line 1 column 297 - Error: record is not recognized!
> line 1 column 297 - Warning: discarding unexpected record
> line 1 column 846 - Error: record is not recognized!
> line 1 column 846 - Warning: discarding unexpected record
> line 1 column 1,453 - Warning: discarding unexpected </read>
> line 1 column 1,460 - Warning: discarding unexpected </records>
> line 1 column 1,474 - Warning: inserting missing 'title' element
> InputStream: Document content looks like HTML 2.0
> 9 warnings, 4 errors were found!
> This document has errors that must be fixed before
> using HTML Tidy to generate a tidied up version.
>
> But why it said ' <records> attribute "_actions_" has invalid value "true" '
> and ' <records> is not recognized! '.
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851678.html
> 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
>
>

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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
Thank you very much!

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4855559.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by Deepak Shetty <sh...@gmail.com>.
Hi
>Meter will treat it as HTML
Tidy does. Jmeter doesnt know.

>so if there is error during checking, then the XPath Extractor doesn't
work,
Some errors Tidy will fix, it might for e.g. add an <html> and <body> tag
which will mess up your xpath. if you are interested , download the command
line version of tidy and run it against an xml file and see what output it
generates(if at all) .

regards
deepak

On Wed, Sep 28, 2011 at 11:48 PM, freesky <hw...@windowslive.com> wrote:

> Thanks!  That is even if the response is XML, but if we check ' Use Tidy ',
> then the JMeter will treat it as HTML and check the response it's a valid
> HTML or not before parsing the XPath, so if there is error during checking,
> then the XPath Extractor doesn't work, right?
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851993.html
> 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
>
>

Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
Thanks!  That is even if the response is XML, but if we check ' Use Tidy ',
then the JMeter will treat it as HTML and check the response it's a valid
HTML or not before parsing the XPath, so if there is error during checking,
then the XPath Extractor doesn't work, right?

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851993.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by Deepak Shetty <sh...@gmail.com>.
tidy fixes HTML to be XHTML compliant. (which is what you need to run XPATH
on it).

however something that returns XML should already be valid (or its a problem
anyway!) so you can directly run XPath against it .
Thats why you get errors saying records is not recognized etc(its checking
against what it expects in HTML)

regards
deepak


On Wed, Sep 28, 2011 at 9:08 PM, freesky <hw...@windowslive.com> wrote:

> Thanks, after I checked the 'Report errors' and 'Show warnings', the
> assertion of 'read' sampler is false, the Assertion failure message is '
> //record/@id -> tidy : 4 errors, 9 warnings.
>
> And Sorry, the real response data is like next, I didn't think there is
> errors, so I simplified the response data   :
>
> <records _actions_="true"><read control="{"objs":[],"mode":""}"
> totalRecords="2"><record
> des="{"shili":[{"enabled":true,"name":"editable"}]}"
> id="6"/></read></records>, I
>
>
> Then I checked the log, it's :
>
> jmeter.util.XPathUtil: TidyException: line 1 column 1 - Warning: <records>
> attribute "_actions_" has invalid value "true"
> line 1 column 1 - Error: <records> is not recognized!
> line 1 column 1 - Warning: missing &lt;!DOCTYPE&gt; declaration
> line 1 column 1 - Warning: discarding unexpected <records>
> line 1 column 27 - Error: <read> is not recognized!
> line 1 column 27 - Warning: discarding unexpected <read>
> line 1 column 297 - Error: record is not recognized!
> line 1 column 297 - Warning: discarding unexpected record
> line 1 column 846 - Error: record is not recognized!
> line 1 column 846 - Warning: discarding unexpected record
> line 1 column 1,453 - Warning: discarding unexpected </read>
> line 1 column 1,460 - Warning: discarding unexpected </records>
> line 1 column 1,474 - Warning: inserting missing 'title' element
> InputStream: Document content looks like HTML 2.0
> 9 warnings, 4 errors were found!
> This document has errors that must be fixed before
> using HTML Tidy to generate a tidied up version.
>
> But why it said ' <records> attribute "_actions_" has invalid value "true"
> '
> and ' <records> is not recognized! '.
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851678.html
> 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
>
>

Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
Thanks, after I checked the 'Report errors' and 'Show warnings', the
assertion of 'read' sampler is false, the Assertion failure message is '
//record/@id -> tidy : 4 errors, 9 warnings.

And Sorry, the real response data is like next, I didn't think there is
errors, so I simplified the response data   : 

<records _actions_="true"><read control="{"objs":[],"mode":""}"
totalRecords="2"><record
des="{"shili":[{"enabled":true,"name":"editable"}]}"
id="6"/></read></records>, I 


Then I checked the log, it's : 

jmeter.util.XPathUtil: TidyException: line 1 column 1 - Warning: <records>
attribute "_actions_" has invalid value "true"
line 1 column 1 - Error: <records> is not recognized!
line 1 column 1 - Warning: missing &lt;!DOCTYPE&gt; declaration
line 1 column 1 - Warning: discarding unexpected <records>
line 1 column 27 - Error: <read> is not recognized!
line 1 column 27 - Warning: discarding unexpected <read>
line 1 column 297 - Error: record is not recognized!
line 1 column 297 - Warning: discarding unexpected record
line 1 column 846 - Error: record is not recognized!
line 1 column 846 - Warning: discarding unexpected record
line 1 column 1,453 - Warning: discarding unexpected </read>
line 1 column 1,460 - Warning: discarding unexpected </records>
line 1 column 1,474 - Warning: inserting missing 'title' element
InputStream: Document content looks like HTML 2.0
9 warnings, 4 errors were found!
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.

But why it said ' <records> attribute "_actions_" has invalid value "true" '
and ' <records> is not recognized! '.

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4851678.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by sebb <se...@gmail.com>.
On 28 September 2011 11:59, freesky <hw...@windowslive.com> wrote:
> There are more than one return value, so I have to use ${a_1}, ${a_2}.....

OK, but that is not what I asked - does ${a} exist?
The response data of 'read' sampler is like this :
> <records _actions_="true">
> <record id="2"></record>
> </records>

Why use Tidy? Isn't that valid XML?

> The XPath Extractor is :
> Reference name : a
> XPath : //record/@id

Use a default; makes debugging easier.

>
> The sampler use the the 'Reference name' is like this :
> <?xml version="1.0" encoding="UTF-8"?><request id="${a_1}"></request>

Try enabling Report Errors and Show Warnings; disable Quiet.

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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by freesky <hw...@windowslive.com>.
There are more than one return value, so I have to use ${a_1}, ${a_2}.....

The response data of 'read' sampler is like this : 
<records _actions_="true">
<record id="2"></record>
</records>

The XPath Extractor is : 
Reference name : a
XPath : //record/@id

The sampler use the the 'Reference name' is like this : 
<?xml version="1.0" encoding="UTF-8"?><request id="${a_1}"></request>

--
View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4848724.html
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


Re: XPath Extractor doesn't work if I check 'Use Tidy'

Posted by sebb <se...@gmail.com>.
On 28 September 2011 10:11, freesky <hw...@windowslive.com> wrote:
> JMeter version is 2.4, the test plan is :
>
> Test Plan
>     |_login(http)
>     |_init(xml-rpc)
>     |_read(xml-rpc)
>     |    |_XPath Extractor
>     |_update(xml-rpc)
>
> In 'XPath Extractor', the 'Reference name' is 'a', in 'update' sampler, I
> used 'id="${a_1}" '.  But if I check the 'Use Tidy' in 'XPath Extractor',
> then I can't get the value of a, such as the 'a_1' should be '5', but in
> 'update' sampler, the expression  is still 'id="${a_1}" '.  While if I
> uncheck the 'Use Tidy', then I can get the correct value of id in 'update'
> sampler, such as ' id="5" '.  Why?  Thanks in advance.

Does ${a} work ? This should be the same as ${a_1}.

The most likely cause is that Tidy is changing the XML structure so
the query no longer matches.

Not sure why that would be; to investigate further you will need to
provide exact details of the source data and a Test Plan containing
the XPath Extractor and the Sampler that uses the data.

Do not post these to the list; upload somewhere public and post the URL.

> --
> View this message in context: http://jmeter.512774.n5.nabble.com/XPath-Extractor-doesn-t-work-if-I-check-Use-Tidy-tp4848485p4848485.html
> 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
>
>

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