Contains() public method

public Contains ( XmlQualifiedName name ) : bool
name System.Xml.XmlQualifiedName
return bool
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);
     }
 }
 internal override void VerifySchemaValid(XmlSchemaObjectTable notations, XmlSchemaObject caller)
 {
     for (Datatype_NOTATION e_notation = this; e_notation != null; e_notation = (Datatype_NOTATION) e_notation.Base)
     {
         if ((e_notation.Restriction != null) && ((e_notation.Restriction.Flags & RestrictionFlags.Enumeration) != 0))
         {
             for (int i = 0; i < e_notation.Restriction.Enumeration.Count; i++)
             {
                 XmlQualifiedName name = (XmlQualifiedName) e_notation.Restriction.Enumeration[i];
                 if (!notations.Contains(name))
                 {
                     throw new XmlSchemaException("Sch_NotationRequired", caller);
                 }
             }
             return;
         }
     }
     throw new XmlSchemaException("Sch_NotationRequired", caller);
 }
 internal override void VerifySchemaValid(XmlSchemaObjectTable notations, XmlSchemaObject caller)
 {
     for (Datatype_NOTATION e_notation = this; e_notation != null; e_notation = (Datatype_NOTATION)e_notation.Base)
     {
         if ((e_notation.Restriction != null) && ((e_notation.Restriction.Flags & RestrictionFlags.Enumeration) != 0))
         {
             for (int i = 0; i < e_notation.Restriction.Enumeration.Count; i++)
             {
                 XmlQualifiedName name = (XmlQualifiedName)e_notation.Restriction.Enumeration[i];
                 if (!notations.Contains(name))
                 {
                     throw new XmlSchemaException("Sch_NotationRequired", caller);
                 }
             }
             return;
         }
     }
     throw new XmlSchemaException("Sch_NotationRequired", caller);
 }
        internal override void VerifySchemaValid(XmlSchemaObjectTable notations, XmlSchemaObject caller) {

            // Only datatypes that are derived from NOTATION by specifying a value for enumeration can be used in a schema.
            // Furthermore, the value of all enumeration facets must match the name of a notation declared in the current schema.                    //
            for(Datatype_NOTATION dt = this; dt != null; dt = (Datatype_NOTATION)dt.Base) {
                if (dt.Restriction != null && (dt.Restriction.Flags & RestrictionFlags.Enumeration) != 0) {
                    for (int i = 0; i < dt.Restriction.Enumeration.Count; ++i) {
                        XmlQualifiedName notation = (XmlQualifiedName)dt.Restriction.Enumeration[i];
                        if (!notations.Contains(notation)) {
                            throw new XmlSchemaException(Res.Sch_NotationRequired, caller);
                        }
                    }
                    return;
                }
            }
            throw new XmlSchemaException(Res.Sch_NotationRequired, caller);
        }
Example #7
0
		internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
			ValidationEventHandler h, XmlSchema schema)
		{
			if (qnames.Contains (this.QualifiedName))// && !this.ParticleEquals ((XmlSchemaParticle) qnames [this.QualifiedName]))
				error (h, "Ambiguous element label was detected: " + this.QualifiedName);
			else {
				foreach (XmlSchemaAny any in nsNames) {
					if (any.ValidatedMaxOccurs == 0)
						continue;
					if (any.HasValueAny ||
						any.HasValueLocal && this.QualifiedName.Namespace == "" ||
						any.HasValueOther && this.QualifiedName.Namespace != this.QualifiedName.Namespace ||
						any.HasValueTargetNamespace && this.QualifiedName.Namespace == this.QualifiedName.Namespace) {
						error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
						break;
					} else if (!any.HasValueOther) {
						bool bad = false;
						foreach (string ns in any.ResolvedNamespaces) {
							if (ns == this.QualifiedName.Namespace) {
								bad = true;
								break;
							}
						}
						if (bad) {
							error (h, "Ambiguous element label which is contained by -any- particle was detected: " + this.QualifiedName);
							break;
						}
					} else {
						if (any.TargetNamespace != this.QualifiedName.Namespace)
							error (h, String.Format ("Ambiguous element label '{0}' which is contained by -any- particle with ##other value than '{1}' was detected: ", this.QualifiedName.Namespace, any.TargetNamespace));
					}
				}
				qnames.Add (this.QualifiedName, this);
			}
		}
 /// <summary>
 ///     Returns the XmlSchemaObject with the given qname from the given table, or null if no such object exists
 /// </summary>
 /// <param name="objectTable"></param>
 /// <param name="qname"></param>
 /// <returns></returns>
 private static XmlSchemaObject GetXmlSchemaObject(XmlSchemaObjectTable objectTable, XmlQualifiedName qname)
 {
     XmlSchemaObject xo = null;
     if (objectTable.Contains(qname))
     {
         xo = objectTable[qname];
     }
     return xo;
 }