Removing special characters inside XPATH

I have some elements with a tag <xxx:element>

inside my xml.

I want to get them using XPath. I have tried several ways to get them but no success so far.

//xxx:element

just returns nothing. I assume it is because of the :

characater
//#xxx:element#

giving an exception: "Location step was expected after token" / "or" // ".

//'xxx:element'

Same exception.

Any suggestions?

Based on choroba's answer, I found the Xml namespace splitting my xpath!

+3


source to share


3 answers


Found a solution using the local-name property. The following works just fine:
  // * [-local name () 'element' =]



+1


source


The part xxx:

is the namespace prefix. It should work in XPath, but depending on the language you are using, you may need to register the namespace before you can use it.



+2


source


In saxon // *: the element does the trick for me

0


source







All Articles