本文整理汇总了C#中System.Xml.Schema.XmlSchemaComplexType.ContainsName方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaComplexType.ContainsName方法的具体用法?C# XmlSchemaComplexType.ContainsName怎么用?C# XmlSchemaComplexType.ContainsName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaComplexType
的用法示例。
在下文中一共展示了XmlSchemaComplexType.ContainsName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TraverseParticle
private void TraverseParticle(XmlSchemaParticle particle, XmlSchemaComplexType baseType, ClrContentTypeInfo typeInfo, XmlSchemaDerivationMethod derivationMethod)
{
if (particleStack == null)
{
particleStack = new Stack<ParticleData>();
}
else
{
particleStack.Clear();
}
if (propertyNameTypeTable == null)
{
propertyNameTypeTable = new Dictionary<string, ClrPropertyInfo>();
}
else
{
propertyNameTypeTable.Clear();
}
XmlSchemaParticle baseParticle = baseType.ContentTypeParticle;
ParticleData particleData;
GroupingInfo parentGroupInfo = null;
StringBuilder regEx = new StringBuilder();
XmlSchemaGroupBase currentGroupBase = null;
GroupingInfo currentGroupingInfo = null;
int currentIndex = 0;
while (true)
{
// dont interrogate a particle if we are past the end of the list
if (currentGroupBase == null || currentIndex <= currentGroupBase.Items.Count)
{
ParticleType particleType = particle.GetParticleType();
switch (particleType)
{
case ParticleType.Element:
{
XmlSchemaElement elem = particle as XmlSchemaElement;
ClrPropertyInfo propertyInfo = null;
bool fromBaseType = false;
if (derivationMethod == XmlSchemaDerivationMethod.Extension && typeInfo.IsDerived)
{
if (baseParticle.ContainsElement(elem))
{
fromBaseType = true;
}
else if (!typeInfo.InlineBaseType && baseType.ContainsName(elem.QualifiedName))
{
typeInfo.InlineBaseType = true;
}
}
propertyInfo = BuildProperty(elem, fromBaseType);
regEx.Append(propertyInfo.PropertyName);
AppendOccurenceToRegex(propertyInfo, regEx);
//Add to parent
if (currentGroupingInfo == null)
{
//Not adding property to propertyNameTypeTable as this case will occur only for pointless groups, so they have just one property
BuildAnnotationInformation(propertyInfo, elem, false, false);
typeInfo.AddMember(propertyInfo);
}
else
{
BuildAnnotationInformation(propertyInfo, elem, currentGroupingInfo.ContentModelType == ContentModelType.Choice, currentGroupingInfo.IsNested);
currentGroupingInfo.AddChild(propertyInfo);
SetPropertyFlags(propertyInfo, currentGroupingInfo, elem.ElementSchemaType);
}
break;
}
case ParticleType.Any:
{
regEx.Append("any");
XmlSchemaAny any = particle as XmlSchemaAny;
if (derivationMethod == XmlSchemaDerivationMethod.Extension && typeInfo.IsDerived)
{
if (baseParticle.ContainsWildCard(any))
{
typeInfo.HasElementWildCard = true;//ANY property in the base type will be reused
}
}
//Note we always create a property info object to keep the original nesting structure in the schema
//so it can be used to create a correct FSM; on the other hand, typeInfo.HasElementWildCard will indicate whether
//we need to create a property in the resulting object type.
ClrWildCardPropertyInfo wcPropertyInfo = BuildAnyProperty(any, !typeInfo.HasElementWildCard);
//Add to parent
if (currentGroupingInfo == null)
{
typeInfo.AddMember(wcPropertyInfo);
}
else
{
currentGroupingInfo.AddChild(wcPropertyInfo);
//.........这里部分代码省略.........