C# Class Mvp.Xml.Common.XPath.DynamicContext

Provides the evaluation context for fast execution and custom variables resolution.
This class is responsible for resolving variables during dynamic expression execution.

Discussed in http://weblogs.asp.net/cazzu/archive/2003/10/07/30888.aspx

Author: Daniel Cazzulino, blog

Inheritance: System.Xml.Xsl.XsltContext
Show file Open project: Monobjc/monobjc-tools Class Usage Examples

Public Methods

Method Description
AddVariable ( string name, object value ) : void

Adds the variable to the dynamic evaluation context.

Value type conversion for XPath evaluation is as follows: CLR Type XPath type System.String XPathResultType.String System.Double (or types that can be converted to) XPathResultType.Number System.Boolean XPathResultType.Boolean System.Xml.XPath.XPathNavigator XPathResultType.Navigator System.Xml.XPath.XPathNodeIterator XPathResultType.NodeSet Others XPathResultType.Any See the topic "Compile, Select, Evaluate, and Matches with XPath and XPathExpressions" in MSDN documentation for additional information.

CompareDocument ( string baseUri, string nextbaseUri ) : int

Implementation equal to XsltContext.

Compile ( string xpath ) : XPathExpression

Shortcut method that compiles an expression using an empty navigator.

DynamicContext ( ) : System

Initializes a new instance of the DynamicContext class.

DynamicContext ( NameTable table ) : System

Initializes a new instance of the DynamicContext class with the specified NameTable.

DynamicContext ( XmlNamespaceManager context ) : System

Initializes a new instance of the DynamicContext class.

DynamicContext ( XmlNamespaceManager context, NameTable table ) : System

Initializes a new instance of the DynamicContext class.

LookupNamespace ( string prefix ) : string

Same as XmlNamespaceManager.

LookupPrefix ( string uri ) : string

Same as XmlNamespaceManager.

PreserveWhitespace ( XPathNavigator node ) : bool

Same as XsltContext.

ResolveFunction ( string prefix, string name, XPathResultType ArgTypes ) : IXsltContextFunction

See XsltContext. Not used in our implementation.

ResolveVariable ( string prefix, string name ) : IXsltContextVariable

Resolves the dynamic variables added to the context. See XsltContext.

Method Details

AddVariable() public method

Adds the variable to the dynamic evaluation context.
Value type conversion for XPath evaluation is as follows: CLR Type XPath type System.String XPathResultType.String System.Double (or types that can be converted to) XPathResultType.Number System.Boolean XPathResultType.Boolean System.Xml.XPath.XPathNavigator XPathResultType.Navigator System.Xml.XPath.XPathNodeIterator XPathResultType.NodeSet Others XPathResultType.Any See the topic "Compile, Select, Evaluate, and Matches with XPath and XPathExpressions" in MSDN documentation for additional information.
The is null.
public AddVariable ( string name, object value ) : void
name string The name of the variable to add to the context.
value object The value of the variable to add to the context.
return void

CompareDocument() public method

Implementation equal to XsltContext.
public CompareDocument ( string baseUri, string nextbaseUri ) : int
baseUri string
nextbaseUri string
return int

Compile() public static method

Shortcut method that compiles an expression using an empty navigator.
public static Compile ( string xpath ) : XPathExpression
xpath string The expression to compile
return System.Xml.XPath.XPathExpression

DynamicContext() public method

Initializes a new instance of the DynamicContext class.
public DynamicContext ( ) : System
return System

DynamicContext() public method

Initializes a new instance of the DynamicContext class with the specified NameTable.
public DynamicContext ( NameTable table ) : System
table System.Xml.NameTable The NameTable to use.
return System

DynamicContext() public method

Initializes a new instance of the DynamicContext class.
public DynamicContext ( XmlNamespaceManager context ) : System
context System.Xml.XmlNamespaceManager A previously filled context with the namespaces to use.
return System

DynamicContext() public method

Initializes a new instance of the DynamicContext class.
public DynamicContext ( XmlNamespaceManager context, NameTable table ) : System
context System.Xml.XmlNamespaceManager A previously filled context with the namespaces to use.
table System.Xml.NameTable The NameTable to use.
return System

LookupNamespace() public method

Same as XmlNamespaceManager.
public LookupNamespace ( string prefix ) : string
prefix string
return string

LookupPrefix() public method

Same as XmlNamespaceManager.
public LookupPrefix ( string uri ) : string
uri string
return string

PreserveWhitespace() public method

Same as XsltContext.
public PreserveWhitespace ( XPathNavigator node ) : bool
node System.Xml.XPath.XPathNavigator
return bool

ResolveFunction() public method

See XsltContext. Not used in our implementation.
public ResolveFunction ( string prefix, string name, XPathResultType ArgTypes ) : IXsltContextFunction
prefix string
name string
ArgTypes XPathResultType
return IXsltContextFunction

ResolveVariable() public method

Resolves the dynamic variables added to the context. See XsltContext.
public ResolveVariable ( string prefix, string name ) : IXsltContextVariable
prefix string
name string
return IXsltContextVariable