Name
xml_get_logical_path, xml_follow_logical_path — encode and resolve a stable structural address for a node inside an XML tree
Synopsis
varchar xml_get_logical_path(
|
in node XML); |
XML xml_follow_logical_path(
|
in root XML, |
in logical_path varchar); |
Description
A logical path is Virtuoso's compact, stable string address for a node inside an XML tree, robust to whitespace rewriting and namespace-prefix renaming (in contrast to a full XPath expression). The same logical path can be stored alongside an XML document and resolved later to find the same conceptual node even after minor re-serialisation.
xml_get_logical_path returns the logical path of
node relative to the root of its containing
document. The result is a short string of element-position and
attribute-name steps; it does not depend on whitespace formatting.
xml_follow_logical_path walks
logical_path down from root
and returns the resulting node entity, or SQL NULL when the path does not
resolve in the current tree.
Round-tripping a node: xml_follow_logical_path(root,
xml_get_logical_path(node)) returns the same node entity,
provided the document structure has not been edited.