Search Results for

    Show / Hide Table of Contents
    View Source

    Class DynamicContext

    Provides the evaluation context for fast execution and custom variables resolution.

    Inheritance
    System.Object
    System.Xml.XmlNamespaceManager
    System.Xml.Xsl.XsltContext
    Namespace: Umbraco.Cms.Core.Xml
    Assembly: Umbraco.Core.dll
    Syntax
    public class DynamicContext : XsltContext, IEnumerable, IXmlNamespaceResolver
    Remarks

    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

    Constructors

    View Source

    DynamicContext()

    Initializes a new instance of the DynamicContext class.

    Declaration
    public DynamicContext()
    View Source

    DynamicContext(NameTable)

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

    Declaration
    public DynamicContext(NameTable table)
    Parameters
    Type Name Description
    System.Xml.NameTable table

    The NameTable to use.

    View Source

    DynamicContext(XmlNamespaceManager)

    Initializes a new instance of the DynamicContext class.

    Declaration
    public DynamicContext(XmlNamespaceManager context)
    Parameters
    Type Name Description
    System.Xml.XmlNamespaceManager context

    A previously filled context with the namespaces to use.

    View Source

    DynamicContext(XmlNamespaceManager, NameTable)

    Initializes a new instance of the DynamicContext class.

    Declaration
    public DynamicContext(XmlNamespaceManager context, NameTable table)
    Parameters
    Type Name Description
    System.Xml.XmlNamespaceManager context

    A previously filled context with the namespaces to use.

    System.Xml.NameTable table

    The NameTable to use.

    Properties

    View Source

    Whitespace

    Same as System.Xml.Xsl.XsltContext.

    Declaration
    public override bool Whitespace { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    View Source

    AddVariable(String, Object)

    Adds the variable to the dynamic evaluation context.

    Declaration
    public void AddVariable(string name, object value)
    Parameters
    Type Name Description
    System.String name

    The name of the variable to add to the context.

    System.Object value

    The value of the variable to add to the context.

    Remarks

    Value type conversion for XPath evaluation is as follows:

    CLR TypeXPath type
    System.StringXPathResultType.String
    System.Double (or types that can be converted to)XPathResultType.Number
    System.BooleanXPathResultType.Boolean
    System.Xml.XPath.XPathNavigatorXPathResultType.Navigator
    System.Xml.XPath.XPathNodeIteratorXPathResultType.NodeSet
    OthersXPathResultType.Any
    note

    See the topic "Compile, Select, Evaluate, and Matches with XPath and XPathExpressions" in MSDN documentation for additional information.

    View Source

    CompareDocument(String, String)

    Implementation equal to System.Xml.Xsl.XsltContext.

    Declaration
    public override int CompareDocument(string baseUri, string nextbaseUri)
    Parameters
    Type Name Description
    System.String baseUri
    System.String nextbaseUri
    Returns
    Type Description
    System.Int32
    View Source

    Compile(String)

    Shortcut method that compiles an expression using an empty navigator.

    Declaration
    public static XPathExpression Compile(string xpath)
    Parameters
    Type Name Description
    System.String xpath

    The expression to compile

    Returns
    Type Description
    System.Xml.XPath.XPathExpression

    A compiled System.Xml.XPath.XPathExpression.

    View Source

    LookupNamespace(String)

    Same as System.Xml.XmlNamespaceManager.

    Declaration
    public override string LookupNamespace(string prefix)
    Parameters
    Type Name Description
    System.String prefix
    Returns
    Type Description
    System.String
    View Source

    LookupPrefix(String)

    Same as System.Xml.XmlNamespaceManager.

    Declaration
    public override string LookupPrefix(string uri)
    Parameters
    Type Name Description
    System.String uri
    Returns
    Type Description
    System.String
    View Source

    PreserveWhitespace(XPathNavigator)

    Same as System.Xml.Xsl.XsltContext.

    Declaration
    public override bool PreserveWhitespace(XPathNavigator node)
    Parameters
    Type Name Description
    System.Xml.XPath.XPathNavigator node
    Returns
    Type Description
    System.Boolean
    View Source

    ResolveFunction(String, String, XPathResultType[])

    See System.Xml.Xsl.XsltContext. Not used in our implementation.

    Declaration
    public override IXsltContextFunction ResolveFunction(string prefix, string name, XPathResultType[] argTypes)
    Parameters
    Type Name Description
    System.String prefix
    System.String name
    System.Xml.XPath.XPathResultType[] argTypes
    Returns
    Type Description
    System.Xml.Xsl.IXsltContextFunction
    View Source

    ResolveVariable(String, String)

    Resolves the dynamic variables added to the context. See System.Xml.Xsl.XsltContext.

    Declaration
    public override IXsltContextVariable ResolveVariable(string prefix, string name)
    Parameters
    Type Name Description
    System.String prefix
    System.String name
    Returns
    Type Description
    System.Xml.Xsl.IXsltContextVariable
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • DynamicContext()
      • DynamicContext(NameTable)
      • DynamicContext(XmlNamespaceManager)
      • DynamicContext(XmlNamespaceManager, NameTable)
    • Properties
      • Whitespace
    • Methods
      • AddVariable(String, Object)
      • CompareDocument(String, String)
      • Compile(String)
      • LookupNamespace(String)
      • LookupPrefix(String)
      • PreserveWhitespace(XPathNavigator)
      • ResolveFunction(String, String, XPathResultType[])
      • ResolveVariable(String, String)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX