tags:

views:

20

answers:

1

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="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!

+1  A: 

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);
Nick Miller