System\Xml\Schema\Inference\Infer.cs (40)
197XmlSchemaElement? xse = null;
198foreach (XmlSchemaElement? elem in schemas.GlobalElements.Values)
492private XmlSchemaElement AddElement(string localName, string prefix, string? childURI, XmlSchema? parentSchema, XmlSchemaObjectCollection? addLocation, int positionWithinCollection)
499XmlSchemaElement? xse;
500XmlSchemaElement? returnedElement; //this value will change to elementReference if childURI!= parentURI
597XmlSchemaElement elementReference = new XmlSchemaElement();
632internal void InferElement(XmlSchemaElement xse, bool bCreatingNewType, XmlSchema parentSchema)
971if (((XmlSchemaSequence)ct.Particle).Items[lastUsedSeqItem].GetType() != typeof(XmlSchemaElement))
973XmlSchemaElement subElement = (XmlSchemaElement)((XmlSchemaSequence)ct.Particle).Items[lastUsedSeqItem];
994private XmlSchemaType? GetEffectiveSchemaType(XmlSchemaElement elem, bool bCreatingNewType)
1029internal XmlSchemaElement FindMatchingElement(bool bCreatingNewType, XmlReader xtr, XmlSchemaComplexType ct, ref int lastUsedSeqItem, XmlSchema? parentSchema, bool setMaxoccurs)
1050XmlSchemaElement e = AddElement(xtr.LocalName, xtr.Prefix, xtr.NamespaceURI, parentSchema, xss.Items, -1);
1059XmlSchemaElement? el = xsch.Items[i] as XmlSchemaElement;
1072XmlSchemaElement referencedElement = FindGlobalElement(childURI, xtr.LocalName, out parentSchema)!;
1078XmlSchemaElement subElement = AddElement(xtr.LocalName, xtr.Prefix, xtr.NamespaceURI, parentSchema, xsch.Items, -1);
1087XmlSchemaElement? el = particle as XmlSchemaElement;
1106XmlSchemaElement referencedElement = FindGlobalElement(childURI, xtr.LocalName, out parentSchema)!;
1117el = particle as XmlSchemaElement;
1127((XmlSchemaElement)minOccursCandidates[i]).MinOccurs = decimal.Zero;
1138((XmlSchemaElement)minOccursCandidates[i]).MinOccurs = decimal.Zero;
1140XmlSchemaElement referencedElement = FindGlobalElement(childURI, xtr.LocalName, out parentSchema)!;
1152XmlSchemaElement? subElement;
1153XmlSchemaElement? actualElement = null;
1177xsc.Items.Add(CreateNewElementforChoice((XmlSchemaElement)xss.Items[i]));
1197internal void ProcessAttributes(ref XmlSchemaElement xse, XmlSchemaType? effectiveSchemaType, bool bCreatingNewType, XmlSchema parentSchema)
1328internal XmlSchemaElement? FindGlobalElement(string? namespaceURI, string localName, out XmlSchema? parentSchema)
1331XmlSchemaElement? xse;
1346internal static XmlSchemaElement? FindElement(XmlSchemaObjectCollection elements, string elementName)
1350XmlSchemaElement? xse = elements[i] as XmlSchemaElement;
1380internal static XmlSchemaElement? FindElementRef(XmlSchemaObjectCollection elements, string elementName, string nsURI)
1384XmlSchemaElement? xse = elements[i] as XmlSchemaElement;
2383private XmlSchemaElement CreateNewElementforChoice(XmlSchemaElement copyElement)
2385XmlSchemaElement newElement = new XmlSchemaElement();
2508internal void SetMinMaxOccurs(XmlSchemaElement el, bool setMaxOccurs)
System\Xml\Schema\SchemaCollectionCompiler.cs (65)
41foreach (XmlSchemaElement? element in _schema!.Elements.Values)
84foreach (XmlSchemaElement? element in _schema.Elements.Values)
118XmlSchemaElement? element;
137else if ((element = item as XmlSchemaElement) != null)
156XmlSchemaElement? element;
175else if ((element = schema.Items[i] as XmlSchemaElement) != null)
225foreach (XmlSchemaElement? element in _schema.Elements.Values)
263foreach (XmlSchemaElement? element in _schema.Elements.Values)
281foreach (XmlSchemaElement? element in _schema!.Elements.Values)
378private static void CleanupElement(XmlSchemaElement element)
419if (particle is XmlSchemaElement)
421CleanupElement((XmlSchemaElement)particle);
437SendValidationEvent(SR.Sch_SubstitutionCircularRef, (XmlSchemaElement)substitutionGroup.Members[0]!);
441XmlSchemaElement? examplar = (XmlSchemaElement?)_schema!.Elements[substitutionGroup.Examplar];
457XmlSchemaElement element = (XmlSchemaElement)substitutionGroup.Members[i]!;
478SendValidationEvent(SR.Sch_NoExamplar, (XmlSchemaElement)substitutionGroup.Members[0]!);
485XmlSchemaElement? examplar = (XmlSchemaElement?)_schema!.Elements[substitutionGroup.Examplar];
490XmlSchemaElement? element = (XmlSchemaElement?)substitutionGroup.Members[i];
1074else if (particle is XmlSchemaElement)
1076return CanonicalizeElement((XmlSchemaElement)particle, substitution);
1100private XmlSchemaParticle CanonicalizeElement(XmlSchemaElement element, bool substitution)
1196XmlSchemaParticle p = CanonicalizeParticle((XmlSchemaElement)all.Items[i], false, substitution);
1334if (baseParticle is XmlSchemaElement)
1336if (derivedParticle is XmlSchemaElement)
1338return IsElementFromElement((XmlSchemaElement)derivedParticle, (XmlSchemaElement)baseParticle);
1347if (derivedParticle is XmlSchemaElement)
1349return IsElementFromAny((XmlSchemaElement)derivedParticle, (XmlSchemaAny)baseParticle);
1362if (derivedParticle is XmlSchemaElement)
1364return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle, true);
1377if (derivedParticle is XmlSchemaElement)
1379return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle, false);
1392if (derivedParticle is XmlSchemaElement)
1394return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle, true);
1409private static bool IsElementFromElement(XmlSchemaElement derivedElement, XmlSchemaElement baseElement)
1420private static bool IsElementFromAny(XmlSchemaElement derivedElement, XmlSchemaAny baseAny)
1456private bool IsElementFromGroupBase(XmlSchemaElement derivedElement, XmlSchemaGroupBase baseGroupBase, bool skipEmptableOnly)
1617if (particle is XmlSchemaElement || particle is XmlSchemaAny)
2177private void CompileElement(XmlSchemaElement xe)
2194XmlSchemaElement? e = (XmlSchemaElement?)_schema!.Elements[xe.RefName];
2223XmlSchemaElement? examplar = (XmlSchemaElement?)_schema!.Elements[xe.SubstitutionGroup];
2371XmlSchemaElement localElement = (XmlSchemaElement)all.Items[i];
2390if (e.Particle1 is XmlSchemaElement)
2392if (e.Particle2 is XmlSchemaElement)
2394SendValidationEvent(SR.Sch_NonDeterministic, ((XmlSchemaElement)e.Particle1).QualifiedName.ToString(), (XmlSchemaElement)e.Particle2);
2398SendValidationEvent(SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)e.Particle2!).NamespaceList!.ToString(), ((XmlSchemaElement)e.Particle1).QualifiedName.ToString(), (XmlSchemaAny)e.Particle2);
2403if (e.Particle2 is XmlSchemaElement)
2405SendValidationEvent(SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)e.Particle1!).NamespaceList!.ToString(), ((XmlSchemaElement)e.Particle2).QualifiedName.ToString(), (XmlSchemaAny)e.Particle1);
2432if (particle is XmlSchemaElement)
2434sb.Append(((XmlSchemaElement)particle).QualifiedName);
2448XmlSchemaElement localElement = (XmlSchemaElement)all.Items[i];
2514if (particle is XmlSchemaElement element)
2576if (particle is XmlSchemaElement localElement)
2585XmlSchemaElement element = (XmlSchemaElement)complexType.LocalElements[localElement.QualifiedName]!;
System\Xml\Schema\SchemaSetCompiler.cs (57)
57foreach (XmlSchemaElement? element in schema.Elements.Values)
150foreach (XmlSchemaElement? element in _elements.Values)
221foreach (XmlSchemaElement? element in _elements.Values)
262foreach (XmlSchemaElement? element in _elements.Values)
383private void CleanupElement(XmlSchemaElement element)
430XmlSchemaElement? element = particle as XmlSchemaElement;
449foreach (XmlSchemaElement? element in _elements.Values)
453XmlSchemaElement? headElement = _elements[element.SubstitutionGroup!] as XmlSchemaElement;
494SendValidationEvent(SR.Sch_SubstitutionCircularRef, (XmlSchemaElement)substitutionGroup.Members[0]!);
498XmlSchemaElement examplar = (XmlSchemaElement)_elements[substitutionGroup.Examplar]!;
517XmlSchemaElement element = (XmlSchemaElement)substitutionGroup.Members[i]!;
1147foreach (XmlSchemaElement? localElement in complexType.LocalElements.Values)
1204else if (particle is XmlSchemaElement)
1231private XmlSchemaParticle CanonicalizeElement(XmlSchemaElement element)
1245choice.Items.Add((XmlSchemaElement)substitutionGroup.Members[i]!);
1340XmlSchemaParticle p = CanonicalizeParticle((XmlSchemaElement)all.Items[i], false);
1527if (derivedParticle is XmlSchemaElement derivedElem)
1531if (baseParticle is XmlSchemaElement baseElem)
1539else if (derivedParticle is XmlSchemaElement)
1541return IsElementFromElement((XmlSchemaElement)derivedParticle, baseElem);
1551if (derivedParticle is XmlSchemaElement)
1553return IsElementFromAny((XmlSchemaElement)derivedParticle, (XmlSchemaAny)baseParticle);
1566if (derivedParticle is XmlSchemaElement)
1568return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle);
1593if (derivedParticle is XmlSchemaElement)
1595return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle);
1627if (derivedParticle is XmlSchemaElement)
1629return IsElementFromGroupBase((XmlSchemaElement)derivedParticle, (XmlSchemaGroupBase)baseParticle);
1652private bool IsElementFromElement(XmlSchemaElement derivedElement, XmlSchemaElement baseElement)
1681private bool IsElementFromAny(XmlSchemaElement derivedElement, XmlSchemaAny baseAny)
1785private bool IsElementFromGroupBase(XmlSchemaElement derivedElement, XmlSchemaGroupBase baseGroupBase)
1969if (particle is XmlSchemaElement || particle is XmlSchemaAny)
2636private void CompileElement(XmlSchemaElement xe)
2653XmlSchemaElement? e = (XmlSchemaElement?)_elements[xe.RefName];
2682XmlSchemaElement? examplar = (XmlSchemaElement?)_elements[xe.SubstitutionGroup];
2840XmlSchemaElement localElement = (XmlSchemaElement)all.Items[i];
2859if (e.Particle1 is XmlSchemaElement)
2861if (e.Particle2 is XmlSchemaElement)
2863SendValidationEvent(SR.Sch_NonDeterministic, ((XmlSchemaElement)e.Particle1).QualifiedName.ToString(), (XmlSchemaElement)e.Particle2);
2867SendValidationEvent(SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)e.Particle2!).ResolvedNamespace, ((XmlSchemaElement)e.Particle1).QualifiedName.ToString(), (XmlSchemaAny)e.Particle2);
2872if (e.Particle2 is XmlSchemaElement)
2874SendValidationEvent(SR.Sch_NonDeterministicAnyEx, ((XmlSchemaAny)e.Particle1!).ResolvedNamespace, ((XmlSchemaElement)e.Particle2).QualifiedName.ToString(), (XmlSchemaElement)e.Particle2);
2894if (particle is XmlSchemaElement element)
2958if (particle is XmlSchemaElement localElement)
2967XmlSchemaElement element = (XmlSchemaElement)complexType.LocalElements[localElement.QualifiedName]!;
2986if (particle is XmlSchemaElement localElement)
System\Xml\Serialization\XmlSchemaExporter.cs (12)
229private XmlSchemaElement? ExportElement(ElementAccessor accessor)
237XmlSchemaElement? element = (XmlSchemaElement?)_elements[accessor];
284if (item is XmlSchemaElement e)
367private void ExportElementMapping(XmlSchemaElement element, Mapping mapping, string? ns, bool isAny)
412private XmlSchemaType? ExportSpecialMapping(SpecialMapping mapping, string? ns, bool isAny, XmlSchemaElement? element)
524XmlSchemaElement schemaElement = new XmlSchemaElement();
588private void ExportArrayMapping(ArrayMapping mapping, string? ns, XmlSchemaElement? element)
814XmlSchemaElement? element = (XmlSchemaElement?)_elements[accessor];
849XmlSchemaElement refElement = new XmlSchemaElement();
959private XmlQualifiedName ExportStructMapping(StructMapping mapping, string? ns, XmlSchemaElement? element)
System\Xml\Serialization\XmlSchemaImporter.cs (35)
146XmlSchemaElement element = new XmlSchemaElement();
218XmlSchemaElement element = new XmlSchemaElement();
237XmlSchemaElement element = FindElement(name);
251private ElementAccessor ImportElement(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns, bool topLevelElement)
310private TypeMapping ImportElementType(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns)
927else if (item is XmlSchemaElement element)
929XmlSchemaElement? headElement = GetTopLevelElement(element);
932XmlSchemaElement[] elements = GetEquivalentElements(headElement);
1016else if (item is XmlSchemaElement)
1017ImportElementMember((XmlSchemaElement)item, identifier, members, membersScope, elementsScope, ns, groupRepeats, ref needExplicitOrder, allowDuplicates, allowUnboundedElements);
1031private XmlSchemaElement? GetTopLevelElement(XmlSchemaElement element)
1038private XmlSchemaElement[] GetEquivalentElements(XmlSchemaElement element)
1047if (item is XmlSchemaElement equivalentElement)
1059return (XmlSchemaElement[])equivalentElements.ToArray(typeof(XmlSchemaElement));
1063private bool ImportSubstitutionGroupMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, string? ns, bool repeats, ref bool needExplicitOrder, bool allowDuplicates)
1065XmlSchemaElement[] elements = GetEquivalentElements(element);
1208private ElementAccessor? ImportArray(XmlSchemaElement element, string identifier, string? ns, bool repeats)
1267if (item.Items.Count != 1 || !(item.Items[0] is XmlSchemaElement)) return null;
1268XmlSchemaElement itemElement = (XmlSchemaElement)item.Items[0];
1298private bool IsCyclicReferencedType(XmlSchemaElement element, List<string> identifiers)
1302XmlSchemaElement refElement = FindElement(element.RefName);
1317if ((items.Particle is XmlSchemaSequence || items.Particle is XmlSchemaAll) && items.Particle.Items.Count == 1 && items.Particle.Items[0] is XmlSchemaElement)
1319XmlSchemaElement innerRefElement = (XmlSchemaElement)items.Particle.Items[0];
1371private void ImportElementMember(XmlSchemaElement element, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string? ns, bool repeats, ref bool needExplicitOrder, bool allowDuplicates, bool allowUnboundedElements)
1374XmlSchemaElement? headElement = GetTopLevelElement(element);
1922private XmlSchemaElement FindElement(XmlQualifiedName name)
1924XmlSchemaElement? element = (XmlSchemaElement?)Schemas.Find(name, typeof(XmlSchemaElement));
1939private static XmlSchemaForm ElementForm(string? ns, XmlSchemaElement element)