本文整理汇总了C#中System.Xml.Schema.XmlSchemaChoice.Compile方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaChoice.Compile方法的具体用法?C# XmlSchemaChoice.Compile怎么用?C# XmlSchemaChoice.Compile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaChoice
的用法示例。
在下文中一共展示了XmlSchemaChoice.Compile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOptimizedParticle
// FIXME: Return clone in case when it returns itself
internal override XmlSchemaParticle GetOptimizedParticle (bool isTop)
{
if (OptimizedParticle != null)
return OptimizedParticle;
if (RefName != null && RefName != XmlQualifiedName.Empty) {
referencedElement = schema.FindElement (RefName);
}
// if (this.referencedElement != null)
// OptimizedParticle = referencedElement.GetOptimizedParticle (isTop);
// else
if (ValidatedMaxOccurs == 0)
OptimizedParticle = XmlSchemaParticle.Empty;
// Substitution Group
else if (SubstitutingElements != null && SubstitutingElements.Count > 0) {
XmlSchemaChoice choice = new XmlSchemaChoice ();
choice.MinOccurs = MinOccurs;
choice.MaxOccurs = MaxOccurs;
// substChoice = choice;
choice.Compile (null, schema); // compute Validated Min/Max Occurs.
XmlSchemaElement item = this.MemberwiseClone () as XmlSchemaElement;
item.MinOccurs = 1;
item.MaxOccurs = 1;
item.substitutionGroupElement = null;
item.substitutingElements = null;
for (int i = 0; i < SubstitutingElements.Count; i++) {
XmlSchemaElement se = SubstitutingElements [i] as XmlSchemaElement;
// choice.Items.Add (se);
// choice.CompiledItems.Add (se);
this.AddSubstElementRecursively (choice.Items, se);
this.AddSubstElementRecursively (choice.CompiledItems, se);
}
if (!choice.Items.Contains (item)) {
choice.Items.Add (item);
choice.CompiledItems.Add (item);
}
OptimizedParticle = choice;
}
else
OptimizedParticle = this;//.MemberwiseClone () as XmlSchemaElement;
return OptimizedParticle;
}