System.Xml.Schema.XmlSchemaObjectTable.Insert C# (CSharp) Method

Insert() private method

private Insert ( XmlQualifiedName name, XmlSchemaObject value ) : void
name System.Xml.XmlQualifiedName
value XmlSchemaObject
return void
        internal void Insert(XmlQualifiedName name,  XmlSchemaObject value) {
            XmlSchemaObject oldValue = null;
            if (table.TryGetValue(name, out oldValue)) {
                table[name] = value; //set new value
                Debug.Assert(oldValue != null);
                int matchedIndex = FindIndexByValue(oldValue);
                Debug.Assert(matchedIndex >= 0);
                //set new entry
                Debug.Assert(entries[matchedIndex].qname == name);
                entries[matchedIndex] = new XmlSchemaObjectEntry(name, value);
            }
            else {
                Add(name, value);
            }
            
        }

Usage Example

Example #1
0
 private bool AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
 {
     if (qname.Name.Length != 0)
     {
         XmlSchemaObject obj2 = table[qname];
         if (obj2 != null)
         {
             if ((obj2 == item) || (obj2.SourceUri == item.SourceUri))
             {
                 return(true);
             }
             string res = string.Empty;
             if (item is XmlSchemaComplexType)
             {
                 res = "Sch_DupComplexType";
             }
             else if (item is XmlSchemaSimpleType)
             {
                 res = "Sch_DupSimpleType";
             }
             else if (item is XmlSchemaElement)
             {
                 res = "Sch_DupGlobalElement";
             }
             else if (item is XmlSchemaAttribute)
             {
                 if (qname.Namespace == "http://www.w3.org/XML/1998/namespace")
                 {
                     XmlSchemaObject obj3 = Preprocessor.GetBuildInSchema().Attributes[qname];
                     if (obj2 == obj3)
                     {
                         table.Insert(qname, item);
                         return(true);
                     }
                     if (item == obj3)
                     {
                         return(true);
                     }
                 }
                 res = "Sch_DupGlobalAttribute";
             }
             this.SendValidationEvent(new XmlSchemaException(res, qname.ToString()), XmlSeverityType.Error);
             return(false);
         }
         table.Add(qname, item);
     }
     return(true);
 }
All Usage Examples Of System.Xml.Schema.XmlSchemaObjectTable::Insert