Reputation: 942
I'm using JMeter to run a test where the response is returned as an XML-formatted .srx SPARQL file. The error I'm getting is:
2015/04/28 1:30:39 ERROR - jmeter.util.XPathUtil: Type=Val=false
Tol=false org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1;
Content is not allowed in prolog.
2015/04/28 11:30:39 WARN - jmeter.extractor.XPathExtractor: SAXException
while processing (sparql/results/result/binding/literal) Content is not
allowed in prolog.
I'm pretty new to JMeter. My guess is that my XPath Extractor somehow doing its magic in a place I'm not expecting. The XML file response looks like this (a snipplet from a file), without any space before or any extra characters:
<?xml version='1.0' encoding='UTF-8'?>
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
<head>
<variable name='p'/>
</head>
<results>
<result>
<binding name='p'>
<literal datatype='http://www.w3.org/2001/XMLSchema#date'>1999-08-16</literal>
</binding>
I set up my XPathExtractor
this way:
Reference Name:Results
XPath query:sparql/results/result/binding/literal
default Value:Not Found
Can anyone help?
Upvotes: 0
Views: 3552
Reputation: 942
I had to replace the XPath Extractor with the Regular Expression Extractor. Then, to find the string 1999-08-16 date
, I used the regex (\d{4}-\d{2}-\d{2})
. Somehow the date data comes on a separate line.
Upvotes: 0
Reputation: 168247
I would go for the following approach:
In user.properties file (located in /bin folder of your JMeter installation) add the next line:
xpath.namespace.config=my.properties
Create my.properties file in /bin folder of your JMeter installation and add the following line there:
s=http://www.w3.org/2005/sparql-results#
Configure your XPath Extractor the following way:
Use Namespaces
boxliteral
//s:literal/text()
In regards to your question: Content is not allowed in prolog
message usually stands for not well-formed XML, my suggestion will be applicable to valid XML
References:
Upvotes: 1
Reputation: 1239
Your xml had a namespace without a prefix
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
while your XPATH is not considering the namespace .. you can choose one of two solutions
Or use this XPATH which considering the namespace
/*[local-name()='sparql']/*[local-name()='results']/*[local-name()='result']/*[local-name()='binding']/*[local-name()='literal']
I hope this could help.
Upvotes: 0