pub struct NodeSet<'a> { /* private fields */ }Expand description
A set of nodes from a roxmltree document.
Represents “which nodes are included” for canonicalization and transforms. Two modes:
- Whole document:
includedisNone, meaning all nodes are in the set (minus any inexcluded). - Subset:
includedisSome(ids), meaning only those node IDs are in the set (minus any inexcluded).
Implementations§
Source§impl<'a> NodeSet<'a>
impl<'a> NodeSet<'a>
Sourcepub fn entire_document_without_comments(doc: &'a Document<'a>) -> Self
pub fn entire_document_without_comments(doc: &'a Document<'a>) -> Self
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.”
Sourcepub fn entire_document_with_comments(doc: &'a Document<'a>) -> Self
pub fn entire_document_with_comments(doc: &'a Document<'a>) -> Self
Create a node set representing the entire document with comments.
Used for #xpointer(/) which, unlike empty URI, includes comment nodes.
Sourcepub fn subtree(element: Node<'a, 'a>) -> Self
pub fn subtree(element: Node<'a, 'a>) -> Self
Create a node set rooted at element, containing that element and all
of its descendant nodes (elements, text, and, for this constructor,
comment nodes).
Note: in roxmltree, attributes and namespaces are not separate nodes
and therefore are not tracked individually in this NodeSet. During
canonicalization, any attributes and namespace declarations belonging to
the included elements are serialized as part of those elements.
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.