如何使用XQuery获取指定XML数据类型的XML节点 [英] How to get XML Nodes of specified XML Data Type using XQuery

查看:102
本文介绍了如何使用XQuery获取指定XML数据类型的XML节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆