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

◆ CannonicalizeChoice()

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

Definition at line 1237 of file Compiler.cs.

1238 {
1239 XmlSchemaChoice source = choice;
1240 if (choice.Items.Count > 0)
1241 {
1242 XmlSchemaChoice xmlSchemaChoice = new XmlSchemaChoice();
1246 for (int i = 0; i < choice.Items.Count; i++)
1247 {
1248 XmlSchemaParticle xmlSchemaParticle = CannonicalizeParticle((XmlSchemaParticle)choice.Items[i], root: false);
1249 if (xmlSchemaParticle == XmlSchemaParticle.Empty)
1250 {
1251 continue;
1252 }
1253 if (xmlSchemaParticle.MinOccurs == 1m && xmlSchemaParticle.MaxOccurs == 1m && xmlSchemaParticle is XmlSchemaChoice)
1254 {
1255 XmlSchemaChoice xmlSchemaChoice2 = xmlSchemaParticle as XmlSchemaChoice;
1256 for (int j = 0; j < xmlSchemaChoice2.Items.Count; j++)
1257 {
1258 xmlSchemaChoice.Items.Add(xmlSchemaChoice2.Items[j]);
1259 }
1260 }
1261 else
1262 {
1264 }
1265 }
1267 }
1268 if (!root && choice.Items.Count == 0)
1269 {
1270 if (choice.MinOccurs != 0m)
1271 {
1273 }
1274 return XmlSchemaParticle.Empty;
1275 }
1276 if (!root && choice.Items.Count == 1 && choice.MinOccurs == 1m && choice.MaxOccurs == 1m)
1277 {
1278 return (XmlSchemaParticle)choice.Items[0];
1279 }
1280 return choice;
1281 }
void Add(TKey key, TValue value)
static string Sch_EmptyChoice
Definition SR.cs:1142
Definition SR.cs:7
void SendValidationEvent(string code, XmlSchemaObject source)
void CopyPosition(XmlSchemaAnnotated to, XmlSchemaAnnotated from, bool copyParent)
Definition Compiler.cs:2758
XmlSchemaParticle CannonicalizeParticle(XmlSchemaParticle particle, bool root)
Definition Compiler.cs:1106

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.Schema.Compiler.CannonicalizeParticle(), System.Xml.Schema.Compiler.CopyPosition(), 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.Compiler.CannonicalizeParticle().