Maybe I missed something, but can anyone explain to me the meaning and differences of the following properties of XmlSchemaElement
class:
- What are the differences between X
mlSchemaElement.ElementSchemaType
andXmlSchemaElement.ElementType
? - What are the differences between
QualifiedName, SchemaTypeName and RefName
? - How
QualifiedName, SchemaTypeName and RefName
are related to each other? WhenSchemaTypeName.IsEmpty == true
, does it mean thatRefName.IsEmpty == false
? - Is it possible that all
*Names
will beEmpty
, what does it mean, an embedded ComplexType?
In general I need to parse xsd and map the result to internal structure, so I need some rules, which allows me to generate different types of object. Let's say if (SchemaTypeName.IsEmpty)
then in ElementSchemaType
I have SimpleType
with all the restrictions provided.
QualifiedName represents the actual qualified name of the element, as the corresponding XML element in an XML instance document would have it. SchemaTypeName represents the name of the type given to the element (could be a built in XSD such as
int
or a user define type, such asmine
). The RefName indicates that the particle, while being an element, is actually a reference to a globally defined element elsewhere in the schema (see below)Unfortunately, not necessarily true; for e.g., if there is no type associated with the element (by default that means xsd:anyType).
Further, things get even more complicated. If you have element particles under a group that is not referenced anywhere in the XSD, then the funny part is that the PSVI properties of the element particle under that group don't get populated... I never bothered to figure out if that is a feature or a bug... What I did though was to build a visitor that is using all these properties and trying to process the one bit of information it finds... To me this approach also proved resilient to .NET fixes over the years...