本文整理汇总了C#中System.Xml.Schema.XmlSchemaAny类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAny类的具体用法?C# XmlSchemaAny怎么用?C# XmlSchemaAny使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaAny类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaAny类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AndSchema
public static XmlSchemaElement AndSchema()
{
var type = new XmlSchemaComplexType();
var any = new XmlSchemaAny();
any.MinOccurs = 1;
any.MaxOccursString = "unbounded";
any.ProcessContents = XmlSchemaContentProcessing.Strict;
any.Namespace = "##local";
var sequence = new XmlSchemaSequence();
type.Particle = sequence;
sequence.Items.Add(any);
var attrib = new XmlSchemaAttribute();
attrib.Name = "expressionLanguage";
attrib.Use = XmlSchemaUse.Optional;
attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
type.Attributes.Add(attrib);
attrib = new XmlSchemaAttribute();
attrib.Name = "failMessage";
attrib.Use = XmlSchemaUse.Optional;
attrib.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
type.Attributes.Add(attrib);
var element = new XmlSchemaElement();
element.Name = "and";
element.SchemaType = type;
return element;
}
示例2: Visit
protected override void Visit(XmlSchemaAny particle)
{
if (particle.MaxOccurs == 0)
return;
PushNode(ChildType.Any, particle.Parent, particle);
foreach (XmlSchemaElement extensionElement in _schemaSetManager.GetExtensionElements(particle))
AddLeaf(ChildType.ElementExtension, particle, extensionElement);
PopNode();
}
示例3: ImportAnyElement
public virtual string ImportAnyElement (
XmlSchemaAny any,
bool mixed,
XmlSchemas schemas,
XmlSchemaImporter importer,
CodeCompileUnit compileUnit,
CodeNamespace mainNamespace,
CodeGenerationOptions options,
CodeDomProvider codeProvider
)
{
return null;
}
示例4: AddDefaultDatasetType
private static void AddDefaultDatasetType(XmlSchemaSet schemas, string localName, string ns)
{
XmlSchemaComplexType item = new XmlSchemaComplexType {
Name = localName,
Particle = new XmlSchemaSequence()
};
XmlSchemaElement element = new XmlSchemaElement {
RefName = new XmlQualifiedName("schema", "http://www.w3.org/2001/XMLSchema")
};
((XmlSchemaSequence) item.Particle).Items.Add(element);
XmlSchemaAny any = new XmlSchemaAny();
((XmlSchemaSequence) item.Particle).Items.Add(any);
XmlSchema schema = SchemaHelper.GetSchema(ns, schemas);
schema.Items.Add(item);
schemas.Reprocess(schema);
}
示例5: AddDefaultTypedDatasetType
private static void AddDefaultTypedDatasetType(XmlSchemaSet schemas, XmlSchema datasetSchema, string localName, string ns)
{
XmlSchemaComplexType item = new XmlSchemaComplexType {
Name = localName,
Particle = new XmlSchemaSequence()
};
XmlSchemaAny any = new XmlSchemaAny {
Namespace = (datasetSchema.TargetNamespace == null) ? string.Empty : datasetSchema.TargetNamespace
};
((XmlSchemaSequence) item.Particle).Items.Add(any);
schemas.Add(datasetSchema);
XmlSchema schema = SchemaHelper.GetSchema(ns, schemas);
schema.Items.Add(item);
schemas.Reprocess(datasetSchema);
schemas.Reprocess(schema);
}
示例6: 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;
}
示例7: GetSchema
public XmlSchema GetSchema ()
{
XmlSchema s = new XmlSchema ();
s.TargetNamespace = "http://www.go-mono.org/schemas";
s.Id = "monoschema";
XmlSchemaElement e = new XmlSchemaElement ();
e.Name = "data";
s.Items.Add (e);
XmlSchemaComplexType cs = new XmlSchemaComplexType ();
XmlSchemaSequence seq = new XmlSchemaSequence ();
XmlSchemaAny any = new XmlSchemaAny ();
any.MinOccurs = 0;
any.MaxOccurs = decimal.MaxValue;
seq.Items.Add (any);
cs.Particle = seq;
e.SchemaType = cs;
return s;
}
示例8: IsGroupBaseFromAny
private bool IsGroupBaseFromAny(XmlSchemaGroupBase derivedGroupBase, XmlSchemaAny baseAny)
{
decimal num;
decimal num2;
this.CalculateEffectiveTotalRange(derivedGroupBase, out num, out num2);
if (!this.IsValidOccurrenceRangeRestriction(num, num2, baseAny.MinOccurs, baseAny.MaxOccurs))
{
return false;
}
string minOccursString = baseAny.MinOccursString;
baseAny.MinOccurs = 0M;
for (int i = 0; i < derivedGroupBase.Items.Count; i++)
{
if (!this.IsValidRestriction((XmlSchemaParticle) derivedGroupBase.Items[i], baseAny))
{
baseAny.MinOccursString = minOccursString;
return false;
}
}
baseAny.MinOccursString = minOccursString;
return true;
}
示例9: IsAnyFromAny
private bool IsAnyFromAny(XmlSchemaAny derivedAny, XmlSchemaAny baseAny)
{
return (this.IsValidOccurrenceRangeRestriction(derivedAny, baseAny) && NamespaceList.IsSubset(derivedAny.NamespaceList, baseAny.NamespaceList));
}
示例10: SetContainer
private void SetContainer(State state, object container) {
switch (state) {
case State.Root:
break;
case State.Schema:
break;
case State.Annotation:
this.annotation = (XmlSchemaAnnotation)container;
break;
case State.Include:
this.include = (XmlSchemaInclude)container;
break;
case State.Import:
this.import = (XmlSchemaImport)container;
break;
case State.Element:
this.element = (XmlSchemaElement)container;
break;
case State.Attribute:
this.attribute = (XmlSchemaAttribute)container;
break;
case State.AttributeGroup:
this.attributeGroup = (XmlSchemaAttributeGroup)container;
break;
case State.AttributeGroupRef:
this.attributeGroupRef = (XmlSchemaAttributeGroupRef)container;
break;
case State.AnyAttribute:
this.anyAttribute = (XmlSchemaAnyAttribute)container;
break;
case State.Group:
this.group = (XmlSchemaGroup)container;
break;
case State.GroupRef:
this.groupRef = (XmlSchemaGroupRef)container;
break;
case State.All:
this.all = (XmlSchemaAll)container;
break;
case State.Choice:
this.choice = (XmlSchemaChoice)container;
break;
case State.Sequence:
this.sequence = (XmlSchemaSequence)container;
break;
case State.Any:
this.anyElement = (XmlSchemaAny)container;
break;
case State.Notation:
this.notation = (XmlSchemaNotation)container;
break;
case State.SimpleType:
this.simpleType = (XmlSchemaSimpleType)container;
break;
case State.ComplexType:
this.complexType = (XmlSchemaComplexType)container;
break;
case State.ComplexContent:
this.complexContent = (XmlSchemaComplexContent)container;
break;
case State.ComplexContentExtension:
this.complexContentExtension = (XmlSchemaComplexContentExtension)container;
break;
case State.ComplexContentRestriction:
this.complexContentRestriction = (XmlSchemaComplexContentRestriction)container;
break;
case State.SimpleContent:
this.simpleContent = (XmlSchemaSimpleContent)container;
break;
case State.SimpleContentExtension:
this.simpleContentExtension = (XmlSchemaSimpleContentExtension)container;
break;
case State.SimpleContentRestriction:
this.simpleContentRestriction = (XmlSchemaSimpleContentRestriction)container;
break;
case State.SimpleTypeUnion:
this.simpleTypeUnion = (XmlSchemaSimpleTypeUnion)container;
break;
case State.SimpleTypeList:
this.simpleTypeList = (XmlSchemaSimpleTypeList)container;
break;
case State.SimpleTypeRestriction:
this.simpleTypeRestriction = (XmlSchemaSimpleTypeRestriction)container;
break;
case State.Unique:
case State.Key:
case State.KeyRef:
this.identityConstraint = (XmlSchemaIdentityConstraint)container;
break;
case State.Selector:
case State.Field:
this.xpath = (XmlSchemaXPath)container;
break;
case State.MinExclusive:
case State.MinInclusive:
case State.MaxExclusive:
case State.MaxInclusive:
case State.TotalDigits:
case State.FractionDigits:
case State.Length:
//.........这里部分代码省略.........
示例11: GetTypedDataSetSchema
public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
{
DsNpStat stat = new DsNpStat();
XmlSchemaComplexType type = new XmlSchemaComplexType();
XmlSchemaSequence sequence = new XmlSchemaSequence();
xs.Add(stat.GetSchemaSerializable());
XmlSchemaAny item = new XmlSchemaAny {
Namespace = stat.Namespace
};
sequence.Items.Add(item);
type.Particle = sequence;
return type;
}
示例12: IsAnyFromAny
private bool IsAnyFromAny(XmlSchemaAny derivedAny, XmlSchemaAny baseAny) {
if (!IsValidOccurrenceRangeRestriction(derivedAny, baseAny)) {
restrictionErrorMsg = Res.GetString(Res.Sch_AnyFromAnyRule1);
return false;
}
if (!NamespaceList.IsSubset(derivedAny.NamespaceList, baseAny.NamespaceList)) {
restrictionErrorMsg = Res.GetString(Res.Sch_AnyFromAnyRule2);
return false;
}
if ((int)derivedAny.ProcessContentsCorrect < (int)baseAny.ProcessContentsCorrect) {
restrictionErrorMsg = Res.GetString(Res.Sch_AnyFromAnyRule3);
return false;
}
return true;
}
示例13: AddProbeType
static void AddProbeType(DiscoveryVersion discoveryVersion, XmlSchema schema)
{
// <xs:complexType name="ProbeType">
XmlSchemaComplexType probeType = new XmlSchemaComplexType();
probeType.Name = ProtocolStrings.SchemaNames.ProbeType;
// <xs:sequence>
XmlSchemaSequence probeTypeSequence = new XmlSchemaSequence();
// <xs:element ref="tns:Types" minOccurs="0" />
XmlSchemaElement typesElement = new XmlSchemaElement();
typesElement.RefName = discoveryVersion.Implementation.QualifiedNames.TypesElement;
typesElement.MinOccurs = 0;
// <xs:element ref="tns:Scopes" minOccurs="0" />
XmlSchemaElement scopesElement = new XmlSchemaElement();
scopesElement.RefName = discoveryVersion.Implementation.QualifiedNames.ScopesElement;
scopesElement.MinOccurs = 0;
// <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
XmlSchemaAny any = new XmlSchemaAny();
any.Namespace = "##other";
any.ProcessContents = XmlSchemaContentProcessing.Lax;
any.MinOccurs = 0;
any.MaxOccurs = decimal.MaxValue;
// </xs:sequence>
probeTypeSequence.Items.Add(typesElement);
probeTypeSequence.Items.Add(scopesElement);
probeTypeSequence.Items.Add(any);
// <xs:anyAttribute namespace="##other" processContents="lax" />
XmlSchemaAnyAttribute anyAttribue = new XmlSchemaAnyAttribute();
anyAttribue.Namespace = "##other";
anyAttribue.ProcessContents = XmlSchemaContentProcessing.Lax;
// </xs:complexType>
probeType.Particle = probeTypeSequence;
probeType.AnyAttribute = anyAttribue;
schema.Items.Add(probeType);
}
示例14: AddProbeMatchType
static void AddProbeMatchType(DiscoveryVersion discoveryVersion, XmlSchema schema)
{
// <xs:complexType name="ProbeMatchType">
XmlSchemaComplexType probeMatchType = new XmlSchemaComplexType();
probeMatchType.Name = ProtocolStrings.SchemaNames.ProbeMatchType;
// <xs:sequence>
XmlSchemaSequence probeMatcheSequence = new XmlSchemaSequence();
// <xs:element ref="wsa:EndpointReference" />
XmlSchemaElement eprElement = new XmlSchemaElement();
eprElement.RefName = discoveryVersion.Implementation.QualifiedNames.EprElement;
// <xs:element minOccurs="0" ref="tns:Types" />
XmlSchemaElement typesElement = new XmlSchemaElement();
typesElement.RefName = discoveryVersion.Implementation.QualifiedNames.TypesElement;
typesElement.MinOccurs = 0;
// <xs:element minOccurs="0" ref="tns:Scopes" />
XmlSchemaElement scopesElement = new XmlSchemaElement();
scopesElement.RefName = discoveryVersion.Implementation.QualifiedNames.ScopesElement;
scopesElement.MinOccurs = 0;
// <xs:element minOccurs="0" ref="tns:XAddrs" />
XmlSchemaElement xAddrsElement = new XmlSchemaElement();
xAddrsElement.RefName = discoveryVersion.Implementation.QualifiedNames.XAddrsElement;
xAddrsElement.MinOccurs = 0;
// <xs:element ref="tns:MetadataVersion" /> -- allowing minOccurs=0 because the same type is used for Bye messages
XmlSchemaElement metadataVersionElement = new XmlSchemaElement();
metadataVersionElement.RefName = discoveryVersion.Implementation.QualifiedNames.MetadataVersionElement;
metadataVersionElement.MinOccurs = 0;
// <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" />
XmlSchemaAny any = new XmlSchemaAny();
any.Namespace = "##other";
any.ProcessContents = XmlSchemaContentProcessing.Lax;
any.MinOccurs = 0;
any.MaxOccurs = decimal.MaxValue;
// </xs:sequence>
probeMatcheSequence.Items.Add(eprElement);
probeMatcheSequence.Items.Add(typesElement);
probeMatcheSequence.Items.Add(scopesElement);
probeMatcheSequence.Items.Add(xAddrsElement);
probeMatcheSequence.Items.Add(metadataVersionElement);
probeMatcheSequence.Items.Add(any);
// <xs:anyAttribute namespace="##other" processContents="lax" />
XmlSchemaAnyAttribute anyAttribue = new XmlSchemaAnyAttribute();
anyAttribue.Namespace = "##other";
anyAttribue.ProcessContents = XmlSchemaContentProcessing.Lax;
// </xs:complexType>
probeMatchType.Particle = probeMatcheSequence;
probeMatchType.AnyAttribute = anyAttribue;
schema.Items.Add(probeMatchType);
}
示例15: AddResolveType
static void AddResolveType(DiscoveryVersion discoveryVersion, XmlSchema schema)
{
//<xs:complexType name="ResolveType" >
XmlSchemaComplexType resolveType = new XmlSchemaComplexType();
resolveType.Name = ProtocolStrings.SchemaNames.ResolveType;
// <xs:sequence>
XmlSchemaSequence resolveSequence = new XmlSchemaSequence();
// <xs:element ref="wsa:EndpointReference" />
XmlSchemaElement eprElement = new XmlSchemaElement();
eprElement.RefName = discoveryVersion.Implementation.QualifiedNames.EprElement;
// <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" />
XmlSchemaAny any = new XmlSchemaAny();
any.Namespace = "##other";
any.ProcessContents = XmlSchemaContentProcessing.Lax;
any.MinOccurs = 0;
any.MaxOccurs = decimal.MaxValue;
resolveSequence.Items.Add(eprElement);
resolveSequence.Items.Add(any);
// <xs:anyAttribute namespace="##other" processContents="lax" />
XmlSchemaAnyAttribute anyAttribue = new XmlSchemaAnyAttribute();
anyAttribue.Namespace = "##other";
anyAttribue.ProcessContents = XmlSchemaContentProcessing.Lax;
// </xs:complexType>
resolveType.Particle = resolveSequence;
resolveType.AnyAttribute = anyAttribue;
schema.Items.Add(resolveType);
}