Example #1
1
		public static void AddToTable (XmlSchemaObjectTable table, XmlSchemaObject obj,
			XmlQualifiedName qname, ValidationEventHandler h)
		{
			if (table.Contains (qname)) {
				// FIXME: This logic unexpectedly allows 
				// one redefining item and two or more redefining items.
				// FIXME: redefining item is not simple replacement,
				// but much more complex stuff.
				if (obj.isRedefineChild) {	// take precedence.
					if (obj.redefinedObject != null)
						obj.error (h, String.Format ("Named item {0} was already contained in the schema object table.", qname));
					else
						obj.redefinedObject = table [qname];
					table.Set (qname, obj);
				}
				else if (table [qname].isRedefineChild) {
					if (table [qname].redefinedObject != null)
						obj.error (h, String.Format ("Named item {0} was already contained in the schema object table.", qname));
					else
						table [qname].redefinedObject = obj;
					return;	// never add to the table.
				}
				else if (StrictMsCompliant) {
					table.Set (qname, obj);
				}
				else
					obj.error (h, String.Format ("Named item {0} was already contained in the schema object table. {1}",
					                             qname, "Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation."));
			}
			else
				table.Set (qname, obj);
		}
Example #2
0
 public static void AddToTable(XmlSchemaObjectTable table, XmlSchemaObject obj,
                               XmlQualifiedName qname, ValidationEventHandler h)
 {
     if (table.Contains(qname))
     {
         // FIXME: This logic unexpectedly allows
         // one redefining item and two or more redefining items.
         // FIXME: redefining item is not simple replacement,
         // but much more complex stuff.
         if (obj.isRedefineChild)                        // take precedence.
         {
             if (obj.redefinedObject != null)
             {
                 obj.error(h, String.Format("Named item {0} was already contained in the schema object table.", qname));
             }
             else
             {
                 obj.redefinedObject = table [qname];
             }
             table.Set(qname, obj);
         }
         else if (table [qname].isRedefineChild)
         {
             if (table [qname].redefinedObject != null)
             {
                 obj.error(h, String.Format("Named item {0} was already contained in the schema object table.", qname));
             }
             else
             {
                 table [qname].redefinedObject = obj;
             }
             return;                     // never add to the table.
         }
         else if (StrictMsCompliant)
         {
             table.Set(qname, obj);
         }
         else
         {
             obj.error(h, String.Format("Named item {0} was already contained in the schema object table. {1}",
                                        qname, "Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation."));
         }
     }
     else
     {
         table.Set(qname, obj);
     }
 }
Example #3
0
 public static void AddToTable(XmlSchemaObjectTable table, XmlSchemaObject obj, XmlQualifiedName qname, ValidationEventHandler h)
 {
     if (table.Contains(qname))
     {
         if (obj.isRedefineChild)
         {
             if (obj.redefinedObject != null)
             {
                 obj.error(h, string.Format("Named item {0} was already contained in the schema object table.", qname));
             }
             else
             {
                 obj.redefinedObject = table[qname];
             }
             table.Set(qname, obj);
         }
         else
         {
             if (table[qname].isRedefineChild)
             {
                 if (table[qname].redefinedObject != null)
                 {
                     obj.error(h, string.Format("Named item {0} was already contained in the schema object table.", qname));
                 }
                 else
                 {
                     table[qname].redefinedObject = obj;
                 }
                 return;
             }
             if (XmlSchemaUtil.StrictMsCompliant)
             {
                 table.Set(qname, obj);
             }
             else
             {
                 obj.error(h, string.Format("Named item {0} was already contained in the schema object table. {1}", qname, "Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic MS implementation."));
             }
         }
     }
     else
     {
         table.Set(qname, obj);
     }
 }
Example #4
0
        void ValidateUPAOnItems(XmlSchemaObjectTable qnames, ArrayList nsNames,
                                ValidationEventHandler h, XmlSchema schema)
        {
            // non-optional components
            XmlSchemaObjectTable elems        = new XmlSchemaObjectTable();
            ArrayList            wildcards    = new ArrayList();
            XmlSchemaObjectTable tmpElems     = new XmlSchemaObjectTable();
            ArrayList            tmpWildcards = new ArrayList();

            for (int i = 0; i < Items.Count; i++)
            {
                XmlSchemaParticle p1 = Items [i] as XmlSchemaParticle;
                p1.ValidateUniqueParticleAttribution(elems, wildcards, h, schema);
                if (p1.ValidatedMinOccurs == p1.ValidatedMaxOccurs)
                {
                    elems.Clear();
                    wildcards.Clear();
                }
                else
                {
                    if (p1.ValidatedMinOccurs != 0)
                    {
                        foreach (XmlQualifiedName n in tmpElems.Names)
                        {
                            elems.Set(n, null);                              // remove
                        }
                        foreach (object o in tmpWildcards)
                        {
                            wildcards.Remove(o);
                        }
                    }
                    foreach (XmlQualifiedName n in elems.Names)
                    {
                        tmpElems.Set(n, elems [n]);
                    }
                    tmpWildcards.Clear();
                    tmpWildcards.AddRange(wildcards);
                }
            }
        }
Example #5
0
        private void ValidateUPAOnItems(XmlSchemaObjectTable qnames, ArrayList nsNames, ValidationEventHandler h, XmlSchema schema)
        {
            XmlSchemaObjectTable xmlSchemaObjectTable  = new XmlSchemaObjectTable();
            ArrayList            arrayList             = new ArrayList();
            XmlSchemaObjectTable xmlSchemaObjectTable2 = new XmlSchemaObjectTable();
            ArrayList            arrayList2            = new ArrayList();

            for (int i = 0; i < this.Items.Count; i++)
            {
                XmlSchemaParticle xmlSchemaParticle = this.Items[i] as XmlSchemaParticle;
                xmlSchemaParticle.ValidateUniqueParticleAttribution(xmlSchemaObjectTable, arrayList, h, schema);
                if (xmlSchemaParticle.ValidatedMinOccurs == xmlSchemaParticle.ValidatedMaxOccurs)
                {
                    xmlSchemaObjectTable.Clear();
                    arrayList.Clear();
                }
                else
                {
                    if (xmlSchemaParticle.ValidatedMinOccurs != 0m)
                    {
                        foreach (object obj in xmlSchemaObjectTable2.Names)
                        {
                            XmlQualifiedName name = (XmlQualifiedName)obj;
                            xmlSchemaObjectTable.Set(name, null);
                        }
                        foreach (object obj2 in arrayList2)
                        {
                            arrayList.Remove(obj2);
                        }
                    }
                    foreach (object obj3 in xmlSchemaObjectTable.Names)
                    {
                        XmlQualifiedName name2 = (XmlQualifiedName)obj3;
                        xmlSchemaObjectTable2.Set(name2, xmlSchemaObjectTable[name2]);
                    }
                    arrayList2.Clear();
                    arrayList2.AddRange(arrayList);
                }
            }
        }
Example #6
0
		void ValidateUPAOnItems (XmlSchemaObjectTable qnames, ArrayList nsNames,
			ValidationEventHandler h, XmlSchema schema)
		{
			// non-optional components
			XmlSchemaObjectTable elems = new XmlSchemaObjectTable ();
			ArrayList wildcards = new ArrayList ();
			XmlSchemaObjectTable tmpElems = new XmlSchemaObjectTable ();
			ArrayList tmpWildcards = new ArrayList ();
			for (int i=0; i<Items.Count; i++) {
				XmlSchemaParticle p1 = Items [i] as XmlSchemaParticle;
				p1.ValidateUniqueParticleAttribution (elems, wildcards, h, schema);
				if (p1.ValidatedMinOccurs == p1.ValidatedMaxOccurs) {
					elems.Clear ();
					wildcards.Clear ();
				}
				else {
					if (p1.ValidatedMinOccurs != 0) {
						foreach (XmlQualifiedName n in tmpElems.Names)
							elems.Set (n, null); // remove
						foreach (object o in tmpWildcards)
							wildcards.Remove (o);
					}
					foreach (XmlQualifiedName n in elems.Names)
						tmpElems.Set (n, elems [n]);
					tmpWildcards.Clear ();
					tmpWildcards.AddRange (wildcards);
				}
			}
		}