本文整理汇总了C#中System.Xml.Schema.XmlSchemaAnyAttribute类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaAnyAttribute类的具体用法?C# XmlSchemaAnyAttribute怎么用?C# XmlSchemaAnyAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaAnyAttribute类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaAnyAttribute类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Intersection
internal static XmlSchemaAnyAttribute Intersection(XmlSchemaAnyAttribute o1, XmlSchemaAnyAttribute o2) {
NamespaceList nsl = NamespaceList.Intersection(o1.NamespaceList, o2.NamespaceList);
if (nsl != null) {
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.namespaceList = nsl;
if (o1.processContents == XmlSchemaContentProcessing.Strict ||
o1.processContents == XmlSchemaContentProcessing.None ||
o2.processContents == XmlSchemaContentProcessing.Strict ||
o2.processContents == XmlSchemaContentProcessing.None) {
anyAttribute.processContents = XmlSchemaContentProcessing.Strict;
}
else if (o1.processContents == XmlSchemaContentProcessing.Lax ||
o2.processContents == XmlSchemaContentProcessing.Lax) {
anyAttribute.processContents = XmlSchemaContentProcessing.Lax;
}
else {
anyAttribute.processContents = XmlSchemaContentProcessing.Skip;
}
anyAttribute.Annotation = o1.Annotation;
return anyAttribute;
}
else {
// not expressible
return null;
}
}
开发者ID:ArildF,项目名称:masters,代码行数:26,代码来源:xmlschemaanyattribute.cs
示例2: GetExtensionAttributes
public IEnumerable<XmlSchemaObject> GetExtensionAttributes(XmlSchemaAnyAttribute parent)
{
List<XmlSchemaObject> attributes;
if (!_extensionAttributes.TryGetValue(parent, out attributes))
return _emptyObjectList;
return attributes;
}
开发者ID:sergey-steinvil,项目名称:xsddoc,代码行数:8,代码来源:SchemaSetManager.cs
示例3: Union
internal static XmlSchemaAnyAttribute Union(XmlSchemaAnyAttribute o1, XmlSchemaAnyAttribute o2, bool v1Compat)
{
System.Xml.Schema.NamespaceList list = System.Xml.Schema.NamespaceList.Union(o1.NamespaceList, o2.NamespaceList, v1Compat);
if (list != null)
{
return new XmlSchemaAnyAttribute { namespaceList = list, processContents = o1.processContents, Annotation = o1.Annotation };
}
return null;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XmlSchemaAnyAttribute.cs
示例4: XmlSchemaComplexType
static XmlSchemaComplexType() {
anyType = new XmlSchemaComplexType();
anyType.SetContentType(XmlSchemaContentType.Mixed);
anyType.ElementDecl = SchemaElementDecl.CreateAnyTypeElementDecl();
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.BuildNamespaceList(null);
anyType.SetAttributeWildcard(anyAttribute);
anyType.ElementDecl.AnyAttribute = anyAttribute;
}
开发者ID:ArildF,项目名称:masters,代码行数:9,代码来源:xmlschemacomplextype.cs
示例5: SDataSchemaResourceType
public SDataSchemaResourceType(string elementName)
: base(elementName)
{
ListName = elementName + "--list";
ListItemName = elementName;
CanGet = true;
AnyAttribute = new XmlSchemaAnyAttribute();
ListAnyAttribute = new XmlSchemaAnyAttribute();
}
开发者ID:jasonhuber,项目名称:SDataUpdateNestedEntities,代码行数:9,代码来源:SDataSchemaResourceType.cs
示例6: Intersection
internal static XmlSchemaAnyAttribute Intersection(XmlSchemaAnyAttribute o1, XmlSchemaAnyAttribute o2, bool v1Compat) {
NamespaceList nsl = NamespaceList.Intersection(o1.NamespaceList, o2.NamespaceList, v1Compat);
if (nsl != null) {
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.namespaceList = nsl;
anyAttribute.ProcessContents = o1.ProcessContents;
anyAttribute.Annotation = o1.Annotation;
return anyAttribute;
}
else {
// not expressible
return null;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:XmlSchemaAnyAttribute.cs
示例7: BuildSchema
internal static XmlSchema BuildSchema (DiscoveryVersion version)
{
var schema = new XmlSchema () { TargetNamespace = version.Namespace };
var anyAttr = new XmlSchemaAnyAttribute () { Namespace = "##other", ProcessContents = XmlSchemaContentProcessing.Lax };
var probePart = new XmlSchemaSequence ();
probePart.Items.Add (new XmlSchemaElement () { RefName = new XmlQualifiedName ("Types", version.Namespace), MinOccurs = 0 });
probePart.Items.Add (new XmlSchemaElement () { RefName = new XmlQualifiedName ("Scopes", version.Namespace), MinOccurs = 0 });
probePart.Items.Add (new XmlSchemaAny () { MinOccurs = 0, MaxOccursString = "unbounded", Namespace = "##other", ProcessContents = XmlSchemaContentProcessing.Lax });
var ct = new XmlSchemaComplexType () { Name = "ProbeType", Particle = probePart, AnyAttribute = anyAttr };
schema.Items.Add (ct);
schema.Items.Add (new XmlSchemaSimpleType () { Name = "QNameListType", Content = new XmlSchemaSimpleTypeList () { ItemTypeName = new XmlQualifiedName ("QName", XmlSchema.Namespace) } });
var scr = new XmlSchemaSimpleContentRestriction () { BaseTypeName = new XmlQualifiedName ("UriListType", version.Namespace), AnyAttribute = anyAttr };
scr.Attributes.Add (new XmlSchemaAttribute () { Name = "matchBy", SchemaTypeName = new XmlQualifiedName ("anyURI", XmlSchema.Namespace) });
schema.Items.Add (new XmlSchemaComplexType () { Name = "ScopesType", ContentModel = new XmlSchemaSimpleContent () { Content = scr } });
schema.Items.Add (new XmlSchemaSimpleType () { Name = "UriListType", Content = new XmlSchemaSimpleTypeList () { ItemTypeName = new XmlQualifiedName ("anyURI", XmlSchema.Namespace) } });
schema.Items.Add (new XmlSchemaElement () { Name = "Types", SchemaTypeName = new XmlQualifiedName ("QNameListType", version.Namespace) });
schema.Items.Add (new XmlSchemaElement () { Name = "Scopes", SchemaTypeName = new XmlQualifiedName ("ScopesType", version.Namespace) });
return schema;
}
开发者ID:stabbylambda,项目名称:mono,代码行数:26,代码来源:FindCriteria.cs
示例8: CompileLocalAttributes
private void CompileLocalAttributes(XmlSchemaComplexType baseType, XmlSchemaComplexType derivedType, XmlSchemaObjectCollection attributes, XmlSchemaAnyAttribute anyAttribute, XmlSchemaDerivationMethod derivedBy)
{
XmlSchemaAnyAttribute b = (baseType != null) ? baseType.AttributeWildcard : null;
for (int i = 0; i < attributes.Count; i++)
{
XmlSchemaAttribute xa = attributes[i] as XmlSchemaAttribute;
if (xa != null)
{
if (xa.Use != XmlSchemaUse.Prohibited)
{
this.CompileAttribute(xa);
}
if ((xa.Use != XmlSchemaUse.Prohibited) || (((xa.Use == XmlSchemaUse.Prohibited) && (derivedBy == XmlSchemaDerivationMethod.Restriction)) && (baseType != XmlSchemaComplexType.AnyType)))
{
if (derivedType.AttributeUses[xa.QualifiedName] == null)
{
derivedType.AttributeUses.Add(xa.QualifiedName, xa);
}
else
{
base.SendValidationEvent("Sch_DupAttributeUse", xa.QualifiedName.ToString(), xa);
}
}
else
{
base.SendValidationEvent("Sch_AttributeIgnored", xa.QualifiedName.ToString(), xa, XmlSeverityType.Warning);
}
}
else
{
XmlSchemaAttributeGroupRef source = (XmlSchemaAttributeGroupRef) attributes[i];
XmlSchemaAttributeGroup attributeGroup = (XmlSchemaAttributeGroup) this.schema.AttributeGroups[source.RefName];
if (attributeGroup != null)
{
this.CompileAttributeGroup(attributeGroup);
foreach (XmlSchemaAttribute attribute3 in attributeGroup.AttributeUses.Values)
{
if ((attribute3.Use != XmlSchemaUse.Prohibited) || (((attribute3.Use == XmlSchemaUse.Prohibited) && (derivedBy == XmlSchemaDerivationMethod.Restriction)) && (baseType != XmlSchemaComplexType.AnyType)))
{
if (derivedType.AttributeUses[attribute3.QualifiedName] == null)
{
derivedType.AttributeUses.Add(attribute3.QualifiedName, attribute3);
}
else
{
base.SendValidationEvent("Sch_DupAttributeUse", attribute3.QualifiedName.ToString(), source);
}
}
else
{
base.SendValidationEvent("Sch_AttributeIgnored", attribute3.QualifiedName.ToString(), attribute3, XmlSeverityType.Warning);
}
}
anyAttribute = this.CompileAnyAttributeIntersection(anyAttribute, attributeGroup.AttributeWildcard);
}
else
{
base.SendValidationEvent("Sch_UndefAttributeGroupRef", source.RefName.ToString(), source);
}
}
}
if (baseType != null)
{
if (derivedBy == XmlSchemaDerivationMethod.Extension)
{
derivedType.SetAttributeWildcard(this.CompileAnyAttributeUnion(anyAttribute, b));
foreach (XmlSchemaAttribute attribute4 in baseType.AttributeUses.Values)
{
XmlSchemaAttribute attribute5 = (XmlSchemaAttribute) derivedType.AttributeUses[attribute4.QualifiedName];
if (attribute5 != null)
{
if ((attribute5.AttributeSchemaType != attribute4.AttributeSchemaType) || (attribute4.Use == XmlSchemaUse.Prohibited))
{
base.SendValidationEvent("Sch_InvalidAttributeExtension", attribute5);
}
}
else
{
derivedType.AttributeUses.Add(attribute4.QualifiedName, attribute4);
}
}
}
else
{
if ((anyAttribute != null) && ((b == null) || !XmlSchemaAnyAttribute.IsSubset(anyAttribute, b)))
{
base.SendValidationEvent("Sch_InvalidAnyAttributeRestriction", derivedType);
}
else
{
derivedType.SetAttributeWildcard(anyAttribute);
}
foreach (XmlSchemaAttribute attribute6 in baseType.AttributeUses.Values)
{
XmlSchemaAttribute attribute7 = (XmlSchemaAttribute) derivedType.AttributeUses[attribute6.QualifiedName];
if (attribute7 == null)
{
derivedType.AttributeUses.Add(attribute6.QualifiedName, attribute6);
}
else if ((attribute6.Use == XmlSchemaUse.Prohibited) && (attribute7.Use != XmlSchemaUse.Prohibited))
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SchemaCollectionCompiler.cs
示例9: IsProcessContentsRestricted
private bool IsProcessContentsRestricted(XmlSchemaComplexType baseType, XmlSchemaAnyAttribute derivedAttributeWildcard, XmlSchemaAnyAttribute baseAttributeWildcard) {
if (baseType == XmlSchemaComplexType.AnyType) {
return true;
}
if ((int)derivedAttributeWildcard.ProcessContentsCorrect >= (int)baseAttributeWildcard.ProcessContentsCorrect) {
return true;
}
return false;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:SchemaSetCompiler.cs
示例10: CompileAnyAttributeIntersection
private XmlSchemaAnyAttribute CompileAnyAttributeIntersection(XmlSchemaAnyAttribute a, XmlSchemaAnyAttribute b) {
if (a == null) {
return b;
}
else if (b == null) {
return a;
}
else {
XmlSchemaAnyAttribute attribute = XmlSchemaAnyAttribute.Intersection(a, b, false); //false is for v1Compat
if (attribute == null) {
SendValidationEvent(Res.Sch_UnexpressibleAnyAttribute, a);
}
return attribute;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:SchemaSetCompiler.cs
示例11: CompileLocalAttributes
private void CompileLocalAttributes(XmlSchemaComplexType baseType, XmlSchemaComplexType derivedType, XmlSchemaObjectCollection attributes, XmlSchemaAnyAttribute anyAttribute, XmlSchemaDerivationMethod derivedBy) {
XmlSchemaAnyAttribute baseAttributeWildcard = baseType != null ? baseType.AttributeWildcard : null;
for (int i = 0; i < attributes.Count; ++i) {
XmlSchemaAttribute attr = attributes[i] as XmlSchemaAttribute;
if (attr != null) {
if (attr.Use != XmlSchemaUse.Prohibited) {
CompileAttribute(attr);
}
if (attr.Use != XmlSchemaUse.Prohibited ||
(attr.Use == XmlSchemaUse.Prohibited && derivedBy == XmlSchemaDerivationMethod.Restriction && baseType != XmlSchemaComplexType.AnyType)) {
if (derivedType.AttributeUses[attr.QualifiedName] == null) {
derivedType.AttributeUses.Add(attr.QualifiedName, attr);
}
else {
SendValidationEvent(Res.Sch_DupAttributeUse, attr.QualifiedName.ToString(), attr);
}
}
else {
SendValidationEvent(Res.Sch_AttributeIgnored, attr.QualifiedName.ToString(), attr, XmlSeverityType.Warning);
}
}
else { // is XmlSchemaAttributeGroupRef
XmlSchemaAttributeGroupRef attributeGroupRef = (XmlSchemaAttributeGroupRef) attributes[i];
XmlSchemaAttributeGroup attributeGroup = (XmlSchemaAttributeGroup)attributeGroups[attributeGroupRef.RefName];
if (attributeGroup != null) {
CompileAttributeGroup(attributeGroup);
foreach (XmlSchemaAttribute attribute in attributeGroup.AttributeUses.Values) {
if (attribute.Use != XmlSchemaUse.Prohibited ||
(attribute.Use == XmlSchemaUse.Prohibited && derivedBy == XmlSchemaDerivationMethod.Restriction && baseType != XmlSchemaComplexType.AnyType)) {
if (derivedType.AttributeUses[attribute.QualifiedName] == null) {
derivedType.AttributeUses.Add(attribute.QualifiedName, attribute);
}
else {
SendValidationEvent(Res.Sch_DupAttributeUse, attribute.QualifiedName.ToString(), attributeGroupRef);
}
}
else {
SendValidationEvent(Res.Sch_AttributeIgnored, attribute.QualifiedName.ToString(), attribute, XmlSeverityType.Warning);
}
}
anyAttribute = CompileAnyAttributeIntersection(anyAttribute, attributeGroup.AttributeWildcard);
}
else {
SendValidationEvent(Res.Sch_UndefAttributeGroupRef, attributeGroupRef.RefName.ToString(), attributeGroupRef);
}
}
}
// check derivation rules
if (baseType != null) {
if (derivedBy == XmlSchemaDerivationMethod.Extension) {
derivedType.SetAttributeWildcard(CompileAnyAttributeUnion(anyAttribute, baseAttributeWildcard));
foreach(XmlSchemaAttribute attributeBase in baseType.AttributeUses.Values) {
XmlSchemaAttribute attribute = (XmlSchemaAttribute)derivedType.AttributeUses[attributeBase.QualifiedName];
if (attribute == null) {
derivedType.AttributeUses.Add(attributeBase.QualifiedName, attributeBase);
}
else {
Debug.Assert(attribute.Use != XmlSchemaUse.Prohibited);
if (attributeBase.Use != XmlSchemaUse.Prohibited && attribute.AttributeSchemaType != attributeBase.AttributeSchemaType) { //Extension allows previously prohibited attributes to be re-added,
SendValidationEvent(Res.Sch_InvalidAttributeExtension, attribute);
}
}
}
}
else { // derivedBy == XmlSchemaDerivationMethod.Restriction
// Schema Component Constraint: Derivation Valid (Restriction, Complex)
if ((anyAttribute != null) && (baseAttributeWildcard == null || !XmlSchemaAnyAttribute.IsSubset(anyAttribute, baseAttributeWildcard) || !IsProcessContentsRestricted(baseType, anyAttribute, baseAttributeWildcard)) ) {
SendValidationEvent(Res.Sch_InvalidAnyAttributeRestriction, derivedType);
}
else {
derivedType.SetAttributeWildcard(anyAttribute); //complete wildcard
}
// Add form the base
foreach(XmlSchemaAttribute attributeBase in baseType.AttributeUses.Values) {
XmlSchemaAttribute attribute = (XmlSchemaAttribute)derivedType.AttributeUses[attributeBase.QualifiedName];
if (attribute == null) {
derivedType.AttributeUses.Add(attributeBase.QualifiedName, attributeBase);
}
else {
if (attributeBase.Use == XmlSchemaUse.Prohibited && attribute.Use != XmlSchemaUse.Prohibited) {
#if DEBUG
string position = string.Empty;
if (derivedType.SourceUri != null) {
position = " in " + derivedType.SourceUri + "(" + derivedType.LineNumber + ", " + derivedType.LinePosition + ")";
}
Debug.WriteLineIf(DiagnosticsSwitches.XmlSchema.TraceError, "Invalid complexType attributes restriction" + position);
Debug.WriteLineIf(DiagnosticsSwitches.XmlSchema.TraceError, " Base " + DumpAttributes(baseType.AttributeUses, baseType.AttributeWildcard));
Debug.WriteLineIf(DiagnosticsSwitches.XmlSchema.TraceError, " Derived " + DumpAttributes(derivedType.AttributeUses, derivedType.AttributeWildcard));
#endif
SendValidationEvent(Res.Sch_AttributeRestrictionProhibited, attribute);
}
else if (attributeBase.Use == XmlSchemaUse.Required && (attribute.Use != XmlSchemaUse.Required)) { //If base is required, derived should also be required
SendValidationEvent(Res.Sch_AttributeUseInvalid, attribute);
}
else if (attribute.Use == XmlSchemaUse.Prohibited) {
//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:SchemaSetCompiler.cs
示例12: DumpAttributes
private string DumpAttributes(XmlSchemaObjectTable attributeUses, XmlSchemaAnyAttribute attributeWildcard) {
StringBuilder sb = new StringBuilder();
sb.Append("[");
bool first = true;
foreach (XmlSchemaAttribute attribute in attributeUses.Values) {
if (attribute.Use != XmlSchemaUse.Prohibited) {
if (first) {
first = false;
}
else {
sb.Append(" ");
}
sb.Append(attribute.QualifiedName.Name);
if (attribute.Use == XmlSchemaUse.Optional || attribute.Use == XmlSchemaUse.None) {
sb.Append("?");
}
}
}
if (attributeWildcard != null) {
if (attributeUses.Count != 0) {
sb.Append(" ");
}
sb.Append("<");
sb.Append(attributeWildcard.NamespaceList.ToString());
sb.Append(">");
}
sb.Append("] - [");
first = true;
foreach (XmlSchemaAttribute attribute in attributeUses.Values) {
if (attribute.Use == XmlSchemaUse.Prohibited) {
if (first) {
first = false;
}
else {
sb.Append(" ");
}
sb.Append(attribute.QualifiedName.Name);
}
}
sb.Append("]");
return sb.ToString();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:42,代码来源:SchemaSetCompiler.cs
示例13: Write33_XmlSchemaAnyAttribute
void Write33_XmlSchemaAnyAttribute(XmlSchemaAnyAttribute o) {
if ((object)o == null) return;
WriteStartElement("anyAttribute");
WriteAttribute(@"id", @"", ((System.String)[email protected]));
WriteAttribute("namespace", "", ToString(o.NamespaceList));
XmlSchemaContentProcessing process = [email protected] == [email protected] ? XmlSchemaContentProcessing.Strict : [email protected];
WriteAttribute(@"processContents", @"", Write34_XmlSchemaContentProcessing(process));
WriteAttributes((XmlAttribute[])[email protected], o);
Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)[email protected]);
WriteEndElement();
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:SchemaObjectWriter.cs
示例14: AddAppSequenceType
static void AddAppSequenceType(DiscoveryVersion discoveryVersion, XmlSchema schema)
{
//<xs:complexType name="AppSequenceType" >
XmlSchemaComplexType appSequenceType = new XmlSchemaComplexType();
appSequenceType.Name = ProtocolStrings.SchemaNames.AppSequenceType;
// <xs:complexContent>
XmlSchemaComplexContent complexContent = new XmlSchemaComplexContent();
appSequenceType.ContentModel = complexContent;
// <xs:restriction base="xs:anyType" >
XmlSchemaComplexContentRestriction contentRestriction = new XmlSchemaComplexContentRestriction();
complexContent.Content = contentRestriction;
contentRestriction.BaseTypeName = discoveryVersion.Implementation.QualifiedNames.AnyType;
// <xs:attribute name="InstanceId" type="xs:unsignedInt" use="required" />
XmlSchemaAttribute instanceId = new XmlSchemaAttribute();
instanceId.Name = ProtocolStrings.SchemaNames.AppSequenceInstanceId;
instanceId.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.UnsignedIntType;
instanceId.Use = XmlSchemaUse.Required;
// <xs:attribute name="SequenceId" type="xs:anyURI" />
XmlSchemaAttribute sequenceId = new XmlSchemaAttribute();
sequenceId.Name = ProtocolStrings.SchemaNames.AppSequenceSequenceId;
sequenceId.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.AnyUriType;
// <xs:attribute name="MessageNumber" type="xs:unsignedInt" use="required" />
XmlSchemaAttribute messageNumber = new XmlSchemaAttribute();
messageNumber.Name = ProtocolStrings.SchemaNames.AppSequenceMessageNumber;
messageNumber.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.UnsignedIntType;
messageNumber.Use = XmlSchemaUse.Required;
// <xs:anyAttribute namespace="##other" processContents="lax" />
XmlSchemaAnyAttribute anyAttribue = new XmlSchemaAnyAttribute();
anyAttribue.Namespace = "##other";
anyAttribue.ProcessContents = XmlSchemaContentProcessing.Lax;
contentRestriction.Attributes.Add(instanceId);
contentRestriction.Attributes.Add(sequenceId);
contentRestriction.Attributes.Add(messageNumber);
contentRestriction.AnyAttribute = anyAttribue;
schema.Items.Add(appSequenceType);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:44,代码来源:SchemaUtility.cs
示例15: SetAttributeWildcard
internal void SetAttributeWildcard(XmlSchemaAnyAttribute value) {
attributeWildcard = value;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:XmlSchemaComplexType.cs
示例16: 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:
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:XsdBuilder.cs
示例17: WriteAttributes
void WriteAttributes(XmlTextWriter xtw, XmlSchemaObjectCollection atts, XmlSchemaAnyAttribute anyat)
{
foreach (XmlSchemaObject at in atts) {
if (at is XmlSchemaAttribute) {
XmlSchemaAttribute attr = (XmlSchemaAttribute)at;
XmlSchemaAttribute refAttr = attr;
// refAttr.Form; TODO
if (!attr.RefName.IsEmpty) {
refAttr = FindRefAttribute(attr.RefName);
if (refAttr == null) throw new InvalidOperationException("Global attribute not found: " + attr.RefName);
}
string val;
if (!refAttr.SchemaTypeName.IsEmpty) val = FindBuiltInType(refAttr.SchemaTypeName);
else val = FindBuiltInType((XmlSchemaSimpleType)refAttr.SchemaType);
xtw.WriteAttributeString(refAttr.Name, val);
}
else if (at is XmlSchemaAttributeGroupRef) {
XmlSchemaAttributeGroupRef gref = (XmlSchemaAttributeGroupRef)at;
XmlSchemaAttributeGroup grp = (XmlSchemaAttributeGroup)schemas.Find(gref.RefName, typeof(XmlSchemaAttributeGroup));
WriteAttributes(xtw, grp.Attributes, grp.AnyAttribute);
}
}
if (anyat != null)
xtw.WriteAttributeString("custom-attribute", "value");
}
开发者ID:umabiel,项目名称:WsdlUI,代码行数:30,代码来源:SampleGenerator.cs
示例18: AddScopesType
static void AddScopesType(DiscoveryVersion discoveryVersion, XmlSchema schema)
{
// <xs:complexType name="ScopesType">
XmlSchemaComplexType scopesType = new XmlSchemaComplexType();
scopesType.Name = ProtocolStrings.SchemaNames.ScopesType;
// <xs:simpleContent>
XmlSchemaSimpleContent scopesTypeContent = new XmlSchemaSimpleContent();
// <xs:extension base="tns:UriListType">
XmlSchemaSimpleContentExtension scopesTypeContentExtension = new XmlSchemaSimpleContentExtension();
scopesTypeContentExtension.BaseTypeName = discoveryVersion.Implementation.QualifiedNames.UriListType;
// <xs:attribute name="MatchBy" type="xs:anyURI" />
XmlSchemaAttribute matchBy = new XmlSchemaAttribute();
matchBy.Name = ProtocolStrings.SchemaNames.MatchByAttribute;
matchBy.SchemaTypeName = discoveryVersion.Implementation.QualifiedNames.AnyUriType;
// <xs:anyAttribute namespace="##other" processContents="lax" />
XmlSchemaAnyAttribute anyAttribute = new XmlSchemaAnyAttribute();
anyAttribute.Namespace = "##other";
anyAttribute.ProcessContents = XmlSchemaContentProcessing.Lax;
// </xs:extension>
scopesTypeContentExtension.Attributes.Add(matchBy);
scopesTypeContentExtension.AnyAttribute = anyAttribute;
// </xs:simpleContent>
scopesTypeContent.Content = scopesTypeContentExtension;
// <xs:complexType name="ScopesType">
scopesType.ContentModel = scopesTypeContent;
schema.Items.Add(scopesType);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:SchemaUtility.cs
示例19: 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);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:42,代码来源:SchemaUtility.cs
示例20: 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>
|
请发表评论