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 18:44:41 +0300
committerAtsushi Eno <atsushieno@gmail.com>2005-03-22 18:44:41 +0300
commitbf86f5ec7b05763aae569c2787f79cd6f0206b60 (patch)
tree41cfd55b84055c05e92ce10d4a4fca5ae618c358 /mcs/class/System.XML/System.Xml.XPath
parent106825292376b319be92665461cc886f88cc5364 (diff)
2004-03-22 Atsushi Enomoto <atsushi@ximian.com>
* Expression.cs : EvaluateBoolean() for RTF should check return true for empty elements. Fixed static analysis for RTF. * XslTransformTests.cs : added test 1)that examines pattern sanity and 2)that examines if empty element RTF is evaluated as true for bool. --his line, and those below, will be ignored-- M System.Xml.XPath/ChangeLog M System.Xml.XPath/Expression.cs M Test/System.Xml.Xsl/ChangeLog M Test/System.Xml.Xsl/XslTransformTests.cs M Test/System.Xml.Xsl/standalone_tests/Makefile svn path=/trunk/mcs/; revision=42118
Diffstat (limited to 'mcs/class/System.XML/System.Xml.XPath')
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/ChangeLog5
-rw-r--r--mcs/class/System.XML/System.Xml.XPath/Expression.cs12
2 files changed, 15 insertions, 2 deletions
diff --git a/mcs/class/System.XML/System.Xml.XPath/ChangeLog b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
index 31c8105dbfa..55cd70bf456 100644
--- a/mcs/class/System.XML/System.Xml.XPath/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.XPath/ChangeLog
@@ -1,5 +1,10 @@
2004-03-22 Atsushi Enomoto <atsushi@ximian.com>
+ * Expression.cs : EvaluateBoolean() for RTF should check return true
+ for empty elements. Fixed static analysis for RTF.
+
+2004-03-22 Atsushi Enomoto <atsushi@ximian.com>
+
* Parser.jay, Tokenizer.cs : Now they are used as common code base for
XPath parser and XSLT pattern parser. Makefile now creates two
set of sources of them. (This change takes effect on the next change).
diff --git a/mcs/class/System.XML/System.Xml.XPath/Expression.cs b/mcs/class/System.XML/System.Xml.XPath/Expression.cs
index 379dd8eaba8..1ddc14dcfc0 100644
--- a/mcs/class/System.XML/System.Xml.XPath/Expression.cs
+++ b/mcs/class/System.XML/System.Xml.XPath/Expression.cs
@@ -419,6 +419,10 @@ namespace System.Xml.XPath
get { return HasStaticValue ? XPathFunctions.ToBoolean (StaticValue) : false; }
}
+ public virtual XPathNavigator StaticValueAsNavigator {
+ get { return StaticValue as XPathNavigator; }
+ }
+
public abstract object Evaluate (BaseIterator iter);
public virtual BaseIterator EvaluateNodeSet (BaseIterator iter)
@@ -553,7 +557,7 @@ namespace System.Xml.XPath
return (iterResult != null && iterResult.MoveNext ());
}
case XPathResultType.Navigator:
- return ((string) ((XPathNavigator) result).Value).Length != 0;
+ return (((XPathNavigator) result).HasChildren);
default:
throw new XPathException ("invalid node type");
}
@@ -700,13 +704,17 @@ namespace System.Xml.XPath
get {
if (!HasStaticValue)
return false;
+ if ((_left.ReturnType == XPathResultType.Navigator || _right.ReturnType == XPathResultType.Navigator) && _left.ReturnType == _right.ReturnType)
+ return (_left.StaticValueAsNavigator.IsSamePosition (
+ _right.StaticValueAsNavigator))
+ == trueVal;
if (_left.ReturnType == XPathResultType.Boolean | _right.ReturnType == XPathResultType.Boolean)
return (_left.StaticValueAsBoolean == _right.StaticValueAsBoolean) == trueVal;
if (_left.ReturnType == XPathResultType.Number | _right.ReturnType == XPathResultType.Number)
return (_left.StaticValueAsNumber == _right.StaticValueAsNumber) == trueVal;
if (_left.ReturnType == XPathResultType.String | _right.ReturnType == XPathResultType.String)
return (_left.StaticValueAsString == _right.StaticValueAsString) == trueVal;
- return _left.StaticValue == _right.StaticValue;
+ return _left.StaticValue == _right.StaticValue == trueVal;
}
}