Skip to content

Support asterisk (*) namespaces in xPath expression #103

Open
@whati001

Description

@whati001

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions