2004-11-05 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Sun, 7 Nov 2004 15:11:44 +0000 (15:11 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Sun, 7 Nov 2004 15:11:44 +0000 (15:11 -0000)
* XmlSchemaSet.cs : reduced extraneous XmlSchemaObjectTable creation.

svn path=/trunk/mcs/; revision=35779

mcs/class/System.XML/System.Xml.Schema/ChangeLog
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs

index 8d8ba3f472cd8239595dfb38d9038a083e91d4bc..75395bbd04b036d6201ad47d46e868e59e08cc24 100755 (executable)
@@ -1,3 +1,7 @@
+2004-11-05  Atsushi Enomoto <atsushi@ximian.com>
+
+       * XmlSchemaSet.cs : reduced extraneous XmlSchemaObjectTable creation.
+
 2004-11-05  Atsushi Enomoto <atsushi@ximian.com>
 
        * XmlSchemaSimpleTypeList.cs,
index f7db88abf8f917560acba056a49617a4c9971e11..d47a46485021ab587884c25df34edf6ab9f30be4 100644 (file)
@@ -76,9 +76,6 @@ namespace System.Xml.Schema
                        this.nameTable = nameTable;
                        schemas = new ArrayList ();
                        CompilationId = Guid.NewGuid ();
-                       elements = new XmlSchemaObjectTable ();
-                       attributes = new XmlSchemaObjectTable ();
-                       types = new XmlSchemaObjectTable ();
                }
 
                public event ValidationEventHandler ValidationEventHandler;
@@ -88,15 +85,27 @@ namespace System.Xml.Schema
                }
 
                public XmlSchemaObjectTable GlobalAttributes {
-                       get { return attributes; }
+                       get {
+                               if (attributes == null)
+                                       attributes = new XmlSchemaObjectTable ();
+                               return attributes;
+                       }
                }
 
                public XmlSchemaObjectTable GlobalElements {
-                       get { return elements; }
+                       get {
+                               if (elements == null)
+                                       elements = new XmlSchemaObjectTable ();
+                               return elements;
+                       }
                }
 
                public XmlSchemaObjectTable GlobalTypes { 
-                       get { return types; }
+                       get {
+                               if (types == null)
+                                       types = new XmlSchemaObjectTable ();
+                               return types;
+                       }
                }
 
                public bool IsCompiled { 
@@ -185,11 +194,11 @@ namespace System.Xml.Schema
                private void AddGlobalComponents (XmlSchema schema)
                {
                        foreach (XmlSchemaElement el in schema.Elements.Values)
-                               elements.Add (el.QualifiedName, el);
+                               GlobalElements.Add (el.QualifiedName, el);
                        foreach (XmlSchemaAttribute a in schema.Attributes.Values)
-                               attributes.Add (a.QualifiedName, a);
+                               GlobalAttributes.Add (a.QualifiedName, a);
                        foreach (XmlSchemaType t in schema.SchemaTypes.Values)
-                               types.Add (t.QualifiedName, t);
+                               GlobalTypes.Add (t.QualifiedName, t);
                }
 
                public bool Contains (string targetNamespace)