xmlquery icon indicating copy to clipboard operation
xmlquery copied to clipboard

Support asterisk (*) namespaces in xPath expression

Open whati001 opened this issue 2 years ago • 0 comments

Hi,

would it be possible to add support for asterisk namespaces in the xPath expression? The goal would be to evaluate the following example:

xPath:

//*:innerField/text() // result: someValue

XML Document:

<xml xmlns:ns2="something" xmlns:ns3="somethingElse">
  <ns2:outerField>
    <ns3:innerField>someValue</ns3:innerField>
  </ns2:outerField>
</xml>

It seems like that the lib supports xPath with NS by using the function xpath.CompileWithNS. However, this requires to define the namespaces explicitly. I would simply like to drop all NS by leveraging the "*:" expression. To achieve my current goal, I remove all NS manually via string manipulation, but this solution is quite odd.

Regards, Andi

whati001 avatar May 02 '23 09:05 whati001