如何在xquery中选择节点的属性值? [英] how to select attribute value of a node in xquery ?
本文介绍了如何在xquery中选择节点的属性值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下xml:
In below xml:
<company>
<customers>
<customer cno="2222">
<cname>Charles</cname>
<street>123 Main St.</street>
<city>Wichita</city>
<zip>67226</zip>
<phone>316-636-5555</phone>
</customer>
<customer cno="1000">
<cname>Bismita</cname>
<street>Ashford Dunwoody</street>
<city>Wichita</city>
<zip>67226-1555</zip>
<phone>000-000-0000</phone>
</customer>
</customers>
</company>
我需要获取客户的否属性。在XPath中,我知道它是 / company / customers / customer / @ cno ,在XQuery中,我尝试过以下表达但是对我没有用。
< b> for $ c in / company / customers / customer
返回$ c / @ cno
任何人都可以提供帮助我在这方面得到了这个。
I need to get the customer''s no which is an attribute. In XPath I know it is /company/customers/customer/@cno, in XQuery I''ve tried below expression but didn''t work for me.
for $c in /company/customers/customer
return $c/@cno
Any one to help me to get this in XQuery in this regard.
推荐答案
c in / company / customers / customer
return
c in /company/customers/customer
return
c / @ cno
任何人都可以帮助我在这方面得到这个。
c/@cno
Any one to help me to get this in XQuery in this regard.
这篇关于如何在xquery中选择节点的属性值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文