Skip to main content

BufferDocumentBuilder

Struct BufferDocumentBuilder 

Source
pub struct BufferDocumentBuilder<'a> { /* private fields */ }
Expand description

Builds a BufferDocument incrementally via a push API.

Implementations§

Source§

impl<'a> BufferDocumentBuilder<'a>

Source

pub fn new( arena: &'a Bump, names: &'a NameTable, schema_set: Option<&'a SchemaSet>, options: BufferDocumentOptions, ) -> Result<Self, BufferDocumentError>

Creates a new builder.

If schema_set is Some, uses its name_table; otherwise uses names.

Source

pub fn start_element( &mut self, local_name: &str, ns_uri: &str, prefix: &str, ns_declarations: &[(&str, &str)], ) -> Result<u32, BufferDocumentError>

Opens an element node.

ns_declarations is a list of (prefix, namespace_uri) pairs for xmlns declarations on this element.

Source

pub fn attribute( &mut self, local_name: &str, ns_uri: &str, prefix: &str, value: &str, ) -> Result<u32, BufferDocumentError>

Adds an attribute to the current element (two-node pair).

Source

pub fn end_of_attributes(&mut self)

Marks the end of attributes; subsequent content nodes are children.

Source

pub fn text(&mut self, value: &str)

Accumulates text content; coalesced on the next structural event.

Source

pub fn comment(&mut self, value: &str) -> Result<(), BufferDocumentError>

Adds a comment node.

Source

pub fn processing_instruction( &mut self, target: &str, data: &str, ) -> Result<(), BufferDocumentError>

Adds a processing instruction (two-node pair: PI + ChildValue).

Source

pub fn end_element(&mut self) -> Result<(), BufferDocumentError>

Closes the current element.

Source

pub fn finalize(self) -> Result<BufferDocument<'a>, BufferDocumentError>

Finalizes the document, appending the Nul sentinel.

Source

pub fn set_node_binding( &mut self, node_ref: u32, binding: NodeSchemaBinding, ) -> Result<bool, BufferDocumentError>

Sets the schema binding on a node, returning true if the type is complex.

Returns BufferDocumentError::Overflow if the binding table is full.

Source

pub fn set_nil(&mut self, node_ref: u32)

Sets the IS_NIL flag on a node (xsi:nil=“true”).

Source

pub fn register_xml_id( &mut self, id: &str, elem_ref: u32, ) -> Result<(), BufferDocumentError>

Registers an xml:id value for the given element.

Returns BufferDocumentError::DuplicateId if the id has already been registered. This is a no-op in Fragment mode.

Source

pub fn track_source_locations(&self) -> bool

Returns true when source location tracking is enabled.

Source

pub fn set_source_span(&mut self, node_ref: u32, span: SourceSpan)

Records a completed source span for a node.

Source

pub fn build<R: BufRead>( self, reader: R, ) -> Result<BufferDocument<'a>, BufferDocumentError>

Builds the document from a quick-xml event stream.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSendSync for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.