How can one get a list of enumeration values for a given element in an
XML schema? I have been looking at the Schema Object Model, but I'm
making very little headway. Can anyone give me a nudge in the right
direction?
Specifically, I am using Actions Pane to assist in creating a WordML
document. For elements with enumerated values, I want to provide the
user with the list of valid values from the schema. For example, if I
have an element defined like this:
<xs:element name="distribtype">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="A"/>
<xs:enumeration value="B"/>
<xs:enumeration value="C"/>
<xs:enumeration value="D"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I want to show the user a ComboBox containing only those values.
Warning, confused rambling ahead:
I think I might be able to figure out how to use XmlSchema.SchemaTypes
to get part of the way, but only if the schema uses named types (which
it doesn't). It looks like I may have to dig through the Items
collection of the XmlSchema, although I haven't found any way to look
for a specific element yet. Even then, I'm still not sure how to dig
all the way down to the facets and find out what the possible values
are.
Thanks,
Jon