Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CannonicalizeChoice()

XmlSchemaParticle System.Xml.Schema.SchemaCollectionCompiler.CannonicalizeChoice ( XmlSchemaChoice choice,
bool root,
bool substitution )
inlineprivate

Definition at line 1118 of file SchemaCollectionCompiler.cs.

1119 {
1120 XmlSchemaChoice source = choice;
1121 if (choice.Items.Count > 0)
1122 {
1123 XmlSchemaChoice xmlSchemaChoice = new XmlSchemaChoice();
1126 for (int i = 0; i < choice.Items.Count; i++)
1127 {
1128 XmlSchemaParticle xmlSchemaParticle = CannonicalizeParticle((XmlSchemaParticle)choice.Items[i], root: false, substitution);
1129 if (xmlSchemaParticle == XmlSchemaParticle.Empty)
1130 {
1131 continue;
1132 }
1133 if (xmlSchemaParticle.MinOccurs == 1m && xmlSchemaParticle.MaxOccurs == 1m && xmlSchemaParticle is XmlSchemaChoice)
1134 {
1135 XmlSchemaChoice xmlSchemaChoice2 = (XmlSchemaChoice)xmlSchemaParticle;
1136 for (int j = 0; j < xmlSchemaChoice2.Items.Count; j++)
1137 {
1138 xmlSchemaChoice.Items.Add(xmlSchemaChoice2.Items[j]);
1139 }
1140 }
1141 else
1142 {
1144 }
1145 }
1147 }
1148 if (!root && choice.Items.Count == 0)
1149 {
1150 if (choice.MinOccurs != 0m)
1151 {
1153 }
1154 return XmlSchemaParticle.Empty;
1155 }
1156 if (!root && choice.Items.Count == 1 && choice.MinOccurs == 1m && choice.MaxOccurs == 1m)
1157 {
1158 return (XmlSchemaParticle)choice.Items[0];
1159 }
1160 return choice;
1161 }
void Add(TKey key, TValue value)
static string Sch_EmptyChoice
Definition SR.cs:1142
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
XmlSchemaParticle CannonicalizeParticle(XmlSchemaParticle particle, bool root, bool substitution)

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.Schema.SchemaCollectionCompiler.CannonicalizeParticle(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Schema.XmlSchemaParticle.Empty, System.SR.Sch_EmptyChoice, System.Xml.Schema.BaseProcessor.SendValidationEvent(), and System.source.

Referenced by System.Xml.Schema.SchemaCollectionCompiler.CannonicalizeParticle().