Select node without namespace with XPath

后端 未结 2 1073
北海茫月
北海茫月 2020-12-19 03:15

I have a xml like


    Text
    Number


        
相关标签:
2条回答
  • 2020-12-19 03:55

    Use the local-name() function like so:

    //*[local-name()='child2']
    
    0 讨论(0)
  • 2020-12-19 03:59

    You can bind any prefix you like (say banana) to the namespace "http://foo", and the expression /root/banana:child2 will find the child2 element, regardless what namespace prefix has been used in the source document. Only the namespace URI has to match.

    0 讨论(0)
提交回复
热议问题