Commit Graph
50 Commits
Author SHA1 Message Date
Atsushi Eno 9c9546c9ea Revert previous non-standard "ends-with" function.
A valid way to do equivalent, from IRC:

[12:05] <eno> miguel: I believe you shouldn't add non-standard "ends-with" as the standard XPath implementation. Use extension framework instead.
[12:05] <eno> regarding https://github.com/mono/mono/commit/9b07497f9067ab4d3f4a7964f2868c7eafef1b5d
[13:39] <migueld> Seems like it is XPath 2.0
[13:46] <eno> Yes, XPath 2.0 contains that one. .NET implementation is for 1.0.
[13:46] <eno> This would help you to use XSLT extension http://msdn.microsoft.com/en-us/library/tf741884.aspx
[13:47] <eno> or this might be handy: http://msdn.microsoft.com/en-us/library/wxaw5z5e.aspx
[13:49] <eno> Add this under <stylesheet> or <transform> : <msxsl:script language="C#" implements-prefix="x" xmlns:msxsl="urn:schemas-microsoft-com:xslt">public bool ends_with (string s, string target) { return s.EndsWith (target); }</msxsl:script>
[13:49] <eno> and use "x:ends_with(foo, bar)" instead
2012-03-01 23:51:55 +09:00
Miguel de Icaza 9b07497f90 Add ends-with function to our XPath processor 2012-02-29 20:44:39 -05:00
David Eisner daae18420a Fixed the XPath built-in position function for bug #497017
According to http://www.w3.org/TR/xpath#predicates, a predicate [n] should be equivalent to [position()=n] for a number expression n. However, we currently have a PredicateIterator intepretation of [n] that has been corrected for the issue outlined in the bug report, leaving the position() function behind with an inappropriate, document-order value for reverse axes. Note that [n] is not treated by parsing or transforming to the same form as [position()=n] before evaluation, valid as that would be.

The discussion in that same section of the recommendation about forward and reverse axes and further remarks in http://www.w3.org/TR/xpath#node-sets make it clear that the predicate [1] has the sense of "nearest" rather than "first in the document" which then, depending on the axis type, may be the same or reverse of the document order. It does not seem to me to be so clear whether the order given by a navigator for a location path expression should mirror this or always give the document order. The .Net implementation seems to always give the document order, as well as predicates having the correct reverse/forward senses, so I have added test cases that explore both.
2011-07-21 23:07:02 +01:00
Atsushi Eno 8b5e57c908 2009-11-20 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : do not use sloppy XmlConvert to parse xpath
	  number. Fixed bug #556619.

	* XslTransformTests.cs : added test for bug #556619 by
	  Tor Lillqvist.


svn path=/trunk/mcs/; revision=146613
2009-11-20 12:06:16 +00:00
Atsushi Eno e30d02ad83 merge XPath optimization branch. About 15% faster/less memory use so
far.


svn path=/trunk/mcs/; revision=118710
2008-11-13 13:05:44 +00:00
Atsushi Eno 5a15db1e4c 2008-09-19 Atsushi Enomoto <[email protected]>
* DefaultContext.cs, Expression.cs: do not premise BaseIterator.


svn path=/trunk/mcs/; revision=113511
2008-09-19 10:46:48 +00:00
Atsushi Eno 6f49cb9172 2008-02-12 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : now number formatting for "R" works fine, so
	  just use it (and remove conditional compilation for TARGET_JVM).


svn path=/trunk/mcs/; revision=95479
2008-02-12 08:38:54 +00:00
Sebastien Pouliot 999d3d2182 2008-01-12 Sebastien Pouliot <[email protected]>
* DefaultContext.cs: Fix direct comparison with NaN. Found by 
	Gendarme.


svn path=/trunk/mcs/; revision=92755
2008-01-12 16:55:24 +00:00
Andrew Skiba 9b6d39261d TARGET_JVM for roundtrip bug
svn path=/trunk/mcs/; revision=45681
2005-06-09 09:11:06 +00:00
Atsushi Eno 91af8aea97 2004-03-15 Atsushi Enomoto <[email protected]>
* DefaultContext.cs,
	  Expression.cs,
	  Iterator.cs : Now RequireSorting is not required in BaseIterator
	  (it is now fully in Expression).
	  Removed the last ListIterator .ctor() argument.

	* XslKey.cs : removed last ListIterator.ctor() argument.
	  Reverted the last commit that changed internal key index change 
	  from ArrayList to Hashtable. Avoid clone in CollectIndex().
	  Sort results in Evaluate() before passing list to ListIterator.
	* XslFunctions.cs : removed last ListIterator.ctor() argument.

	* XslVariable.cs : removed last ListIterator.ctor() argument.


svn path=/trunk/mcs/; revision=41864
2005-03-15 21:34:04 +00:00
Atsushi Eno fa27b95fd6 2004-03-14 Atsushi Enomoto <[email protected]>
* Expression.cs,
	  DefaultContext.cs : Basic constant folding optimization (not so
	  effective right now). Unified number-to-string conversion code into
	  XPathFunctions.ToString(double) to avoid roundtrip format right now.
	* Iterator.cs : removed unused code.


svn path=/trunk/mcs/; revision=41781
2005-03-14 04:32:30 +00:00
Atsushi Eno 16b2217356 2004-03-11 Atsushi Enomoto <[email protected]>
* Expression.cs, DefaultContext.cs : more Peer overrides.


svn path=/trunk/mcs/; revision=41702
2005-03-11 14:36:25 +00:00
Atsushi Eno a643fbe57b 2004-03-11 Atsushi Enomoto <[email protected]>
* Expression.cs,
	  DefaultContext.cs : Removed unused NeedAbsoluteMatching.
	  Added Peer and Subtree (for "peer & subtree optimization. See:
	  http://idealliance.org/papers/dx_xmle04/papers/02-03-02/02-03-02.html
	  Fixed some ToString() that caused NullReferenceException.

	* Iterator.cs : Predicate does not affect on RequireSorting.
	  Added SimpleSlashIterator for peer & subtree optimization.

	  Added PreserveWhitespace() consideration in BaseIterator.MoveNext().

	* XslKey.cs : removed unused NeedAbsoluteMatching.
	* XslFunctions.cs : Added Peer (for peer & subtree optimization).
	  Added some missing ToString() overrides.


svn path=/trunk/mcs/; revision=41687
2005-03-11 11:33:30 +00:00
Duncan Mak 8fa6e766dd Add MIT license to System.XML.DLL
svn path=/trunk/mcs/; revision=30055
2004-06-21 18:07:31 +00:00
Atsushi Eno 6f208edbf7 2004-06-18 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Globalization.
	* Iterator.cs : In SlashIterator.MoveNext() position might keep 0
	  in case of empty list. Thus extraneous iteration might happened.
	  Removed unused (and clone unsafe) EnumeratorIterator.

svn path=/trunk/mcs/; revision=29828
2004-06-18 01:30:02 +00:00
Atsushi Eno 2ead87db32 2004-05-22 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Add XPathNavigator input support for ToBoolean()
	  and ToNavigator().
	* Expression.cs : In Equality comparison, evaluate XPathNavigator in
	  the same as well as NodeSet. This fixes bug #59134.

svn path=/trunk/mcs/; revision=28237
2004-05-27 09:10:08 +00:00
Atsushi Eno da650ba480 2004-05-13 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Removed MonoTODO. done.
	* Expression.cs : handle XPathResultType.Navigator in some places and
	  removed MonoTODO. Mark MonoTODO with explicit comments (though they
	  are mostly pointing out possibilities of optimization).
	  Removed extra check that depended on the old bugs.
	* XPathResultType.cs : Fixed .Navigator that had the same value as
	  .String.

svn path=/trunk/mcs/; revision=27224
2004-05-13 05:09:14 +00:00
Atsushi Eno 9182a21d27 2004-02-17 Atsushi Enomoto <[email protected]>
* XPathNavigator.cs : Only child and attribute axes are allowed for
	  Matches().
	* Expression.cs : Added IsPositional property.
	* DefaultContext.cs : Added some overrides.

svn path=/trunk/mcs/; revision=23181
2004-02-17 20:09:12 +00:00
Atsushi Eno 848087839d 2004-02-10 Atsushi Enomoto <[email protected]>
* Iterator.cs : Added overriden Count properties for some iterators
	  (this fixes the half of #50678).
	  Added ListIterator class (which can reduce GetEnumerator()).
	  In some places we can omit clone for Current property, so added
	  some check logic (It has no effect as yet).
	* Expression.cs, DefaultContext.cs :
	  use ListIterator instead of EnumeratorIterator.

svn path=/trunk/mcs/; revision=22934
2004-02-10 06:04:28 +00:00
Atsushi Eno 99b1f3bfd3 2004-02-08 Atsushi Enomoto <[email protected]>
* DefaultContext.cs, Expression.cs, Iterator.cs :
	  tiny foreach elimination.

svn path=/trunk/mcs/; revision=22889
2004-02-08 20:23:41 +00:00
Atsushi Eno 54a092c5a7 2004-02-05 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : trivial processing order fix.

svn path=/trunk/mcs/; revision=22802
2004-02-05 16:15:59 +00:00
Atsushi Eno bbc8ceabde 2004-01-27 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Avoid exception if possible.
	* Iterator.cs : Fixed PrecedingSiblingIterator.MoveNext(). When the
	  nav was positioned at the first, it incorrectly points itself.
	  Don't add names to name table while it is useless and expensive.

svn path=/trunk/mcs/; revision=22544
2004-01-27 15:57:08 +00:00
Atsushi Eno 9f60bab588 2003-12-18 Atsushi Enomoto <[email protected]>
* Parser.jay : now it supresses error output from jay.
	* DefaultContext.cs : (XPathFunctionSubstring) exclude -Infinity.
	* Tokenizer.cs : better error message.
	* XPathDocument.cs : Use XmlValidatingReader to support id() function.
	  (just found MS.NET actually supports it)

svn path=/trunk/mcs/; revision=21310
2003-12-18 08:49:08 +00:00
Atsushi Eno bd9c6af0a8 2003-12-03 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Overrode all functions' ToString().
	  XPathFunctions.ToNumber() trims whitespaces at both side.
	  Fixed NullReferenceException in normalize-space().
	* Iterator.cs : Fixed AncestorOrSelfIterator.MoveNext() didn't handle
	  attribute or namespace node correctly.
	  SlashIterator.Clone() didn't clone "next node iterator" correctly.
	  EnumeratorIterator.ctor() should raise an error (not at Clone())
	  when the target IEnumerator is not ICloneable.

svn path=/trunk/mcs/; revision=20711
2003-12-03 02:02:24 +00:00
Atsushi Eno 997edebaec 2003-11-19 Atsushi Enomoto <[email protected]>
* Added XPathComparer.cs
	* DefaultContext.cs : Fixed XPathFunctionId.Evaluate() to iterate base
	  iterator correctly, and sort results.

svn path=/trunk/mcs/; revision=20239
2003-11-19 19:09:35 +00:00
Atsushi Eno 400eba4fbe 2003-11-19 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : Imcomplete fix ;-)

svn path=/trunk/mcs/; revision=20227
2003-11-19 15:28:52 +00:00
Atsushi Eno 1156749402 2003-11-19 Atsushi Enomoto <[email protected]>
* DefaultContext.cs : XPathFunctions.ToNumber() should catch overflow.
	  XPathFunctionId.cs : Exposed Id expression.
	* Expression.cs : Added ExprLiteral.Value, and class ExprParens (it
	  will be used to solve evaluation precedence problem).

svn path=/trunk/mcs/; revision=20225
2003-11-19 15:24:04 +00:00
Ben Maurer 69d5a2fc48 2003-09-27 Ben Maurer <[email protected]>
* DefaultContext.cs (translate): translate ("abc", "c", "") = "ab"
	not "abc".
	* Iterator.cs, Expression.cs: All axes are
	SimpleIterators. SimpleIterators are gaurenteed to give the same
	XPathNavigator in Current. Make AxisIterator take a
	SimpleIterator, not any old BaseIterator. Will allow us to make
	NameTable optimizations and avoid quite a few strcmp's.

svn path=/trunk/mcs/; revision=18326
2003-09-27 04:44:20 +00:00
Ben Maurer 0488e87a2e impl sum & translate
svn path=/trunk/mcs/; revision=18161
2003-09-18 02:58:28 +00:00
Ben Maurer bd935f917b No IEnumerators, please
svn path=/trunk/mcs/; revision=18005
2003-09-08 23:20:33 +00:00
Ben Maurer bc43a0c5b3 Optimize
svn path=/trunk/mcs/; revision=17979
2003-09-07 19:40:30 +00:00
Ben Maurer 9a14273e54 buggies
svn path=/trunk/mcs/; revision=17950
2003-09-06 19:57:06 +00:00
Ben Maurer 446f43d4be 2003-09-06 Ben Maurer <[email protected]>
* DefaultContext.cs, Expresssion.cs, Parser.jay: Rewrite so that
	system functions are actually expressions. Will allow for some
	nice optimizations.

svn path=/trunk/mcs/; revision=17947
2003-09-06 18:58:51 +00:00
Piers Haken 12db7efeb6 2003-07-29 Piers Haken <[email protected]>
* DefaultContext.cs: 'local-name' returns String, not NodeSet!

svn path=/trunk/mcs/; revision=16871
2003-07-30 03:23:03 +00:00
Piers Haken a385a824fd 2003-07-29 Piers Haken <[email protected]>
* DefaultContext.cs: fix 'substring-after'

svn path=/trunk/mcs/; revision=16869
2003-07-30 02:40:03 +00:00
Piers Haken 79ebd61c28 2003-07-28 Piers Haken <[email protected]>
* DefaultContext.cs: better handling of null argument lists
	* XPathNavigator.cs: implement ComparePosition

svn path=/trunk/mcs/; revision=16817
2003-07-29 02:27:04 +00:00
Piers Haken cb74d89002 2003-07-28 Piers Haken <[email protected]>
* DefaultContext.cs: count() should return a double
	* Expression.cs: better support for handling non-double numbers

svn path=/trunk/mcs/; revision=16799
2003-07-28 22:12:33 +00:00
Piers Haken 471eacda6f 2003-07-28 Piers Haken <[email protected]>
* DefaultContext.cs: better function param matching

svn path=/trunk/mcs/; revision=16797
2003-07-28 21:54:15 +00:00
Piers Haken ae935bbac4 2003-07-27 Piers Haken <[email protected]>
* Expression.cs:
	* DefaultContext.cs:
		catch FormatExceptions while parsing numbers

svn path=/trunk/mcs/; revision=16767
2003-07-28 06:22:00 +00:00
Piers Haken 638de75bd3 2003-07-27 Piers Haken <[email protected]>
* DefaultContext.cs: allow 'concat' to take arbitrary-typed arguments (spec?)

svn path=/trunk/mcs/; revision=16752
2003-07-27 20:01:58 +00:00
Piers Haken 2e273f54ed 2003-07-26 Piers Haken <[email protected]>
* Iterator.cs:
	* DefaultContext.cs:
		ArrayListIterator->EnumeratorIterator
	* Expression.cs: add sorting support

svn path=/trunk/mcs/; revision=16727
2003-07-27 02:28:24 +00:00
Ben Maurer 42c9746fdf 2003-07-24 Ben Maurer <[email protected]>
* DefaultContext.cs: implement lang ()

svn path=/trunk/mcs/; revision=16647
2003-07-25 03:43:26 +00:00
Piers Haken 7576c51d60 2003-03-07 Piers Haken <[email protected]>
* Exression.cs:
	* DefaultContext.cs:
		fixed function argument resolution

svn path=/trunk/mcs/; revision=13262
2003-04-07 10:55:13 +00:00
Piers Haken 474fe75047 2002-09-12 Piers Haken <[email protected]>
* Tokenizer.cs: fix parsing numbers that start with '.'
	* DefaultContext.cs: use MS-compatible formatting of doubles

svn path=/trunk/mcs/; revision=7427
2002-09-13 03:17:22 +00:00
Piers Haken 643a34dd9a 2002-09-12 Piers Haken <[email protected]>
* Expression.cs, Parser.jay: allow ExprSLASH to take a generic expression as its left argument.
	* Iterator.cs: fix SlashIterator.Clone() when _iterRight is null.
	* DefaultContext.cs: fix id() return type.

svn path=/trunk/mcs/; revision=7422
2002-09-13 02:13:11 +00:00
Gonzalo Paniagua Javier 56b6a6396b 2002-09-03 Gonzalo Paniagua Javier <[email protected]>
* DefaultContext.cs: fixed bug #28840.
	* Expression.cs: added FIXME.

svn path=/trunk/mcs/; revision=7195
2002-09-03 10:01:37 +00:00
Piers Haken 28f14aa361 2002-07-25 Piers Haken <[email protected]>
* DefaultContext.cs: implement XPathFunctionName 'name()' function.

svn path=/trunk/mcs/; revision=6180
2002-07-25 21:32:51 +00:00
Piers Haken 2a157572bf 2002-07-17 Piers Haken <[email protected]>
* DefaultContext.cs: implement 'string-length()', 'normalize-space()'
	* Parser.jay: remove redundant production
	* Expression.cs: add switches for debugging under VS.NET

svn path=/trunk/mcs/; revision=5849
2002-07-17 13:02:13 +00:00
Piers Haken 2dfdf317d6 2002-06-23 Piers Haken <[email protected]>
* DefaultContext.cs: implemented XPathFUnctionId
	* Iterator.cs: new ArrayListIterator for id() support

svn path=/trunk/mcs/; revision=5426
2002-06-24 01:26:23 +00:00
Piers Haken 8d73a2306c 2002-06-23 Piers Haken <[email protected]>
System.Xml:

    * XmlDocumentNavigator.cs: implement Clone()
    * XmlElement.cs: remove bogus unimplemented override of InnerText
    * XmlNode.cs: implment SelectNodes/SelectSingleNode
    * XmlNodeArrayList.cs: new support class for SelectNodes

System.Xml.Xsl:

    * XsltContext.cs: added 'PreserveWhitespace' abstract method

System.Xml.XPath:

    * XPathNavigator.cs: implement:
        - Compile
        - Evaluate
        - Clone
        - Select
        - ToString
        - some forwarding methods

    * XPathNodeIterator: implement caching Count

    * Tokenizer.cs: new XPath tokenizer
    * Parser.jay: new XPath grammar
    * Parser.cs: new precompiled XPath grammar
    * Expression.cs: new XPath expression objects
    * Iterator.cs: new XPath result/context objects
    * DefaultContext.cs: new XPath function binding context

svn path=/trunk/mcs/; revision=5421
2002-06-23 16:52:58 +00:00