|
My mistake, the LocalElements property is not available in Version 1 of the .NET Framework.
Try the following sample instead:
foreach (XmlSchemaElement parentElement in schema.Elements.Values) {
XmlSchemaComplexType ct = parentElement.ElementType as XmlSchemaComplexType; //Casting to complex type
if (ct != null) {
XmlSchemaSequence seq = (XmlSchemaSequence)ct.ContentTypeParticle; //Assuming it’s a sequence of elements
foreach(XmlSchemaParticle p in seq.Items) {
XmlSchemaElement elem = p as XmlSchemaElement; //Check if particle in seq is XmlSchemaElement
if (elem != null)
Console.WriteLine(elem.QualifiedName.ToString());
}
}
Thanks,
Priya
|