Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2005-03-22 15:32:31 +0300
committerAtsushi Eno <atsushieno@gmail.com>2005-03-22 15:32:31 +0300
commite6503839bbdc27a3ffe99d62a39e4d32f26fdac2 (patch)
treeb4bb4ef551c46a084fbabe284691ed8b7600f748 /mcs/class/System.XML/Mono.Xml.XPath
parentfd33ebbc47e34fbc0a35ab8b0a584907a88c5a3d (diff)
2005-03-22 Atsushi Enomoto <atsushi@ximian.com>
* IdPattern.cs, LocationPathPattern.cs : Use XsltCompiledContext.GetNavCache() that returns reusable navigator cache for each pattern, to avoid Clone() and not to leave reference to already-done instance navigator. * XslTransformProcessor.cs : now it looks safe to remove SetContext() from each EvaluateXXX() methods. * MsxslScriptManager.cs : not to leave reference to stylesheet navigator, pass current node to Compile(). * XslCompiledContext.cs : Added GetNavCache() that returns reusable navigator cache for each pattern, to avoid Clone() and not to leave reference to already-done instance navigator. svn path=/trunk/mcs/; revision=42101
Diffstat (limited to 'mcs/class/System.XML/Mono.Xml.XPath')
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/ChangeLog7
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs3
-rw-r--r--mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs27
3 files changed, 19 insertions, 18 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
index 3e77a1e5472..2554ae802a5 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
@@ -1,3 +1,10 @@
+2005-03-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * IdPattern.cs, LocationPathPattern.cs :
+ Use XsltCompiledContext.GetNavCache() that returns reusable
+ navigator cache for each pattern, to avoid Clone() and not to leave
+ reference to already-done instance navigator.
+
2004-03-22 Atsushi Enomoto <atsushi@ximian.com>
* Pattern.cs : Pattern.Compile() now uses XSLT pattern parser instead
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs
index 696100713ab..7be75056a95 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/IdPattern.cs
@@ -35,6 +35,7 @@ using System.Xml;
using System.Xml.Schema;
using System.Xml.XPath;
using System.Xml.Xsl;
+using Mono.Xml.Xsl;
namespace Mono.Xml.XPath {
internal class IdPattern : LocationPathPattern {
@@ -49,7 +50,7 @@ namespace Mono.Xml.XPath {
public override bool Matches (XPathNavigator node, XsltContext ctx)
{
- XPathNavigator tmp = node.Clone ();
+ XPathNavigator tmp = ((XsltCompiledContext) ctx).GetNavCache (this, node);
for (int i = 0; i < ids.Length; i++)
if (tmp.MoveToId (ids [i]) && tmp.IsSamePosition (node))
return true;
diff --git a/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs b/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs
index 1461e96d4dd..8a6133a708b 100644
--- a/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs
+++ b/mcs/class/System.XML/Mono.Xml.XPath/LocationPathPattern.cs
@@ -35,6 +35,7 @@ using System.Xml;
using System.Xml.Schema;
using System.Xml.XPath;
using System.Xml.Xsl;
+using Mono.Xml.Xsl;
namespace Mono.Xml.XPath {
internal class LocationPathPattern : Pattern {
@@ -43,7 +44,6 @@ namespace Mono.Xml.XPath {
bool isAncestor;
NodeTest nodeTest;
ExprFilter filter;
- XPathNavigator previousNavigator;
public LocationPathPattern (NodeTest nodeTest)
{
@@ -100,19 +100,19 @@ namespace Mono.Xml.XPath {
if (filter == null && patternPrevious == null)
return true;
+ XPathNavigator tmpNav;
if (patternPrevious != null) {
+ tmpNav = ((XsltCompiledContext) ctx).GetNavCache (this, node);
if (!isAncestor) {
- XPathNavigator parent = node.Clone ();
- parent.MoveToParent ();
- if (!patternPrevious.Matches (parent, ctx))
+ tmpNav.MoveToParent ();
+ if (!patternPrevious.Matches (tmpNav, ctx))
return false;
} else {
- XPathNavigator anc = node.Clone ();
while (true) {
- if (!anc.MoveToParent ())
+ if (!tmpNav.MoveToParent ())
return false;
- if (patternPrevious.Matches (anc, ctx))
+ if (patternPrevious.Matches (tmpNav, ctx))
break;
}
}
@@ -127,17 +127,10 @@ namespace Mono.Xml.XPath {
return filter.pred.EvaluateBoolean (new NullIterator (node, ctx));
}
- XPathNavigator p = null;
- if (previousNavigator == node) {
- p = previousNavigator;
- p.MoveTo (node);
- } else {
- p = node.Clone ();
- previousNavigator = p;
- }
- p.MoveToParent ();
+ tmpNav = ((XsltCompiledContext) ctx).GetNavCache (this, node);
+ tmpNav.MoveToParent ();
- BaseIterator matches = filter.EvaluateNodeSet (new NullIterator (p, ctx));
+ BaseIterator matches = filter.EvaluateNodeSet (new NullIterator (tmpNav, ctx));
while (matches.MoveNext ()) {
if (node.IsSamePosition (matches.Current))