开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜