问题
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.
How can I do that?
回答1:
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
来源:https://stackoverflow.com/questions/34855024/how-to-parse-xsd-file-using-c-sharp