Service Virtualization

 View Only

 Xpath Issue

sravankumar sindam's profile image
sravankumar sindam posted Aug 13, 2025 03:36 AM

Hello all,

I am Sravan kumar, while developing the virtual service using RRpairs, when I take request as xpath i,e; /:Request/:body/:bodyAsString/text() I am getting below error.

please find the attachment and help me out 

Invalid XPath defined in XML XPath filter: /:Request/:body/:bodyAsString/text()
org.apache.xpath.domapi.XPathStylesheetDOM3Exception: Prefix must resolve to a namespace: 
  at org.apache.xpath.compiler.XPathParser.errorForDOM3(XPathParser.java:655)
  at org.apache.xpath.compiler.Lexer.mapNSTokens(Lexer.java:647)
  at org.apache.xpath.compiler.Lexer.tokenize(Lexer.java:274)
  at org.apache.xpath.compiler.Lexer.tokenize(Lexer.java:98)
  at org.apache.xpath.compiler.XPathParser.initXPath(XPathParser.java:112)
  at org.apache.xpath.XPath.<init>(XPath.java:178)
  at org.apache.xpath.XPathAPI.eval(XPathAPI.java:277)
  at com.itko.lisa.xml.XMLXPathUtils.executeXPath(XMLXPathUtils.java:109)
  at com.itko.lisa.xml.FilterXMLXPath.ossXPath(FilterXMLXPath.java:239)
  at com.itko.lisa.xml.FilterXMLXPath.subPostFilter(FilterXMLXPath.java:129)
  at com.itko.lisa.test.FilterBaseImpl.subFilter(FilterBaseImpl.java:148)
  at com.itko.lisa.test.FilterBaseImpl.postFilter(FilterBaseImpl.java:122)
  at com.itko.lisa.test.TestNode.doFilters(TestNode.java:1572)
  at com.itko.lisa.test.TestNode.doPostFilters(TestNode.java:1521)
  at com.itko.lisa.test.TestNode.executeNode(TestNode.java:1008)
  at com.itko.lisa.test.TestCase.execute(TestCase.java:1297)
  at com.itko.lisa.test.TestCase.execute(TestCase.java:1198)
  at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1183)
  at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1122)
  at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:72)
  at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:1021)
  at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:195)
  at java.lang.Thread.run(Thread.java:750)

thanks in Advance

Sravan Kumar. 

Attachment  View in library
image.png 128 KB
Sankar Natarajan's profile image
Broadcom Employee Sankar Natarajan

Hi Sravan

         Thanks for reaching out to the community.

Root Cause:

The XPath expressio/:Request/:body/:bodyAsString/text() is using namespace prefixes (:Request:body, :bodyAsString) but these prefixes are not defined or mapped to namespaces.
In XML, when you use a colon (:) in an XPath expression, it indicates a namespace prefix. The system expects these prefixes to be properly declared and mapped to actual namespace URIs.

Solution:

Replace the namespace-prefixed XPath with local names:

For Eg: //Request//body//bodyAsString/text()

or

/Request/body/bodyAsString/text()

Please try and let me know if this solves the reported issue.

regards

Sankar