public CustomSchemaReader(XmlDocument xmlDocument) { Items = new List <object>(); Includes = new List <Include>(); reader = new XmlNodeReader(xmlDocument); reader.MoveToSchemaRoot(); NamespaceTable = reader.ParseSchemaHeader(); while (CheckToSkip(reader)) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "xsd:element": { Element element = reader.ParseElement(); Items.Add(element); break; } case "xsd:complexType": { ComplexType newComplexType = reader.ParseComplexType(); Items.Add(newComplexType); this.Skip = true; break; } case "xsd:include": { Include include = reader.ParseInclude(); Includes.Add(include); break; } } } } }