Summary description for XmlSchemaAny.
Inheritance: XmlSchemaParticle
Esempio n. 1
0
        public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
        {
            TypedDataSet ds = new TypedDataSet();

            System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
            System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
            xs.Add(ds.GetSchemaSerializable());
            if (PublishLegacyWSDL())
            {
                System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
                any.Namespace = ds.Namespace;
                sequence.Items.Add(any);
            }
            else
            {
                System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new System.Decimal(0);
                any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new System.Decimal(0);
                any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                sequence.MaxOccurs = System.Decimal.MaxValue;
                System.Xml.Schema.XmlSchemaAttribute attribute = new System.Xml.Schema.XmlSchemaAttribute();
                attribute.Name       = "namespace";
                attribute.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute);
            }
            type.Particle = sequence;
            return(type);
        }
		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;
		}
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
		public virtual string ImportAnyElement (
			XmlSchemaAny any, 
			bool mixed, 
			XmlSchemas schemas, 
			XmlSchemaImporter importer, 
			CodeCompileUnit compileUnit, 
			CodeNamespace mainNamespace, 
			CodeGenerationOptions options, 
			CodeDomProvider codeProvider
		)
		{
			return null;
		}
Esempio n. 5
0
    public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs)
    {
        Appointments ds = new Appointments();

        System.Xml.Schema.XmlSchemaComplexType type     = new System.Xml.Schema.XmlSchemaComplexType();
        System.Xml.Schema.XmlSchemaSequence    sequence = new System.Xml.Schema.XmlSchemaSequence();
        xs.Add(ds.GetSchemaSerializable());
        System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny();
        any.Namespace = ds.Namespace;
        sequence.Items.Add(any);
        type.Particle = sequence;
        return(type);
    }
 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);
 }
 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);
 }
        internal void    AddAny(XmlSchemaAny any)
        {
            ContentNode n = new AnyNode(any);

            if (stack.Count > 0)
            {
                InternalNode inNode = (InternalNode)stack.Pop();
                if (inNode != null)
                {
                    inNode.RightNode = n;
                    n.ParentNode     = inNode;
                    n = inNode;
                }
            }
            stack.Push(n);
            isPartial       = true;
            abnormalContent = true;
        }
Esempio n. 9
0
        internal override XmlSchemaParticle GetOptimizedParticle(bool isTop)
        {
            if (this.OptimizedParticle != null)
            {
                return(this.OptimizedParticle);
            }
            XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();

            this.CopyInfo(xmlSchemaAny);
            xmlSchemaAny.CompileOccurence(null, null);
            xmlSchemaAny.wildcard            = this.wildcard;
            this.OptimizedParticle           = xmlSchemaAny;
            xmlSchemaAny.Namespace           = this.Namespace;
            xmlSchemaAny.ProcessContents     = this.ProcessContents;
            xmlSchemaAny.Annotation          = base.Annotation;
            xmlSchemaAny.UnhandledAttributes = base.UnhandledAttributes;
            return(this.OptimizedParticle);
        }
Esempio n. 10
0
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle, ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            XmlSchemaAny xmlSchemaAny = baseParticle as XmlSchemaAny;
            XmlSchemaAll xmlSchemaAll = baseParticle as XmlSchemaAll;

            if (xmlSchemaAny != null)
            {
                return(base.ValidateNSRecurseCheckCardinality(xmlSchemaAny, h, schema, raiseError));
            }
            if (xmlSchemaAll != null)
            {
                return(this.ValidateOccurenceRangeOK(xmlSchemaAll, h, schema, raiseError) && base.ValidateRecurse(xmlSchemaAll, h, schema, raiseError));
            }
            if (raiseError)
            {
                base.error(h, "Invalid -all- particle derivation was found.");
            }
            return(false);
        }
Esempio n. 11
0
        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);
        }
        private SchemaElementDecl FastGetElementDecl(object particle)
        {
            SchemaElementDecl elementDecl = null;

            if (particle != null)
            {
                XmlSchemaElement element = particle as XmlSchemaElement;
                if (element != null)
                {
                    elementDecl = element.ElementDecl;
                }
                else
                {
                    XmlSchemaAny any = (XmlSchemaAny)particle;
                    processContents = any.ProcessContentsCorrect;
                }
            }
            return(elementDecl);
        }
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle, ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            XmlSchemaAny xmlSchemaAny = baseParticle as XmlSchemaAny;

            if (xmlSchemaAny != null)
            {
                return(base.ValidateNSRecurseCheckCardinality(xmlSchemaAny, h, schema, raiseError));
            }
            XmlSchemaChoice xmlSchemaChoice = baseParticle as XmlSchemaChoice;

            if (xmlSchemaChoice != null)
            {
                return(this.ValidateOccurenceRangeOK(xmlSchemaChoice, h, schema, raiseError) && ((xmlSchemaChoice.ValidatedMinOccurs == 0m && xmlSchemaChoice.ValidatedMaxOccurs == 0m && base.ValidatedMinOccurs == 0m && base.ValidatedMaxOccurs == 0m) || base.ValidateSeqRecurseMapSumCommon(xmlSchemaChoice, h, schema, true, false, raiseError)));
            }
            if (raiseError)
            {
                base.error(h, "Invalid choice derivation by restriction was found.");
            }
            return(false);
        }
Esempio n. 14
0
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle,
                                                               ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            XmlSchemaAny baseAny = baseParticle as XmlSchemaAny;

            if (baseAny == null)
            {
                if (raiseError)
                {
                    error(h, "Invalid particle derivation by restriction was found.");
                }
                return(false);
            }
            // 3.9.6 Particle Derivation OK (Any:Any - NSSubset)
            if (!ValidateOccurenceRangeOK(baseParticle, h, schema, raiseError))
            {
                return(false);
            }
            return(wildcard.ValidateWildcardSubset(baseAny.wildcard, h, schema, raiseError));
        }
Esempio n. 15
0
        internal override bool ParticleEquals(XmlSchemaParticle other)
        {
            XmlSchemaAny xmlSchemaAny = other as XmlSchemaAny;

            if (xmlSchemaAny == null)
            {
                return(false);
            }
            if (this.HasValueAny != xmlSchemaAny.HasValueAny || this.HasValueLocal != xmlSchemaAny.HasValueLocal || this.HasValueOther != xmlSchemaAny.HasValueOther || this.HasValueTargetNamespace != xmlSchemaAny.HasValueTargetNamespace || this.ResolvedProcessContents != xmlSchemaAny.ResolvedProcessContents || base.ValidatedMaxOccurs != xmlSchemaAny.ValidatedMaxOccurs || base.ValidatedMinOccurs != xmlSchemaAny.ValidatedMinOccurs || this.ResolvedNamespaces.Count != xmlSchemaAny.ResolvedNamespaces.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.ResolvedNamespaces.Count; i++)
            {
                if (this.ResolvedNamespaces[i] != xmlSchemaAny.ResolvedNamespaces[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 16
0
        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;
        }
Esempio n. 17
0
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle,
                                                               ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            XmlSchemaAny any = baseParticle as XmlSchemaAny;

            if (any != null)
            {
                // NSRecurseCheckCardinality
                return(ValidateNSRecurseCheckCardinality(any, h, schema, raiseError));
            }

            XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;

            if (choice != null)
            {
                // RecurseLax
                if (!ValidateOccurenceRangeOK(choice, h, schema, raiseError))
                {
                    return(false);
                }

                // If it is totally optional, then ignore their contents.
                if (choice.ValidatedMinOccurs == 0 && choice.ValidatedMaxOccurs == 0 &&
                    this.ValidatedMinOccurs == 0 && this.ValidatedMaxOccurs == 0)
                {
                    return(true);
                }
//				return ValidateRecurseLax (choice, h, schema, raiseError);
                return(this.ValidateSeqRecurseMapSumCommon(choice, h, schema, true, false, raiseError));
            }

            if (raiseError)
            {
                error(h, "Invalid choice derivation by restriction was found.");
            }
            return(false);
        }
 private bool IsAnyFromAny(XmlSchemaAny derivedAny, XmlSchemaAny baseAny)
 {
     return (this.IsValidOccurrenceRangeRestriction(derivedAny, baseAny) && NamespaceList.IsSubset(derivedAny.NamespaceList, baseAny.NamespaceList));
 }
Esempio n. 19
0
 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:
         case State.MinLength:
         case State.MaxLength:
         case State.Enumeration:
         case State.Pattern:
         case State.WhiteSpace:
             this.facet = (XmlSchemaFacet)container;
             break;
         case State.AppInfo:
             this.appInfo = (XmlSchemaAppInfo)container;
             break;
         case State.Documentation:
             this.documentation = (XmlSchemaDocumentation)container;
             break;
         case State.Redefine:
             this.redefine = (XmlSchemaRedefine)container;
             break;
         default:
             Debug.Assert(false, "State is " + state);
             break;
     }
 }
Esempio n. 20
0
 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;
 }
 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;
 }
Esempio n. 22
0
 static XmlSchemaComplexType CreateAnyType()
 {
     XmlSchemaComplexType anyType = new XmlSchemaComplexType();
     anyType.IsMixed = true;
     anyType.Particle = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny();
     any.MinOccurs = 0;
     any.MaxOccurs = Decimal.MaxValue;
     any.ProcessContents = XmlSchemaContentProcessing.Lax;
     ((XmlSchemaSequence)anyType.Particle).Items.Add(any);
     anyType.AnyAttribute = new XmlSchemaAnyAttribute();
     return anyType;
 }
 private XmlSchemaType ExportSpecialMapping(SpecialMapping mapping, string ns, bool isAny, XmlSchemaElement element)
 {
     switch (mapping.TypeDesc.Kind)
     {
         case TypeKind.Node:
         {
             XmlSchemaComplexType type = new XmlSchemaComplexType {
                 IsMixed = mapping.TypeDesc.IsMixed
             };
             XmlSchemaSequence sequence = new XmlSchemaSequence();
             XmlSchemaAny item = new XmlSchemaAny();
             if (isAny)
             {
                 type.AnyAttribute = new XmlSchemaAnyAttribute();
                 type.IsMixed = true;
                 item.MaxOccurs = 79228162514264337593543950335M;
             }
             sequence.Items.Add(item);
             type.Particle = sequence;
             if (element != null)
             {
                 element.SchemaType = type;
             }
             return type;
         }
         case TypeKind.Serializable:
         {
             SerializableMapping mapping2 = (SerializableMapping) mapping;
             if (!mapping2.IsAny)
             {
                 if ((mapping2.XsiType != null) || (mapping2.XsdType != null))
                 {
                     XmlSchemaType xsdType = mapping2.XsdType;
                     foreach (XmlSchema schema2 in mapping2.Schemas.Schemas())
                     {
                         if (schema2.TargetNamespace != "http://www.w3.org/2001/XMLSchema")
                         {
                             this.schemas.Add(schema2, true);
                             this.AddSchemaImport(schema2.TargetNamespace, ns);
                             if (!mapping2.XsiType.IsEmpty && (mapping2.XsiType.Namespace == schema2.TargetNamespace))
                             {
                                 xsdType = (XmlSchemaType) schema2.SchemaTypes[mapping2.XsiType];
                             }
                         }
                     }
                     if (element != null)
                     {
                         element.SchemaTypeName = mapping2.XsiType;
                         if (element.SchemaTypeName.IsEmpty)
                         {
                             element.SchemaType = xsdType;
                         }
                     }
                     mapping2.CheckDuplicateElement(element, ns);
                     return xsdType;
                 }
                 if (mapping2.Schema != null)
                 {
                     XmlSchemaComplexType type4 = new XmlSchemaComplexType();
                     XmlSchemaAny any3 = new XmlSchemaAny();
                     XmlSchemaSequence sequence3 = new XmlSchemaSequence();
                     sequence3.Items.Add(any3);
                     type4.Particle = sequence3;
                     string targetNamespace = mapping2.Schema.TargetNamespace;
                     any3.Namespace = (targetNamespace == null) ? "" : targetNamespace;
                     XmlSchema schema3 = this.schemas[targetNamespace];
                     if (schema3 == null)
                     {
                         this.schemas.Add(mapping2.Schema);
                     }
                     else if (schema3 != mapping2.Schema)
                     {
                         throw new InvalidOperationException(Res.GetString("XmlDuplicateNamespace", new object[] { targetNamespace }));
                     }
                     if (element != null)
                     {
                         element.SchemaType = type4;
                     }
                     mapping2.CheckDuplicateElement(element, ns);
                     return type4;
                 }
                 XmlSchemaComplexType type5 = new XmlSchemaComplexType();
                 XmlSchemaElement element2 = new XmlSchemaElement {
                     RefName = new XmlQualifiedName("schema", "http://www.w3.org/2001/XMLSchema")
                 };
                 XmlSchemaSequence sequence4 = new XmlSchemaSequence();
                 sequence4.Items.Add(element2);
                 sequence4.Items.Add(new XmlSchemaAny());
                 type5.Particle = sequence4;
                 this.AddSchemaImport("http://www.w3.org/2001/XMLSchema", ns);
                 if (element != null)
                 {
                     element.SchemaType = type5;
                 }
                 return type5;
             }
             XmlSchemaComplexType type2 = new XmlSchemaComplexType {
                 IsMixed = mapping.TypeDesc.IsMixed
             };
             XmlSchemaSequence sequence2 = new XmlSchemaSequence();
             XmlSchemaAny any2 = new XmlSchemaAny();
             if (isAny)
             {
                 type2.AnyAttribute = new XmlSchemaAnyAttribute();
                 type2.IsMixed = true;
                 any2.MaxOccurs = 79228162514264337593543950335M;
             }
             if (mapping2.NamespaceList.Length > 0)
             {
                 any2.Namespace = mapping2.NamespaceList;
             }
             any2.ProcessContents = XmlSchemaContentProcessing.Lax;
             if (mapping2.Schemas != null)
             {
                 foreach (XmlSchema schema in mapping2.Schemas.Schemas())
                 {
                     if (schema.TargetNamespace != "http://www.w3.org/2001/XMLSchema")
                     {
                         this.schemas.Add(schema, true);
                         this.AddSchemaImport(schema.TargetNamespace, ns);
                     }
                 }
             }
             sequence2.Items.Add(any2);
             type2.Particle = sequence2;
             if (element != null)
             {
                 element.SchemaType = type2;
             }
             return type2;
         }
     }
     throw new ArgumentException(Res.GetString("XmlInternalError"), "mapping");
 }
 public string ExportAnyType(XmlMembersMapping members)
 {
     if (((members.Count != 1) || !members[0].Any) || (members[0].ElementName.Length != 0))
     {
         return null;
     }
     XmlMemberMapping mapping = members[0];
     string ns = mapping.Namespace;
     bool isArrayLike = mapping.Mapping.TypeDesc.IsArrayLike;
     bool mixed = (isArrayLike && (mapping.Mapping.TypeDesc.ArrayElementTypeDesc != null)) ? mapping.Mapping.TypeDesc.ArrayElementTypeDesc.IsMixed : mapping.Mapping.TypeDesc.IsMixed;
     if (mixed && mapping.Mapping.TypeDesc.IsMixed)
     {
         isArrayLike = true;
     }
     string str2 = mixed ? "any" : (isArrayLike ? "anyElements" : "anyElement");
     string name = str2;
     int num = 0;
     XmlSchema schema = this.schemas[ns];
     if (schema != null)
     {
         while (true)
         {
             XmlSchemaType schemaType = FindSchemaType(name, schema.Items);
             if (schemaType == null)
             {
                 break;
             }
             if (IsAnyType(schemaType, mixed, isArrayLike))
             {
                 return name;
             }
             num++;
             name = str2 + num.ToString(CultureInfo.InvariantCulture);
         }
     }
     XmlSchemaComplexType item = new XmlSchemaComplexType {
         Name = name,
         IsMixed = mixed
     };
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny {
         MinOccurs = 0M
     };
     if (isArrayLike)
     {
         any.MaxOccurs = 79228162514264337593543950335M;
     }
     sequence.Items.Add(any);
     item.Particle = sequence;
     this.AddSchemaItem(item, ns, null);
     return name;
 }
Esempio n. 25
0
 // 3.8.6. Attribute Wildcard Intersection
 // Only try to examine if their intersection is expressible, and
 // returns if the result is empty.
 internal bool ExamineAttributeWildcardIntersection(XmlSchemaAny other,
                                                    ValidationEventHandler h, XmlSchema schema)
 {
     return(wildcard.ExamineAttributeWildcardIntersection(other, h, schema));
 }
Esempio n. 26
0
        internal static XmlSchemaAny Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();

            reader.MoveToElement();
            if (reader.NamespaceURI != "http://www.w3.org/2001/XMLSchema" || reader.LocalName != "any")
            {
                XmlSchemaObject.error(h, "Should not happen :1: XmlSchemaAny.Read, name=" + reader.Name, null);
                reader.SkipToEnd();
                return(null);
            }
            xmlSchemaAny.LineNumber   = reader.LineNumber;
            xmlSchemaAny.LinePosition = reader.LinePosition;
            xmlSchemaAny.SourceUri    = reader.BaseURI;
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    xmlSchemaAny.Id = reader.Value;
                }
                else if (reader.Name == "maxOccurs")
                {
                    try
                    {
                        xmlSchemaAny.MaxOccursString = reader.Value;
                    }
                    catch (Exception innerException)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is an invalid value for maxOccurs", innerException);
                    }
                }
                else if (reader.Name == "minOccurs")
                {
                    try
                    {
                        xmlSchemaAny.MinOccursString = reader.Value;
                    }
                    catch (Exception innerException2)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is an invalid value for minOccurs", innerException2);
                    }
                }
                else if (reader.Name == "namespace")
                {
                    xmlSchemaAny.nameSpace = reader.Value;
                }
                else if (reader.Name == "processContents")
                {
                    Exception ex;
                    xmlSchemaAny.processing = XmlSchemaUtil.ReadProcessingAttribute(reader, out ex);
                    if (ex != null)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is not a valid value for processContents", ex);
                    }
                }
                else if ((reader.NamespaceURI == string.Empty && reader.Name != "xmlns") || reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
                {
                    XmlSchemaObject.error(h, reader.Name + " is not a valid attribute for any", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, xmlSchemaAny);
                }
            }
            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(xmlSchemaAny);
            }
            int num = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != "any")
                    {
                        XmlSchemaObject.error(h, "Should not happen :2: XmlSchemaAny.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (num <= 1 && reader.LocalName == "annotation")
                {
                    num = 2;
                    XmlSchemaAnnotation xmlSchemaAnnotation = XmlSchemaAnnotation.Read(reader, h);
                    if (xmlSchemaAnnotation != null)
                    {
                        xmlSchemaAny.Annotation = xmlSchemaAnnotation;
                    }
                }
                else
                {
                    reader.RaiseInvalidElementError();
                }
            }
            return(xmlSchemaAny);
        }
        internal static XmlSchemaChoice Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaChoice xmlSchemaChoice = new XmlSchemaChoice();

            reader.MoveToElement();
            if (reader.NamespaceURI != "http://www.w3.org/2001/XMLSchema" || reader.LocalName != "choice")
            {
                XmlSchemaObject.error(h, "Should not happen :1: XmlSchemaChoice.Read, name=" + reader.Name, null);
                reader.SkipToEnd();
                return(null);
            }
            xmlSchemaChoice.LineNumber   = reader.LineNumber;
            xmlSchemaChoice.LinePosition = reader.LinePosition;
            xmlSchemaChoice.SourceUri    = reader.BaseURI;
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    xmlSchemaChoice.Id = reader.Value;
                }
                else if (reader.Name == "maxOccurs")
                {
                    try
                    {
                        xmlSchemaChoice.MaxOccursString = reader.Value;
                    }
                    catch (Exception innerException)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is an invalid value for maxOccurs", innerException);
                    }
                }
                else if (reader.Name == "minOccurs")
                {
                    try
                    {
                        xmlSchemaChoice.MinOccursString = reader.Value;
                    }
                    catch (Exception innerException2)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is an invalid value for minOccurs", innerException2);
                    }
                }
                else if ((reader.NamespaceURI == string.Empty && reader.Name != "xmlns") || reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
                {
                    XmlSchemaObject.error(h, reader.Name + " is not a valid attribute for choice", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, xmlSchemaChoice);
                }
            }
            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(xmlSchemaChoice);
            }
            int num = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != "choice")
                    {
                        XmlSchemaObject.error(h, "Should not happen :2: XmlSchemaChoice.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (num <= 1 && reader.LocalName == "annotation")
                {
                    num = 2;
                    XmlSchemaAnnotation xmlSchemaAnnotation = XmlSchemaAnnotation.Read(reader, h);
                    if (xmlSchemaAnnotation != null)
                    {
                        xmlSchemaChoice.Annotation = xmlSchemaAnnotation;
                    }
                }
                else
                {
                    if (num <= 2)
                    {
                        if (reader.LocalName == "element")
                        {
                            num = 2;
                            XmlSchemaElement xmlSchemaElement = XmlSchemaElement.Read(reader, h);
                            if (xmlSchemaElement != null)
                            {
                                xmlSchemaChoice.items.Add(xmlSchemaElement);
                            }
                            continue;
                        }
                        if (reader.LocalName == "group")
                        {
                            num = 2;
                            XmlSchemaGroupRef xmlSchemaGroupRef = XmlSchemaGroupRef.Read(reader, h);
                            if (xmlSchemaGroupRef != null)
                            {
                                xmlSchemaChoice.items.Add(xmlSchemaGroupRef);
                            }
                            continue;
                        }
                        if (reader.LocalName == "choice")
                        {
                            num = 2;
                            XmlSchemaChoice xmlSchemaChoice2 = XmlSchemaChoice.Read(reader, h);
                            if (xmlSchemaChoice2 != null)
                            {
                                xmlSchemaChoice.items.Add(xmlSchemaChoice2);
                            }
                            continue;
                        }
                        if (reader.LocalName == "sequence")
                        {
                            num = 2;
                            XmlSchemaSequence xmlSchemaSequence = XmlSchemaSequence.Read(reader, h);
                            if (xmlSchemaSequence != null)
                            {
                                xmlSchemaChoice.items.Add(xmlSchemaSequence);
                            }
                            continue;
                        }
                        if (reader.LocalName == "any")
                        {
                            num = 2;
                            XmlSchemaAny xmlSchemaAny = XmlSchemaAny.Read(reader, h);
                            if (xmlSchemaAny != null)
                            {
                                xmlSchemaChoice.items.Add(xmlSchemaAny);
                            }
                            continue;
                        }
                    }
                    reader.RaiseInvalidElementError();
                }
            }
            return(xmlSchemaChoice);
        }
Esempio n. 28
0
        //<choice
        //  id = ID
        //  maxOccurs =  (nonNegativeInteger | unbounded)  : 1
        //  minOccurs = nonNegativeInteger : 1
        //  {any attributes with non-schema namespace . . .}>
        //  Content: (annotation?, (element | group | choice | sequence | any)*)
        //</choice>
        internal static XmlSchemaChoice Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaChoice choice = new XmlSchemaChoice();

            reader.MoveToElement();

            if (reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
            {
                error(h, "Should not happen :1: XmlSchemaChoice.Read, name=" + reader.Name, null);
                reader.SkipToEnd();
                return(null);
            }

            choice.LineNumber   = reader.LineNumber;
            choice.LinePosition = reader.LinePosition;
            choice.SourceUri    = reader.BaseURI;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    choice.Id = reader.Value;
                }
                else if (reader.Name == "maxOccurs")
                {
                    try
                    {
                        choice.MaxOccursString = reader.Value;
                    }
                    catch (Exception e)
                    {
                        error(h, reader.Value + " is an invalid value for maxOccurs", e);
                    }
                }
                else if (reader.Name == "minOccurs")
                {
                    try
                    {
                        choice.MinOccursString = reader.Value;
                    }
                    catch (Exception e)
                    {
                        error(h, reader.Value + " is an invalid value for minOccurs", e);
                    }
                }
                else if ((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
                {
                    error(h, reader.Name + " is not a valid attribute for choice", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, choice);
                }
            }

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(choice);
            }

            //  Content: (annotation?, (element | group | choice | sequence | any)*)
            int level = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != xmlname)
                    {
                        error(h, "Should not happen :2: XmlSchemaChoice.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (level <= 1 && reader.LocalName == "annotation")
                {
                    level = 2;                     //Only one annotation
                    XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader, h);
                    if (annotation != null)
                    {
                        choice.Annotation = annotation;
                    }
                    continue;
                }
                if (level <= 2)
                {
                    if (reader.LocalName == "element")
                    {
                        level = 2;
                        XmlSchemaElement element = XmlSchemaElement.Read(reader, h);
                        if (element != null)
                        {
                            choice.items.Add(element);
                        }
                        continue;
                    }
                    if (reader.LocalName == "group")
                    {
                        level = 2;
                        XmlSchemaGroupRef group = XmlSchemaGroupRef.Read(reader, h);
                        if (group != null)
                        {
                            choice.items.Add(group);
                        }
                        continue;
                    }
                    if (reader.LocalName == "choice")
                    {
                        level = 2;
                        XmlSchemaChoice ch = XmlSchemaChoice.Read(reader, h);
                        if (ch != null)
                        {
                            choice.items.Add(ch);
                        }
                        continue;
                    }
                    if (reader.LocalName == "sequence")
                    {
                        level = 2;
                        XmlSchemaSequence sequence = XmlSchemaSequence.Read(reader, h);
                        if (sequence != null)
                        {
                            choice.items.Add(sequence);
                        }
                        continue;
                    }
                    if (reader.LocalName == "any")
                    {
                        level = 2;
                        XmlSchemaAny any = XmlSchemaAny.Read(reader, h);
                        if (any != null)
                        {
                            choice.items.Add(any);
                        }
                        continue;
                    }
                }
                reader.RaiseInvalidElementError();
            }
            return(choice);
        }
Esempio n. 29
0
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle,
                                                               ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            if (this == baseParticle)             // quick check
            {
                return(true);
            }

            XmlSchemaElement el = baseParticle as XmlSchemaElement;

            if (el != null)
            {
                // Forbidden
                if (raiseError)
                {
                    error(h, "Invalid sequence paricle derivation.");
                }
                return(false);
            }

            XmlSchemaSequence seq = baseParticle as XmlSchemaSequence;

            if (seq != null)
            {
                // Recurse
                if (!ValidateOccurenceRangeOK(seq, h, schema, raiseError))
                {
                    return(false);
                }

                // If it is totally optional, then ignore their contents.
                if (seq.ValidatedMinOccurs == 0 && seq.ValidatedMaxOccurs == 0 &&
                    this.ValidatedMinOccurs == 0 && this.ValidatedMaxOccurs == 0)
                {
                    return(true);
                }
                return(ValidateRecurse(seq, h, schema, raiseError));
            }

            XmlSchemaAll all = baseParticle as XmlSchemaAll;

            if (all != null)
            {
                // RecurseUnordered
                XmlSchemaObjectCollection already = new XmlSchemaObjectCollection();
                for (int i = 0; i < this.Items.Count; i++)
                {
                    XmlSchemaElement de = this.Items [i] as XmlSchemaElement;
                    if (de == null)
                    {
                        if (raiseError)
                        {
                            error(h, "Invalid sequence particle derivation by restriction from all.");
                        }
                        return(false);
                    }
                    foreach (XmlSchemaElement e in all.Items)
                    {
                        if (e.QualifiedName == de.QualifiedName)
                        {
                            if (already.Contains(e))
                            {
                                if (raiseError)
                                {
                                    error(h, "Base element particle is mapped to the derived element particle in a sequence two or more times.");
                                }
                                return(false);
                            }
                            else
                            {
                                already.Add(e);
                                if (!de.ValidateDerivationByRestriction(e, h, schema, raiseError))
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
                foreach (XmlSchemaElement e in all.Items)
                {
                    if (!already.Contains(e))
                    {
                        if (!e.ValidateIsEmptiable())
                        {
                            if (raiseError)
                            {
                                error(h, "In base -all- particle, mapping-skipped base element which is not emptiable was found.");
                            }
                            return(false);
                        }
                    }
                }
                return(true);
            }
            XmlSchemaAny any = baseParticle as XmlSchemaAny;

            if (any != null)
            {
                // NSRecurseCheckCardinality
                return(ValidateNSRecurseCheckCardinality(any, h, schema, raiseError));
            }
            XmlSchemaChoice choice = baseParticle as XmlSchemaChoice;

            if (choice != null)
            {
                // MapAndSum
                // In fact it is not Recurse, but it looks almost common.
                return(ValidateSeqRecurseMapSumCommon(choice, h, schema, false, true, raiseError));
            }
            return(true);
        }
Esempio n. 30
0
 internal override void CheckXsdDeterministic(ArrayList terminalNodes, out BitSet set, out NamespaceList any)
 {
     set = null;
     any = this.any.NamespaceList;
 }
 public string ExportAnyType(string ns)
 {
     string name = "any";
     int num = 0;
     XmlSchema schema = this.schemas[ns];
     if (schema != null)
     {
         while (true)
         {
             XmlSchemaType schemaType = FindSchemaType(name, schema.Items);
             if (schemaType == null)
             {
                 break;
             }
             if (IsAnyType(schemaType, true, true))
             {
                 return name;
             }
             num++;
             name = "any" + num.ToString(CultureInfo.InvariantCulture);
         }
     }
     XmlSchemaComplexType item = new XmlSchemaComplexType {
         Name = name,
         IsMixed = true
     };
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny {
         MinOccurs = 0M,
         MaxOccurs = 79228162514264337593543950335M
     };
     sequence.Items.Add(any);
     item.Particle = sequence;
     this.AddSchemaItem(item, ns, null);
     return name;
 }
 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;
 }
 private void ExportElementAccessor(XmlSchemaGroupBase group, ElementAccessor accessor, bool repeats, bool valueTypeOptional, string ns)
 {
     if (accessor.Any && (accessor.Name.Length == 0))
     {
         XmlSchemaAny item = new XmlSchemaAny {
             MinOccurs = 0M,
             MaxOccurs = repeats ? 79228162514264337593543950335M : 1M
         };
         if (((accessor.Namespace != null) && (accessor.Namespace.Length > 0)) && (accessor.Namespace != ns))
         {
             item.Namespace = accessor.Namespace;
         }
         group.Items.Add(item);
     }
     else
     {
         XmlSchemaElement element = (XmlSchemaElement) this.elements[accessor];
         int num = (((repeats || accessor.HasDefault) || (!accessor.IsNullable && !accessor.Mapping.TypeDesc.IsValueType)) || valueTypeOptional) ? 0 : 1;
         decimal num2 = (repeats || accessor.IsUnbounded) ? 79228162514264337593543950335M : 1M;
         if (element == null)
         {
             element = new XmlSchemaElement {
                 IsNillable = accessor.IsNullable,
                 Name = accessor.Name
             };
             if (accessor.HasDefault)
             {
                 element.DefaultValue = ExportDefaultValue(accessor.Mapping, accessor.Default);
             }
             if (accessor.IsTopLevelInSchema)
             {
                 this.elements.Add(accessor, element);
                 element.Form = accessor.Form;
                 this.AddSchemaItem(element, accessor.Namespace, ns);
             }
             else
             {
                 element.MinOccurs = num;
                 element.MaxOccurs = num2;
                 XmlSchema schema = this.schemas[ns];
                 if (schema == null)
                 {
                     element.Form = (accessor.Form == XmlSchemaForm.Qualified) ? XmlSchemaForm.None : accessor.Form;
                 }
                 else
                 {
                     element.Form = (accessor.Form == schema.ElementFormDefault) ? XmlSchemaForm.None : accessor.Form;
                 }
             }
             this.ExportElementMapping(element, accessor.Mapping, accessor.Namespace, accessor.Any);
         }
         if (accessor.IsTopLevelInSchema)
         {
             XmlSchemaElement element2 = new XmlSchemaElement {
                 RefName = new XmlQualifiedName(accessor.Name, accessor.Namespace),
                 MinOccurs = num,
                 MaxOccurs = num2
             };
             group.Items.Add(element2);
             this.AddSchemaImport(accessor.Namespace, ns);
         }
         else
         {
             group.Items.Add(element);
         }
     }
 }
Esempio n. 34
0
		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;
		}
Esempio n. 35
0
 static XmlSchemaComplexType CreateAnyElementType()
 {
     XmlSchemaComplexType anyElementType = new XmlSchemaComplexType();
     anyElementType.IsMixed = false;
     anyElementType.Particle = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny();
     any.MinOccurs = 0;
     any.ProcessContents = XmlSchemaContentProcessing.Lax;
     ((XmlSchemaSequence)anyElementType.Particle).Items.Add(any);
     return anyElementType;
 }
Esempio n. 36
0
        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);
        }
 private bool IsElementFromAny(XmlSchemaElement derivedElement, XmlSchemaAny baseAny) {
     if (!baseAny.Allows(derivedElement.QualifiedName)) {
         restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromAnyRule1, derivedElement.QualifiedName.ToString());
         return false;
     }
     if (!IsValidOccurrenceRangeRestriction(derivedElement, baseAny)) {
         restrictionErrorMsg = Res.GetString(Res.Sch_ElementFromAnyRule2, derivedElement.QualifiedName.ToString());
         return false;
     }
     return true;
 }
Esempio n. 38
0
        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);
        }
 private bool IsGroupBaseFromAny(XmlSchemaGroupBase derivedGroupBase, XmlSchemaAny baseAny) {
     decimal minOccurs, maxOccurs;
     CalculateEffectiveTotalRange(derivedGroupBase, out minOccurs, out maxOccurs);
     if (!IsValidOccurrenceRangeRestriction(minOccurs, maxOccurs, baseAny.MinOccurs, baseAny.MaxOccurs)) {
         restrictionErrorMsg = Res.GetString(Res.Sch_GroupBaseFromAny2, derivedGroupBase.LineNumber.ToString(NumberFormatInfo.InvariantInfo), derivedGroupBase.LinePosition.ToString(NumberFormatInfo.InvariantInfo), baseAny.LineNumber.ToString(NumberFormatInfo.InvariantInfo), baseAny.LinePosition.ToString(NumberFormatInfo.InvariantInfo));
         return false;
     }
     // eliminate occurrance range check
     string minOccursAny = baseAny.MinOccursString;
     baseAny.MinOccurs = decimal.Zero;
     for (int i = 0; i < derivedGroupBase.Items.Count; ++i) {
         if (!IsValidRestriction((XmlSchemaParticle)derivedGroupBase.Items[i], baseAny)) {
             restrictionErrorMsg = Res.GetString(Res.Sch_GroupBaseFromAny1);
             baseAny.MinOccursString = minOccursAny;
             return false;
         }
     }
     baseAny.MinOccursString = minOccursAny;
     return true;
 }
Esempio n. 40
0
        internal override bool ValidateDerivationByRestriction(XmlSchemaParticle baseParticle, ValidationEventHandler h, XmlSchema schema, bool raiseError)
        {
            if (this == baseParticle)
            {
                return(true);
            }
            XmlSchemaElement xmlSchemaElement = baseParticle as XmlSchemaElement;

            if (xmlSchemaElement != null)
            {
                if (raiseError)
                {
                    base.error(h, "Invalid sequence paricle derivation.");
                }
                return(false);
            }
            XmlSchemaSequence xmlSchemaSequence = baseParticle as XmlSchemaSequence;

            if (xmlSchemaSequence != null)
            {
                return(this.ValidateOccurenceRangeOK(xmlSchemaSequence, h, schema, raiseError) && ((xmlSchemaSequence.ValidatedMinOccurs == 0m && xmlSchemaSequence.ValidatedMaxOccurs == 0m && base.ValidatedMinOccurs == 0m && base.ValidatedMaxOccurs == 0m) || base.ValidateRecurse(xmlSchemaSequence, h, schema, raiseError)));
            }
            XmlSchemaAll xmlSchemaAll = baseParticle as XmlSchemaAll;

            if (xmlSchemaAll != null)
            {
                XmlSchemaObjectCollection xmlSchemaObjectCollection = new XmlSchemaObjectCollection();
                for (int i = 0; i < this.Items.Count; i++)
                {
                    XmlSchemaElement xmlSchemaElement2 = this.Items[i] as XmlSchemaElement;
                    if (xmlSchemaElement2 == null)
                    {
                        if (raiseError)
                        {
                            base.error(h, "Invalid sequence particle derivation by restriction from all.");
                        }
                        return(false);
                    }
                    foreach (XmlSchemaObject xmlSchemaObject in xmlSchemaAll.Items)
                    {
                        XmlSchemaElement xmlSchemaElement3 = (XmlSchemaElement)xmlSchemaObject;
                        if (xmlSchemaElement3.QualifiedName == xmlSchemaElement2.QualifiedName)
                        {
                            if (xmlSchemaObjectCollection.Contains(xmlSchemaElement3))
                            {
                                if (raiseError)
                                {
                                    base.error(h, "Base element particle is mapped to the derived element particle in a sequence two or more times.");
                                }
                                return(false);
                            }
                            xmlSchemaObjectCollection.Add(xmlSchemaElement3);
                            if (!xmlSchemaElement2.ValidateDerivationByRestriction(xmlSchemaElement3, h, schema, raiseError))
                            {
                                return(false);
                            }
                        }
                    }
                }
                foreach (XmlSchemaObject xmlSchemaObject2 in xmlSchemaAll.Items)
                {
                    XmlSchemaElement xmlSchemaElement4 = (XmlSchemaElement)xmlSchemaObject2;
                    if (!xmlSchemaObjectCollection.Contains(xmlSchemaElement4) && !xmlSchemaElement4.ValidateIsEmptiable())
                    {
                        if (raiseError)
                        {
                            base.error(h, "In base -all- particle, mapping-skipped base element which is not emptiable was found.");
                        }
                        return(false);
                    }
                }
                return(true);
            }
            XmlSchemaAny xmlSchemaAny = baseParticle as XmlSchemaAny;

            if (xmlSchemaAny != null)
            {
                return(base.ValidateNSRecurseCheckCardinality(xmlSchemaAny, h, schema, raiseError));
            }
            XmlSchemaChoice xmlSchemaChoice = baseParticle as XmlSchemaChoice;

            return(xmlSchemaChoice == null || base.ValidateSeqRecurseMapSumCommon(xmlSchemaChoice, h, schema, false, true, raiseError));
        }
Esempio n. 41
0
 public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
 {
     XmlSchemaComplexType type = new XmlSchemaComplexType();
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     DsNpStat stat = new DsNpStat();
     xs.Add(stat.GetSchemaSerializable());
     XmlSchemaAny item = new XmlSchemaAny {
         Namespace = "http://www.w3.org/2001/XMLSchema",
         MinOccurs = 0M,
         MaxOccurs = 79228162514264337593543950335M,
         ProcessContents = XmlSchemaContentProcessing.Lax
     };
     sequence.Items.Add(item);
     XmlSchemaAny any2 = new XmlSchemaAny {
         Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1",
         MinOccurs = 1M,
         ProcessContents = XmlSchemaContentProcessing.Lax
     };
     sequence.Items.Add(any2);
     XmlSchemaAttribute attribute = new XmlSchemaAttribute {
         Name = "namespace",
         FixedValue = stat.Namespace
     };
     type.Attributes.Add(attribute);
     XmlSchemaAttribute attribute2 = new XmlSchemaAttribute {
         Name = "tableTypeName",
         FixedValue = "V_NpStatDataTable"
     };
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     return type;
 }
Esempio n. 42
0
		// 3.8.6. Attribute Wildcard Intersection
		// Only try to examine if their intersection is expressible, and
		// returns true if the result is empty.
		public bool ExamineAttributeWildcardIntersection (XmlSchemaAny other,
			ValidationEventHandler h, XmlSchema schema)
		{
			// 1.
			if (this.HasValueAny == other.HasValueAny &&
				this.HasValueLocal == other.HasValueLocal &&
				this.HasValueOther == other.HasValueOther &&
				this.HasValueTargetNamespace == other.HasValueTargetNamespace &&
				this.ResolvedProcessing == other.ResolvedProcessContents) {
				bool notEqual = false;
				for (int i = 0; i < this.ResolvedNamespaces.Count; i++) {
					if (!other.ResolvedNamespaces.Contains (this.ResolvedNamespaces [i]))
						notEqual = true;
				}
				if (!notEqual)
					return false;
			}
			// 2.
			if (this.HasValueAny)
				return !other.HasValueAny &&
					!other.HasValueLocal &&
					!other.HasValueOther &&
					!other.HasValueTargetNamespace &&
					other.ResolvedNamespaces.Count == 0;
			if (other.HasValueAny)
				return !this.HasValueAny &&
					!this.HasValueLocal &&
					!this.HasValueOther &&
					!this.HasValueTargetNamespace &&
					this.ResolvedNamespaces.Count == 0;
			// 5.
			if (this.HasValueOther && other.HasValueOther && this.TargetNamespace != other.TargetNamespace) {
//				xsobj.error (h, "The Wildcard intersection is not expressible.");
				return false;
			}
			// 3.
			if (this.HasValueOther) {
				if (other.HasValueLocal && this.TargetNamespace != String.Empty)
					return false;
				if (other.HasValueTargetNamespace && this.TargetNamespace != other.TargetNamespace)
					return false;
				return other.ValidateWildcardAllowsNamespaceName (this.TargetNamespace, h, schema, false);
			}
			if (other.HasValueOther) {
				if (this.HasValueLocal && other.TargetNamespace != String.Empty)
					return false;
				if (this.HasValueTargetNamespace && other.TargetNamespace != this.TargetNamespace)
					return false;
				return this.ValidateWildcardAllowsNamespaceName (other.TargetNamespace, h, schema, false);
			}
			// 4.
			if (this.ResolvedNamespaces.Count > 0) {
				for (int i = 0; i < this.ResolvedNamespaces.Count; i++)
					if (other.ResolvedNamespaces.Contains (this.ResolvedNamespaces [i]))
						return false;
			}
			return true;
		}
 void Write53_XmlSchemaAny(XmlSchemaAny o) {
     if ((object)o == null) return;
     WriteStartElement("any");
     
     WriteAttribute(@"id", @"", o.@Id);
     WriteAttribute("minOccurs", "", XmlConvert.ToString(o.MinOccurs));
     WriteAttribute(@"maxOccurs", @"", o.MaxOccurs == decimal.MaxValue ? "unbounded" : XmlConvert.ToString(o.MaxOccurs));
     WriteAttribute(@"namespace", @"", ToString(o.NamespaceList));
     XmlSchemaContentProcessing process = o.@ProcessContents == XmlSchemaContentProcessing.@None ? XmlSchemaContentProcessing.Strict : o.@ProcessContents;
     WriteAttribute(@"processContents", @"", Write34_XmlSchemaContentProcessing(process));
     WriteAttributes((XmlAttribute[])o.@UnhandledAttributes, o);
     Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)o.@Annotation);
     WriteEndElement();
 }
Esempio n. 44
0
        private ClrWildCardPropertyInfo BuildAnyProperty(XmlSchemaAny any, bool addToTypeDef)
        {
            ClrWildCardPropertyInfo property = new ClrWildCardPropertyInfo(any.Namespace, any.GetTargetNS(), addToTypeDef, GetOccurence(any));
            property.PropertyName = Constants.Any;

            return property;
        }
 private bool IsElementFromAny(XmlSchemaElement derivedElement, XmlSchemaAny baseAny)
 {
     return (baseAny.Allows(derivedElement.QualifiedName) && this.IsValidOccurrenceRangeRestriction(derivedElement, baseAny));
 }
Esempio n. 46
0
 internal AnyNode(XmlSchemaAny any)
 {
     this.any    = any;
     contentType = Type.Any;
 }
		//Exports <xs:type for SMMessage
		//FIXME: complex type for this can be made static
		QName ExportTypeMessage ()
		{
			XmlSchema xs = GetSchema ("http://schemas.microsoft.com/Message");
			QName qname = new QName ("MessageBody", xs.TargetNamespace);

			foreach (XmlSchemaObject o in xs.Items) {
				XmlSchemaComplexType ct = o as XmlSchemaComplexType;
				if (ct == null)
					continue;

				if (ct.Name == "MessageBody")
					//Already exported
					return qname;
			}

			XmlSchemaComplexType complex_type = new XmlSchemaComplexType ();
			complex_type.Name = "MessageBody";
			XmlSchemaSequence sequence = new XmlSchemaSequence ();

			XmlSchemaAny any = new XmlSchemaAny ();
			any.MinOccurs = 0;
			any.MaxOccursString = "unbounded";
			any.Namespace = "##any";

			sequence.Items.Add (any);
			complex_type.Particle = sequence;

			xs.Items.Add (complex_type);
			GeneratedXmlSchemas.Reprocess (xs);
			
			return qname;
		}
Esempio n. 48
0
        //<any
        //  id = ID
        //  maxOccurs =  (nonNegativeInteger | unbounded)  : 1
        //  minOccurs = nonNegativeInteger : 1
        //  namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local)) )  : ##any
        //  processContents = (lax | skip | strict) : strict
        //  {any attributes with non-schema namespace . . .}>
        //  Content: (annotation?)
        //</any>
        internal static XmlSchemaAny Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaAny any = new XmlSchemaAny();

            reader.MoveToElement();

            if (reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
            {
                error(h, "Should not happen :1: XmlSchemaAny.Read, name=" + reader.Name, null);
                reader.SkipToEnd();
                return(null);
            }

            any.LineNumber   = reader.LineNumber;
            any.LinePosition = reader.LinePosition;
            any.SourceUri    = reader.BaseURI;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    any.Id = reader.Value;
                }
                else if (reader.Name == "maxOccurs")
                {
                    try
                    {
                        any.MaxOccursString = reader.Value;
                    }
                    catch (Exception e)
                    {
                        error(h, reader.Value + " is an invalid value for maxOccurs", e);
                    }
                }
                else if (reader.Name == "minOccurs")
                {
                    try
                    {
                        any.MinOccursString = reader.Value;
                    }
                    catch (Exception e)
                    {
                        error(h, reader.Value + " is an invalid value for minOccurs", e);
                    }
                }
                else if (reader.Name == "namespace")
                {
                    any.nameSpace = reader.Value;
                }
                else if (reader.Name == "processContents")
                {
                    Exception innerex;
                    any.processing = XmlSchemaUtil.ReadProcessingAttribute(reader, out innerex);
                    if (innerex != null)
                    {
                        error(h, reader.Value + " is not a valid value for processContents", innerex);
                    }
                }
                else if ((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
                {
                    error(h, reader.Name + " is not a valid attribute for any", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, any);
                }
            }

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(any);
            }

            //  Content: (annotation?)
            int level = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != xmlname)
                    {
                        error(h, "Should not happen :2: XmlSchemaAny.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (level <= 1 && reader.LocalName == "annotation")
                {
                    level = 2;                          //Only one annotation
                    XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader, h);
                    if (annotation != null)
                    {
                        any.Annotation = annotation;
                    }
                    continue;
                }
                reader.RaiseInvalidElementError();
            }
            return(any);
        }
Esempio n. 49
0
        /**************************************************************************
        The V2.0 (no V1.0 or V1.1) WSDL for Untyped DataTable being returned as a result (no parameters)
        <s:element name="anyUserSpecifiedMethodName">
            <!--  This is where parameters go -->
            <s:complexType /> 
        </s:element>
        <s:element name="anyUserSpecifiedMethodName"+"Response">
            <s:complexType>
                <s:sequence>
                    <s:element minOccurs="0" maxOccurs="1" name="anyUserSpecifiedMethodName"+"Result">
                        <s:complexType>
                            <s:sequence>
                                <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" /> 
                                <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" /> 
                            </s:sequence>
                        </s:complexType>
                    </s:element>
                </s:sequence>
            </s:complexType>
        </s:element>

        Typed DataTable is not supported in WSDL (SQLBU 444636)

        either fails because xsd generates its typed DataTable with an internal parameterless ctor
        
        or System.NullReferenceException: Object reference not set to an instance of an object.   (if namespace of StronglyTyped DataTable is not set)
           at System.Data.XmlTreeGen.FindTargetNamespace(DataTable table)

        or System.InvalidOperationException: Schema Id is missing. The schema returned from WebServiceDataSetServer.Service+StudentsDataTable.GetSchema() must have an Id.
           at System.Xml.Serialization.SerializableMapping.RetrieveSerializableSchema()
        *****************************************************************************/
        public static XmlSchemaComplexType GetDataTableSchema(XmlSchemaSet schemaSet) {
            XmlSchemaComplexType type = new XmlSchemaComplexType();
            XmlSchemaSequence sequence = new XmlSchemaSequence();
            XmlSchemaAny any = new XmlSchemaAny();
            any.Namespace = XmlSchema.Namespace;
            any.MinOccurs = 0;
            any.MaxOccurs = Decimal.MaxValue;
            any.ProcessContents = XmlSchemaContentProcessing.Lax;
            sequence.Items.Add(any);

            any = new XmlSchemaAny();
            any.Namespace = Keywords.DFFNS;
            any.MinOccurs = 1; // when recognizing WSDL - MinOccurs="0" denotes DataSet, a MinOccurs="1" for DataTable
            any.ProcessContents = XmlSchemaContentProcessing.Lax;
            sequence.Items.Add(any);

            type.Particle = sequence;

            return type;
        }
Esempio n. 50
0
        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);
        }