使用XPath检索XML子元素名称
我需要检索子元素名,而不是元素值。 我在下面附上了我的XML使用XPath检索XML子元素名称,xml,xpath,Xml,Xpath,我需要检索子元素名,而不是元素值。 我在下面附上了我的XML <TaskInfo> <Appid></Appid>`enter code here` <BusinessUnit></BusinessUnit> <Amount></Amount> ................ ................ </TasKInfo> `在这里输入代码`
<TaskInfo>
<Appid></Appid>`enter code here`
<BusinessUnit></BusinessUnit>
<Amount></Amount>
................
................
</TasKInfo>
`在这里输入代码`
................
................
我想使用类似Xpath的方法检索TaskInfo的子元素名
阿皮德,
业务单位,
数量
..
有人能帮我吗?
提前感谢您可以使用name()
功能:
返回name(/TaskInfo/*[1])
Appid
返回name(/TaskInfo/*[2])
等等BusinessUnit
Appid, BusinessUnit, Amount
您可以使用local-name()
Appid, BusinessUnit, Amount