How to determine the declaring type of an XmlSchemaElement

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im writing a code generator tool that takes an Xsd schema as input. The Xsd schema contains types with inheritance.
My generator tool needs to distinguish XmlSchemaElements that are defined in a sub type and that are defined somewhere in a base type.
If I iterate over the elements like this:

<div style="color:Black;background-color:White; <pre>
XmlSchemaComplexType complexType = <some complex type>
<span style="color:Blue; var <span style="color:Blue; group = (XmlSchemaGroupBase)complexType.ContentTypeParticle;
<span style="color:Blue; var elements = <span style="color:Blue; group.Items.OfType<XmlSchemaElement>();
<span style="color:Blue; foreach(<span style="color:Blue; var element <span style="color:Blue; in elements)
{
}

[/code]

then the list of elements is just a flat list of all elements defined in the sub type and in all its base types.
How can I distinguish between local defined elements and elements defined in base types?

View the full article
 
Back
Top