static void Main(string[] args) { XDocument doc = XDocument.Load(FILENAME); XElement root = doc.Root; XNamespace ns = root.GetNamespaceOfPrefix("xs"); Element element = new Element(null, root, ns, null); SimpleContent.LinkParents(); Element.LinkParents(); }
public SchemaType(XElement schemaType, XNamespace ns, Element parentElement) { simpleComplex = schemaType.Name.LocalName; foreach (XElement child in schemaType.Elements()) { switch (child.Name.LocalName) { case "annotation": annotation = (string)child.Element(ns + "documentation"); break; case "attribute": Attribute newAttribute = new Attribute(child, ns, parentElement); if (attributes == null) { attributes = new List <Attribute>(); } attributes.Add(newAttribute); break; case "restriction": restriction = new Restrictions(child, ns); break; case "sequence": elements = child.Elements(ns + "element").Select(x => new Element(this, child, ns, parentElement)).ToList(); break; case "simpleContent": simpleContent = new SimpleContent(child, ns, parentElement); break; default: break; } } }