ddn.data.xml.xpath
XPath engine (phased): core data model.
This module provides the XPath 1.0 value types and conversion rules.
It is intentionally separate from the legacy/minimal ddn.data.xml.query module.
class XPathBinaryExpr XPathFunctionCallExpr XPathLiteralExpr XPathMapNamespaceResolver XPathPathExpr XPathUnaryMinusExpr
fn appendAxisResults appendDescendantsOrSelf applyPredicates axisFromName childIndex collectDescendantText collectDocumentOrder compareDocumentOrder compareValues consumeCall dedupeInDocumentOrder dedupeInOrder evaluateFunctionExpr evaluatePredicate evaluateXPath indexOfNode isAncestorOf isNameChar isNameStartChar matchesTest matchKeyword nodesetStringValue nodeStringValue objectIdentityKey parseInto parseXPathNumber readNameToken rootOf skipWs splitQName
Types 16
enumXPathValueKind
XPath value kind.
NODESETNode-set value.
STRINGString value.
NUMBERNumber value (IEEE double).
BOOLEANBoolean value.
enumXPathAxis
XPath axis.
CHILD`child::` axis.
DESCENDANT_OR_SELF`descendant-or-self::` axis (`//`).
PARENT`parent::` axis (`..`).
SELF`self::` axis (`.`).
ATTRIBUTE`attribute::` axis (`@`).
ANCESTOR`ancestor::` axis.
ANCESTOR_OR_SELF`ancestor-or-self::` axis.
FOLLOWING_SIBLING`following-sibling::` axis.
PRECEDING_SIBLING`preceding-sibling::` axis.
FOLLOWING`following::` axis.
PRECEDING`preceding::` axis.
XPath node test kind.
NAMEMatch by name.
ANY`*` wildcard.
NODE`node()`
TEXT`text()`
Methods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeFields
private XPathValue _valMethods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeConstructors
this(XPathValue val)Fields
private XPathExpression _pathMethods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeConstructors
this(XPathExpression path)Fields
private IXPathExpr _exprMethods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeConstructors
this(IXPathExpr expr)OR
AND
EQ
NEQ
LT
GT
LTE
GTE
PLUS
MINUS
MUL
DIV
MOD
UNION
Methods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeConstructors
this(IXPathExpr left, IXPathExpr right, XPathBinaryOp op)Methods
XPathValue evaluate(XmlNode context, XPathNamespaceResolver resolver, size_t position, size_t last) @safeConstructors
this(string name, IXPathExpr[] args)structXPathStep
A single path step.
structXPathExpression
A parsed XPath expression (subset).
Fields
string expressionOriginal expression string.bool absoluteIf `true`, expression is absolute (starts with `/` or `//`).private XPathStep[] _stepsMethods
XmlNode[] select(XmlNode context, XPathNamespaceResolver resolver = null) @safeSelects nodes under `context`.XmlNode[] evaluatePath(XmlNode context, XPathNamespaceResolver resolver) @safeFields
string ssize_t iMethods
IXPathExpr parseExpr() @safeinterfaceXPathNamespaceResolver
Namespace resolver for XPath evaluation.
Implementations map an XPath prefix to a namespace URI.
Methods
Simple map-backed namespace resolver.
Fields
private string[string] _mapMethods
Constructors
this(string[string] mappings)Constructs the resolver.structXPathValue
An XPath value (node-set, string, number, or boolean).
Fields
XPathValueKind kindValue kind discriminator.private XmlNode[] _nodesprivate string _stringprivate double _numberprivate bool _boolMethods
Functions 30
fn
XPathValue evaluateXPath(string expression, XmlNode context, XPathNamespaceResolver resolver = null) @safeEvaluates an XPath expression as an `XPathValue`.private fn
void appendAxisResults(
ref XmlNode[] sink,
XmlNode node,
const ref XPathStep step,
XPathNamespaceResolver resolver) @safeprivate fn
void appendDescendantsOrSelf(
ref XmlNode[] sink,
XmlNode node,
const ref XPathStep step,
XPathNamespaceResolver resolver) @safeprivate fn
bool matchesTest(XmlNode node, const ref XPathStep step, XPathNamespaceResolver resolver) @safeprivate fn
XmlNode[] applyPredicates(XmlNode[] nodes, IXPathExpr[] preds, XPathNamespaceResolver resolver) @safeprivate fn
bool evaluatePredicate(IXPathExpr pred, XmlNode node, size_t position, size_t last, XPathNamespaceResolver resolver) @safeprivate fn
XPathValue evaluateFunctionExpr(
string name,
IXPathExpr[] args,
XmlNode context,
XPathNamespaceResolver resolver,
size_t position,
size_t last) @safeprivate fn
void collectDescendantText(ref typeof(appender!string()) sink, const(XmlParentNode) n) @safe