pub struct TreeBuilder { /* private fields */ }Expand description
Builds a Document from events, in document order.
Adjacent text is merged into one text node and empty text is dropped, as the XDM
requires (except at the top of a parentless tree, see TreeBuilder::parentless). Attributes must come right after their element’s start, before its content;
an attribute whose expanded name is already on the element replaces it.
Implementations§
Source§impl TreeBuilder
impl TreeBuilder
Sourcepub const fn dom_view(self) -> Self
pub const fn dom_view(self) -> Self
The tree is the view Saxon has of a DOM document it wraps (TreeView::Dom).
Sourcepub fn parentless() -> Self
pub fn parentless() -> Self
A builder of a tree without document node, whose root is the one node added at the top: a parentless element (with its content), attribute, text node or comment (XDM nodes without parent, as XSLT constructs them in a sequence). Text added at the top makes one text node; anything added after the top-level node is an error.
Sourcepub fn start_element(&mut self, name: QName) -> Result<(), DocumentError>
pub fn start_element(&mut self, name: QName) -> Result<(), DocumentError>
Sourcepub fn add_namespace(
&mut self,
binding: NamespaceBinding,
) -> Result<(), DocumentError>
pub fn add_namespace( &mut self, binding: NamespaceBinding, ) -> Result<(), DocumentError>
Adds a namespace node to the element just opened (before its content).
§Errors
No element is open, or it already has content.
Sourcepub fn start_element_with_namespaces(
&mut self,
name: QName,
namespaces: Arc<[NamespaceBinding]>,
) -> Result<(), DocumentError>
pub fn start_element_with_namespaces( &mut self, name: QName, namespaces: Arc<[NamespaceBinding]>, ) -> Result<(), DocumentError>
Opens an element with namespace nodes (besides those it inherits from its
ancestors in the tree, see Node::namespaces_in_scope).
§Errors
A document too large for the arena.
Sourcepub fn attribute(
&mut self,
name: QName,
value: &str,
) -> Result<(), DocumentError>
pub fn attribute( &mut self, name: QName, value: &str, ) -> Result<(), DocumentError>
Adds an attribute to the element just opened.
§Errors
No element is open, or the element already has content.