diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-02-16 20:33:06 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-02-16 20:33:06 +0300 |
commit | 9a3dbd293439ed1b3680af06e3d636cc18d665da (patch) | |
tree | 1a0c3ae121bcc431a72e6790bf447ee12cdd26fa /mcs/class/System.XML/Mono.Xml.XPath | |
parent | 648d3f7b0d670735bb3b02aa53f4feb3d18dd0ab (diff) |
2006-02-16 Atsushi Enomoto <atsushi@ximian.com>
* DTMXPathDocument2.cs, DTMXPathNavigator2.cs :
Do not store mutable XPathDocument fields in every navigators.
It saves memory a lot.
svn path=/trunk/mcs/; revision=56951
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument2.cs | 32 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs | 60 |
3 files changed, 52 insertions, 46 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index 2e038e25d5a..bc116a76b4a 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,9 @@ +2006-02-16 Atsushi Enomoto <atsushi@ximian.com> + + * DTMXPathDocument2.cs, DTMXPathNavigator2.cs : + Do not store mutable XPathDocument fields in every navigators. + It saves memory a lot. + 2005-12-14 Atsushi Enomoto <atsushi@ximian.com> * XPathNavigatorReader.cs : oh, so it used to compile under 1.x. diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument2.cs index 43fa3d80759..4bcc077c8f4 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument2.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathDocument2.cs @@ -50,14 +50,15 @@ namespace Mono.Xml.XPath string [] nonAtomicStringPool, Hashtable idTable) { - root = new DTMXPathNavigator2 (this, - nameTable, - nodes, - attributes, - namespaces, - atomicStringPool, - nonAtomicStringPool, - idTable); + this.Nodes = nodes; + this.Attributes = attributes; + this.Namespaces = namespaces; + this.AtomicStringPool = atomicStringPool; + this.NonAtomicStringPool = nonAtomicStringPool; + this.IdTable = idTable; + this.NameTable = nameTable; + + root = new DTMXPathNavigator2 (this); } public XPathNavigator CreateNavigator () @@ -65,7 +66,20 @@ namespace Mono.Xml.XPath return root.Clone (); } - XPathNavigator root; + readonly XPathNavigator root; + + internal readonly XmlNameTable NameTable; + + internal readonly DTMXPathLinkedNode2 [] Nodes; + internal readonly DTMXPathAttributeNode2 [] Attributes; + internal readonly DTMXPathNamespaceNode2 [] Namespaces; + + // String pool + internal readonly string [] AtomicStringPool; + internal readonly string [] NonAtomicStringPool; + + // ID table + internal readonly Hashtable IdTable; } } diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs index 6280e3d1bba..7c7b4793e9c 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs @@ -44,33 +44,16 @@ namespace Mono.Xml.XPath class DTMXPathNavigator2 : XPathNavigator, IXmlLineInfo { - public DTMXPathNavigator2 (DTMXPathDocument2 document, - XmlNameTable nameTable, - DTMXPathLinkedNode2 [] nodes, - DTMXPathAttributeNode2 [] attributes, - DTMXPathNamespaceNode2 [] namespaces, - string [] atomicStringPool, - string [] nonAtomicStringPool, - Hashtable idTable) + public DTMXPathNavigator2 (DTMXPathDocument2 document) { - this.nodes = nodes; - this.attributes = attributes; - this.namespaces = namespaces; - this.atomicStringPool = atomicStringPool; - this.nonAtomicStringPool = nonAtomicStringPool; - this.idTable = idTable; - this.nameTable = nameTable; this.MoveToRoot (); this.document = document; } // Copy constructor including position informations. public DTMXPathNavigator2 (DTMXPathNavigator2 org) - : this (org.document, org.nameTable, - org.nodes, org.attributes, org.namespaces, - org.atomicStringPool, org.nonAtomicStringPool, - org.idTable) { + document = org.document; currentIsNode = org.currentIsNode; currentIsAttr = org.currentIsAttr; @@ -79,21 +62,33 @@ namespace Mono.Xml.XPath currentNs = org.currentNs; } - XmlNameTable nameTable; + XmlNameTable nameTable { + get { return document.NameTable; } + } // Created XPathDocument. This is used to identify the origin of the navigator. DTMXPathDocument2 document; - DTMXPathLinkedNode2 [] nodes;// = new DTMXPathLinkedNode [0]; - DTMXPathAttributeNode2 [] attributes;// = new DTMXPathAttributeNode [0]; - DTMXPathNamespaceNode2 [] namespaces;// = new DTMXPathNamespaceNode [0]; - - // String pool - string [] atomicStringPool; - string [] nonAtomicStringPool; + DTMXPathLinkedNode2 [] nodes { + get { return document.Nodes; } + } + DTMXPathAttributeNode2 [] attributes { + get { return document.Attributes; } + } + DTMXPathNamespaceNode2 [] namespaces { + get { return document.Namespaces; } + } + string [] atomicStringPool { + get { return document.AtomicStringPool; } + } + string [] nonAtomicStringPool { + get { return document.NonAtomicStringPool; } + } // ID table - Hashtable idTable; + Hashtable idTable { + get { return document.IdTable; } + } bool currentIsNode; bool currentIsAttr; @@ -104,15 +99,6 @@ namespace Mono.Xml.XPath StringBuilder valueBuilder; -#region Ctor - - internal DTMXPathNavigator2 (XmlNameTable nt) - { - this.nameTable = nt; - } - -#endregion - #region Properties public override string BaseURI { |