本文整理汇总了C#中System.Xml.Schema.XmlSchemaAny.BuildNamespaceList方法的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAny.BuildNamespaceList方法的具体用法?C# XmlSchemaAny.BuildNamespaceList怎么用?C# XmlSchemaAny.BuildNamespaceList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Schema.XmlSchemaAny
的用法示例。
在下文中一共展示了XmlSchemaAny.BuildNamespaceList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAnyType
private static XmlSchemaComplexType CreateAnyType(XmlSchemaContentProcessing processContents)
{
XmlSchemaComplexType localAnyType = new XmlSchemaComplexType();
localAnyType.SetQualifiedName(DatatypeImplementation.QnAnyType);
XmlSchemaAny anyElement = new XmlSchemaAny();
anyElement.MinOccurs = decimal.Zero;
anyElement.MaxOccurs = decimal.MaxValue;
anyElement.ProcessContents = processContents;
anyElement.BuildNamespaceList(null);
XmlSchemaSequence seq = new XmlSchemaSequence();
seq.Items.Add(anyElement);
localAnyType.SetContentTypeParticle(seq);
localAnyType.SetContentType(XmlSchemaContentType.Mixed);
localAnyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
localAnyType.ElementDecl.SchemaType = localAnyType;
//Create contentValidator for Any
ParticleContentValidator contentValidator = new ParticleContentValidator(XmlSchemaContentType.Mixed);
contentValidator.Start();
contentValidator.OpenGroup();
contentValidator.AddNamespaceList(anyElement.NamespaceList, anyElement);
contentValidator.AddStar();
contentValidator.CloseGroup();
ContentValidator anyContentValidator = contentValidator.Finish(true);
localAnyType.ElementDecl.ContentValidator = anyContentValidator;
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.ProcessContents = processContents;
anyAttribute.BuildNamespaceList(null);
localAnyType.SetAttributeWildcard(anyAttribute);
localAnyType.ElementDecl.AnyAttribute = anyAttribute;
return localAnyType;
}
示例2: CreateAnyType
private static XmlSchemaComplexType CreateAnyType(XmlSchemaContentProcessing processContents)
{
XmlSchemaComplexType type = new XmlSchemaComplexType();
type.SetQualifiedName(DatatypeImplementation.QnAnyType);
XmlSchemaAny item = new XmlSchemaAny {
MinOccurs = 0M,
MaxOccurs = 79228162514264337593543950335M,
ProcessContents = processContents
};
item.BuildNamespaceList(null);
XmlSchemaSequence sequence = new XmlSchemaSequence();
sequence.Items.Add(item);
type.SetContentTypeParticle(sequence);
type.SetContentType(XmlSchemaContentType.Mixed);
type.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
type.ElementDecl.SchemaType = type;
ParticleContentValidator validator = new ParticleContentValidator(XmlSchemaContentType.Mixed);
validator.Start();
validator.OpenGroup();
validator.AddNamespaceList(item.NamespaceList, item);
validator.AddStar();
validator.CloseGroup();
ContentValidator validator2 = validator.Finish(true);
type.ElementDecl.ContentValidator = validator2;
XmlSchemaAnyAttribute attribute = new XmlSchemaAnyAttribute {
ProcessContents = processContents
};
attribute.BuildNamespaceList(null);
type.SetAttributeWildcard(attribute);
type.ElementDecl.AnyAttribute = attribute;
return type;
}