Exemple #1
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);
     }
 }
Exemple #2
0
        public void RaiseInvalidElementError()
        {
            string errstr = "Element " + FullName + " is invalid in this context.\n";

            if (hasLineInfo)
            {
                errstr += "The error occured on (" + ((IXmlLineInfo)reader).LineNumber
                          + "," + ((IXmlLineInfo)reader).LinePosition + ")";
            }
            XmlSchemaObject.error(handler, errstr, null);
            SkipToEnd();
        }
Exemple #3
0
 public static void CompileID(string id, XmlSchemaObject xso, Hashtable idCollection, ValidationEventHandler h)
 {
     //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#ID
     // 1. ID must be a NCName
     // 2. ID must be unique in the schema
     if (id == null)
     {
         return;
     }
     if (!CheckNCName(id))
     {
         xso.error(h, id + " is not a valid id attribute");
     }
     else if (idCollection.ContainsKey(id))
     {
         xso.error(h, "Duplicate id attribute " + id);
     }
     else
     {
         idCollection.Add(id, xso);
     }
 }