Question

The value I need to extract is something in the following format :

<input type='hidden' name='SAMLResponse' value='PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4K.... ">

I used the following xpath extractor.

//input[@type='hidden'][@name='SAMLResponse']/@value

But I get the following exception.

Please let me know why I get something like this?

[Fatal Error] :-1:-1: Premature end of file.
.
.
.
.

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.xml.sax.SAXParseException; Premature end of file.
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121)
    at ...
Was it helpful?

Solution 3

I found the answer.

You have to tick Use Tidy (tolerant parser) and Quiet when you define the Xpath Query. Then the problem will be solved.

OTHER TIPS

"Premature end of file" indicates that XML document is not well formed and doesn't have closing tag.

You need to check "Use Tidy" under your XPath extractor post processor. By the way, starting from JMeter 2.11 it's possible to evaluate XPath right in View Results Tree Listener

However as per Using the XPath Extractor in JMeter guide XPath Extractor

Builds DOM tree to parse HTML code, it consumes CPU and memory

So you may wish to consider using Regular Expression Extractor instead. If text to parse isn't complex, isn't multiline, etc. RegExp is the best option to do the correlation.

"Premature end of file" indicates it is not well formed. Hence Use Tidy option under XPath extractor post processor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top