EDN Admin
Well-known member
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
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