如何使用c#解析XSD文件 [英] How to parse XSD file using c#

查看:43
本文介绍了如何使用c#解析XSD文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取 XSD 文件.但是找不到解析XSD文件的正确方法.

I want to read XSD File. But unable to find a proper way to parse XSD file.

<xsd:group name="group_name">
    <xsd:annotation>
        <xsd:documentation>Some text is here</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
        <xsd:element minOccurs="0" name="Element_1" type="string">
            <xsd:annotation>
                <xsd:documentation>Some text is here</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
        <xsd:element minOccurs="0" name="Element_2" type="string">
            <xsd:annotation>
                <xsd:documentation>Some text is here</xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    </xsd:sequence>
</xsd:group>

我想读取文件中的每个组、该组中的序列和该序列中的元素.并且还需要阅读每组的注释,我可以元素.

I want to read each group in my file, a sequence in that group and element in that sequence. And also need to read annotation of each group, I can element.

我该怎么做?

推荐答案

XSD 文件是 XML 文件,因此您可以使用 XML 解析器读取 ot,例如 LINQ 是从数据源读取数据的查询,下面的链接是关于它的好来源:https://msdn.microsoft.com/en-us/library/bb397933.aspx所以,第一步是加载xml文件,然后通过LINQ查询读取它

XSD File are XML file, so you can read ot using XML parser such as LINQ which is a query to read data from data source, the link bellow is a good source about it: https://msdn.microsoft.com/en-us/library/bb397933.aspx So, the first step is to load the xml file then read it by LINQ query

这篇关于如何使用c#解析XSD文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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