Files
mono/mcs/class/System.XML/Mono.Xml.XPath/KeyPattern.cs
T
Atsushi Eno ce6759fea0 2004-03-22 Atsushi Enomoto <[email protected]>
* Compiler.cs : Now it holds XPath parser and XSLT pattern parser.
	* XslKey.cs : Use XSLT pattern parser for match.
	  UsePattern is now "Use" (it is not a pattern). 
	  Reimplemented Evaluate() to make full use of index table.
	  Added Matches() to handle shorter match evaluation. For const value
	  for key (e.g. key patterns), it could avoid Evaluate().
	* XsltCompiledContext.cs : Added MatchesKey() that just delegates to
	  new KeyIndexTable.Matches().
	* XslFunctions.cs : Added PatternMatches() that just delegates to new
	  XsltCompiledContext.MatchesKey().

	* Pattern.cs : Pattern.Compile() now uses XSLT pattern parser instead
	  of XPath parser.
	* KeyPattern.cs : Matches() now just delegates to XsltKey.MatchesKey().


svn path=/trunk/mcs/; revision=42066
2005-03-22 07:39:29 +00:00

59 lines
1.7 KiB
C#

//
// Mono.Xml.XPath.KeyPattern
//
// Author:
// Ben Maurer ([email protected])
//
// (C) 2003 Ben Maurer
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.IO;
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 KeyPattern : LocationPathPattern
{
XsltKey key;
public KeyPattern (XsltKey key)
: base ((NodeTest) null)
{
this.key = key;
}
public override bool Matches (XPathNavigator node, XsltContext ctx)
{
return key.PatternMatches (node, ctx);
}
public override double DefaultPriority { get { return 0.5; } }
}
}