3

I have some elements with the tag <xxx:element> inside my xml.

I want to get these using XPath. I've tried a few ways of getting them but so far unsuccessful.

//xxx:element just doesn't return anything. I'm guessing this is because of the : characater
//#xxx:element# gives the exception: "A location step was expected following the '/' or '//' token."
//'xxx:element' same exception.

Any suggestions?

Based on choroba's answer I found Xml Namespace breaking my xpath!

Community
  • 1
  • 1
Deelazee
  • 493
  • 2
  • 9
  • 18

3 Answers3

2

The xxx: part is a namespace prefix. It should work in XPath, but depending on the language you are using, you might need to register the namespace before you can use it.

choroba
  • 231,213
  • 25
  • 204
  • 289
2

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

Deelazee
  • 493
  • 2
  • 9
  • 18
0

In saxon //*:element do the trick to me

anyone
  • 1