private XElement CreateSchemaElementElement(IXmlElementInfo[] elements, IXmlElementInfo element, IXmlComponentInfo[] components, string group) { var xmlElement = CreateSchemaElement(element.Name, out var complexType); var chooseGroup = new XElement(SchemaNamespace + "choice", new XAttribute("minOccurs", "0"), new XAttribute("maxOccurs", "unbounded")); complexType.Add(chooseGroup); foreach (var component in components) { var name = GetComponentName(element, component); chooseGroup.Add(new XElement(SchemaNamespace + "element", new XAttribute("ref", name))); } if (element.SupportsChildren) { chooseGroup.Add(new XElement(SchemaNamespace + "group", new XAttribute("ref", group), new XAttribute("minOccurs", "0"), new XAttribute("maxOccurs", "unbounded"))); } AddAttributeReferences(elements, components, complexType, element.Attributes); return(xmlElement); }
private void RegisterElement(IXmlElementInfo info) { elementTypes[info.Name] = info; }
protected void AddElement(IXmlElementInfo info) { elementsList.Add(info); }
private XElement CreateSchemaComponentSubstitutionElement(IXmlElementInfo element, IXmlComponentInfo component) { return(new XElement(SchemaNamespace + "element", new XAttribute("name", GetComponentName(element, component)), new XAttribute("substitutionGroup", GetBaseComponentName(component.Name)))); }
private string GetComponentName(IXmlElementInfo element, IXmlComponentInfo component) { return(element.Name + "." + component.Name); }