Ejemplo n.º 1
0
        private Element ProcessElement(XmlSchemaElement schemaElement, Element parent)
        {
            var element = new Element
            {
                Name          = schemaElement.Name,
                Type          = schemaElement.ElementType == null ? "" : schemaElement.ElementType.GetType().Name,
                MinOccurs     = schemaElement.MinOccurs,
                MaxOccurs     = FixMaxOccurs(schemaElement, parent == null ? "" : parent.Name),
                Documentation = GetDocumentation(schemaElement.Annotation, schemaElement.Name),
                RootObject    = "Xsd",
                RootElement   = SpecialCaseHandlers.RootElement(parent)
            };

            element.IsAdvanced    = SpecialCaseHandlers.IsAdvanced(element, parent);
            element.SpecialLength = SpecialCaseHandlers.SpecialLength(element, parent);
            element.Parent        = parent ?? FillOutRootElement(element);

            if (schemaElement.SchemaType != null)
            {
                ProcessChildren(schemaElement, element);
            }

            if (parent != null)
            {
                parent.Elements.Add(element);
                return(null);
            }
            else
            {
                return(element);
            }

            //will break if moved about the Process* calls.
            //Need access to parent for those functions to get errorCollector.attributes.* working
            //FillOutRootElement(parent, element);

            //XmlSchemaType schemaType = configurationElement.SchemaType;
            //XmlSchemaComplexType schemaComplexType = schemaType as XmlSchemaComplexType;
            //XmlSchemaSimpleType schemaSimpleType = schemaType as XmlSchemaSimpleType;
        }
Ejemplo n.º 2
0
 public void RootElement_False()
 {
     Assert.IsFalse(SpecialCaseHandlers.RootElement(TestPart("proxy")));
 }
Ejemplo n.º 3
0
 public void RootElement_True()
 {
     Assert.IsTrue(SpecialCaseHandlers.RootElement(TestPart("service")));
 }