diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2006-02-22 00:00:20 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2006-02-22 00:00:20 +0300 |
commit | 9aabb9bdc17628106f8551089447089564343b4f (patch) | |
tree | 7c11c2553562f209e340f98c77481b94b69b429c /mcs | |
parent | 4cd416ff69ccd00790162405410c9632fc9afd5a (diff) |
2006-02-21 Atsushi Enomoto <atsushi@ximian.com>
* DTMXPathNavigator2.cs : removed valueBuilder field (create
StringBuilder dynamically).
svn path=/trunk/mcs/; revision=57109
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs | 56 |
2 files changed, 33 insertions, 28 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog index bc116a76b4a..8f2c5677555 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog +++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog @@ -1,3 +1,8 @@ +2006-02-21 Atsushi Enomoto <atsushi@ximian.com> + + * DTMXPathNavigator2.cs : removed valueBuilder field (create + StringBuilder dynamically). + 2006-02-16 Atsushi Enomoto <atsushi@ximian.com> * DTMXPathDocument2.cs, DTMXPathNavigator2.cs : diff --git a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs index 7c7b4793e9c..1981ed85a48 100644 --- a/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs +++ b/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs @@ -97,8 +97,6 @@ namespace Mono.Xml.XPath int currentAttr; int currentNs; - StringBuilder valueBuilder; - #region Properties public override string BaseURI { @@ -219,34 +217,36 @@ namespace Mono.Xml.XPath if (iter == 0) return String.Empty; - if (valueBuilder == null) - valueBuilder = new StringBuilder (); - else - valueBuilder.Length = 0; - - int end = nodes [currentNode].NextSibling; - if (end == 0) { - int tmp = currentNode; - do { - tmp = nodes [tmp].Parent; - end = nodes [tmp].NextSibling; - } while (end == 0 && tmp != 0); - if (end == 0) - end = nodes.Length; - } + StringBuilder builder = null; + BuildValue (iter, ref builder); + return builder == null ? String.Empty : builder.ToString (); + } + } + + void BuildValue (int iter, ref StringBuilder valueBuilder) + { + int end = nodes [currentNode].NextSibling; + if (end == 0) { + int tmp = currentNode; + do { + tmp = nodes [tmp].Parent; + end = nodes [tmp].NextSibling; + } while (end == 0 && tmp != 0); + if (end == 0) + end = nodes.Length; + } - while (iter < end) { - switch (nodes [iter].NodeType) { - case XPathNodeType.Text: - case XPathNodeType.SignificantWhitespace: - case XPathNodeType.Whitespace: - valueBuilder.Append (nonAtomicStringPool [nodes [iter].Value]); - break; - } - iter++; + while (iter < end) { + switch (nodes [iter].NodeType) { + case XPathNodeType.Text: + case XPathNodeType.SignificantWhitespace: + case XPathNodeType.Whitespace: + if (valueBuilder == null) + valueBuilder = new StringBuilder (); + valueBuilder.Append (nonAtomicStringPool [nodes [iter].Value]); + break; } - - return valueBuilder.ToString (); + iter++; } } |