Extract XSD ComplexType enumeration
can anybody help me how to return the enumeration of my XSD complexType
I want to get Hz, and Orders enumeration.
<xs:complexType name="ScalarType">
<xs:simpleContent>
<xs:extension base开发者_如何学Go="xs:float">
<xs:attribute name="Units">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Hz"/>
<xs:enumeration value="Orders"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Thanks!
Using LINQ to XML:
Make an XElement reference referring to that complex type in your question.
then:
var listOfEnumerationStrings = yourComplexTypeElement
.Descendants("xs" + "enumeration")
.Select(a => a.Attribute("value").Value);
精彩评论