         xmlXPathFreeCompExpr(ptr);
     }
 
+    /// Evaluates the XPath query with the given node as context node.
     public func evaluateOn(node: Node) throws -> XPathResult {
         let context = try XPathContext(node: node)
         let obj = xmlXPathCompiledEval(ptr, context.ptr)

        return xmlXPathCastToBoolean(ptr) != 0
    }

    public func asNumber() -> Double {
        return xmlXPathCastToNumber(ptr)
    }

        return XPathResult(ptr: obj, onNode: node)
    }

    /// Evaluates the XPath query with the given document's root node as context node.
    public func evaluateOn(doc: Document) throws -> XPathResult {
        return try evaluateOn(doc.root)
    }
