如何使用XQuery获取指定XML数据类型的XML节点 [英] How to get XML Nodes of specified XML Data Type using XQuery
问题描述
我有一个XML模式文件和一个XML文档.现在我想按XML模式文件中指定的数据类型获取XML文档中的节点列表.
例如,XML Schema文件就像
I have an XML schema file and an XML document.Now I want the get the List of Nodes in the XML document by the specified data type in the XML schema file.
For example the XML Schema file is like
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Employee">
<xsd:complextype>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string" />
<xsd:element name="MiddleName" type="xsd:string" />
<xsd:element name="LastName" type="xsd:string" />
</xsd:sequence>
</xsd:complextype>
</xsd:element>
</xsd:schema>
XML文档如下
And the XML document is as follows
<employee>
<firstname>Jacob</firstname>
<middlename>V</middlename>
<lastname>Sebastian</lastname>
</employee>
现在,我想通过指定XML节点的类型(如
)来获取Node
通过指定XML节点类型''xsd:string''而不是通过节点名称 First 或 MiddleName 或 LastName
我想通过使用SQL Server或C#实现此目的
在此先感谢
Now I want the get the Node by specifying the type of the XML node like
by specifying the XML node tye ''xsd:string'' rather than by the node name First or MiddleName or LastName
I want to achieve this by using SQL server or C#
Thanks in advance
推荐答案
也许此 [ ^ ]可以提供帮助.
Maybe this[^] can help.
这篇关于如何使用XQuery获取指定XML数据类型的XML节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!