How to select a node's first child name? XPath

后端 未结 3 1068
你的背包
你的背包 2021-02-03 17:57

I have an XML from which I have to select the name of the child of one of the nodes. I\'m kind of a beginner in this, so I didn\'t find the Xpath expression to do it. I know the

3条回答
  •  囚心锁ツ
    2021-02-03 17:59

    You wrote:

    I have to select the first child of Department node

    You could use:

    /Employee/Department/*[1]
    

    Then, you also wrote:

    I have an XML from which I have to select the name of the child of one of the nodes

    So, you could use:

    name(/Employee/Department/*[1])
    

提交回复
热议问题