pub struct NodeSet<'a> { /* private fields */ }Expand description
A set of nodes from a roxmltree document.
Represents the exact XPath nodes included for canonicalization and transforms.
Attributes and namespace bindings are first-class XPath nodes even though roxmltree exposes them through their owner element. Materializing them here lets XPath filters independently include or remove those nodes as required by canonical XML document-subset processing.
Implementations§
Source§impl<'a> NodeSet<'a>
impl<'a> NodeSet<'a>
Sourcepub fn entire_document_without_comments(
doc: &'a Document<'a>,
) -> Result<Self, TransformError>
pub fn entire_document_without_comments( doc: &'a Document<'a>, ) -> Result<Self, TransformError>
Create a node set representing the entire document without comments.
Per XMLDSig §4.3.3.2: “An empty URI […] is a reference to the document […] and the comment nodes are not included.”
§Errors
Returns TransformError::NodeSetTooLarge or
TransformError::NodeSetStringsTooLarge when projecting the document’s
tree, attribute, namespace, or owned string data would exceed its budget.
Sourcepub fn entire_document_with_comments(
doc: &'a Document<'a>,
) -> Result<Self, TransformError>
pub fn entire_document_with_comments( doc: &'a Document<'a>, ) -> Result<Self, TransformError>
Create a node set representing the entire document with comments.
Used for #xpointer(/) which, unlike empty URI, includes comment nodes.
§Errors
Returns TransformError::NodeSetTooLarge or
TransformError::NodeSetStringsTooLarge when projecting the document’s
tree, attribute, namespace, or owned string data would exceed its budget.
Sourcepub fn subtree(element: Node<'a, 'a>) -> Result<Self, TransformError>
pub fn subtree(element: Node<'a, 'a>) -> Result<Self, TransformError>
Create a node set rooted at element, containing that element and all
of its descendant nodes (elements, text, and, for this constructor,
comment nodes).
§Errors
Returns TransformError::NodeSetTooLarge or
TransformError::NodeSetStringsTooLarge when projecting the subtree’s
tree, attribute, namespace, or owned string data would exceed its budget.
Sourcepub fn contains(&self, node: Node<'_, '_>) -> bool
pub fn contains(&self, node: Node<'_, '_>) -> bool
Check whether a node is in this set.
Returns false for nodes from a different document than this set’s
owning document (prevents cross-document NodeId collisions).
Sourcepub fn exclude_subtree(&mut self, node: Node<'_, '_>)
pub fn exclude_subtree(&mut self, node: Node<'_, '_>)
Exclude a node and all its descendants from this set.
No-op for nodes from a different document.
Sourcepub fn with_comments(&self) -> bool
pub fn with_comments(&self) -> bool
Whether comments are included in this node set.