KXML::XPath
XPath 1.0 evaluation over the KXML DOM, implemented per W3C REC-xpath-19991116.
Constants
AXES = ["child", "descendant", "parent", "ancestor", "following-sibling", "preceding-sibling", "following", "preceding", "attribute", "namespace", "self", "descendant-or-self", "ancestor-or-self"] of ::String
Axis names from section 2.2.
NODE_TYPES = ["node", "text", "comment", "processing-instruction"] of ::String
Class methods
evaluate(expr : String, context : Node | Attribute, position : Int32 = 1, size : Int32 = 1, ns_map : Hash(String, String) | Nil = nil, vars : Hash(String, Value) | Nil = nil) : Value
Evaluates expr with context as the context node. vars binds
$name variable references to XPath values; ns_map resolves
expression prefixes exclusively (instead of in-scope declarations).
The namespace axis works via synthesized namespace nodes and id()
resolves ID attributes declared in the internal DTD subset.
evaluate_nodes(expr : String, context : Node | Attribute, position : Int32 = 1, size : Int32 = 1, ns_map : Hash(String, String) | Nil = nil, vars : Hash(String, Value) | Nil = nil) : NodeSet
Like evaluate but requires a node-set result.
Section 4.2: the local part of an expanded name; empty for the other node kinds.
Section 5.1: document order is the parser-assigned order number.
Section 4.3 number(string): optional whitespace, optional '-', then digits with at most one '.'; no exponent notation in XPath 1.0.
Nested types
- KXML::XPath::AddExpr
- KXML::XPath::AndExpr
- KXML::XPath::EqExpr
- KXML::XPath::Error
- KXML::XPath::Evaluator
- KXML::XPath::Expr
- KXML::XPath::FilterPathExpr
- KXML::XPath::FunctionCall
- KXML::XPath::Lexer
- KXML::XPath::LiteralExpr
- KXML::XPath::MulExpr
- KXML::XPath::NameTest
- KXML::XPath::NegExpr
- KXML::XPath::NodeSet
- KXML::XPath::NodeTest
- KXML::XPath::NumberExpr
- KXML::XPath::OrExpr
- KXML::XPath::Parser
- KXML::XPath::PathBase
- KXML::XPath::PathExpr
- KXML::XPath::RelExpr
- KXML::XPath::Step
- KXML::XPath::Token
- KXML::XPath::TokenKind
- KXML::XPath::TypeTest
- KXML::XPath::UnionExpr
- KXML::XPath::Value
- KXML::XPath::VariableRef