DynamicDOM v0.43.2. Implementation based on XRules v0.43

DDomContext Class

Implements XRules-specific XPath extension functions that are used when executing XPath expressions on DXmlDocument. For example, using the property() XPath extension function when calling SelectNodes().

For a list of all members of this type, see DDomContext Members.

System.Object
   System.Xml.XmlNamespaceManager
      System.Xml.Xsl.XsltContext
         XRules.DDomContext

[Visual Basic]
Public Class DDomContext
    Inherits XsltContext
[C#]
public class DDomContext : XsltContext
[C++]
public __gc class DDomContext : public XsltContext
[JScript]
public class DDomContext extends XsltContext

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

You can pass an object of this class to the SelectNodes() and SelectSingleNode() functions to be able to use XRules extension XPath functions, such as property() as follows:

// Get the nodes that have property 'Test' equal to '3'.
DDomContext ddomContext = new DDomContext((NameTable)myDxmlDocument.NameTable);
nodes = myDxmlDocument.SelectNodes("/root/*[property('Test') = '3']", ddomContext);
You can also derive from this class to create your own custom context class to add extention XPath functions and variables as shown in the example below.

Example

This example shows how to override DDomContext class to implement custom XPath functions.

internal class DDomCustomContext : XRules.DDomContext
{
    protected internal DDomCustomContext(NameTable nt) : base(nt)
    {}

    public override IXsltContextFunction ResolveFunction(string prefix, 
                        string name, XPathResultType[] argTypes)
    {
        switch (name)
        {
            case "AddNumbers":
                // DDomCustomFunction implements the IXsltContextFunction interface.
                DDomCustomFunction xrulesFunction = new DDomCustomFunction(name);
                return xrulesFunction;
        }
        
        // Call the base function to resolve XRules functions.
        return base.ResolveFunction(prefix, name, argTypes);
    }
}

Requirements

Namespace: XRules

Assembly: XRules.DynamicDom (in XRules.DynamicDom.dll)

See Also

DDomContext Members | XRules Namespace