Struct xml5ever::tree_builder::XmlTreeBuilder
source · pub struct XmlTreeBuilder<Handle, Sink> {
_opts: XmlTreeBuilderOpts,
pub sink: Sink,
doc_handle: Handle,
next_tokenizer_state: Cell<Option<XmlState>>,
open_elems: RefCell<Vec<Handle>>,
curr_elem: RefCell<Option<Handle>>,
namespace_stack: RefCell<NamespaceMapStack>,
current_namespace: RefCell<NamespaceMap>,
phase: Cell<XmlPhase>,
}
Expand description
The XML tree builder.
Fields§
§_opts: XmlTreeBuilderOpts
Configuration options for XmlTreeBuilder
sink: Sink
Consumer of tree modifications.
doc_handle: Handle
The document node, which is created by the sink.
next_tokenizer_state: Cell<Option<XmlState>>
Next state change for the tokenizer, if any.
open_elems: RefCell<Vec<Handle>>
Stack of open elements, most recently added at end.
curr_elem: RefCell<Option<Handle>>
Current element pointer.
namespace_stack: RefCell<NamespaceMapStack>
Stack of namespace identifiers and namespaces.
current_namespace: RefCell<NamespaceMap>
Current namespace identifier
phase: Cell<XmlPhase>
Current tree builder phase.
Implementations§
source§impl<Handle, Sink> XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> XmlTreeBuilder<Handle, Sink>
sourcepub fn new(sink: Sink, opts: XmlTreeBuilderOpts) -> XmlTreeBuilder<Handle, Sink>
pub fn new(sink: Sink, opts: XmlTreeBuilderOpts) -> XmlTreeBuilder<Handle, Sink>
Create a new tree builder which sends tree modifications to a particular TreeSink
.
The tree builder is also a TokenSink
.
sourcepub fn trace_handles(&self, tracer: &dyn Tracer<Handle = Handle>)
pub fn trace_handles(&self, tracer: &dyn Tracer<Handle = Handle>)
Call the Tracer
’s trace_handle
method on every Handle
in the tree builder’s
internal state. This is intended to support garbage-collected DOMs.
fn dump_state(&self, label: String)
fn debug_step(&self, mode: XmlPhase, token: &Token)
fn declare_ns(&self, attr: &mut Attribute)
fn find_uri( &self, prefix: &Option<Prefix>, ) -> Result<Option<Namespace>, Cow<'static, str>>
fn bind_qname(&self, name: &mut QualName)
fn bind_attr_qname( &self, present_attrs: &mut HashSet<(Namespace, LocalName)>, name: &mut QualName, ) -> bool
fn check_duplicate_attr( present_attrs: &mut HashSet<(Namespace, LocalName)>, name: &QualName, ) -> bool
fn process_namespaces(&self, tag: &mut Tag)
fn process_to_completion(&self, token: Token)
Trait Implementations§
source§impl<Handle, Sink> TokenSink for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> TokenSink for XmlTreeBuilder<Handle, Sink>
source§fn process_token(&self, token: Token)
fn process_token(&self, token: Token)
Process a token.
source§fn query_state_change(&self) -> Option<XmlState>
fn query_state_change(&self) -> Option<XmlState>
The tokenizer will call this after emitting any start tag.
This allows the tree builder to change the tokenizer’s state.
By default no state changes occur.
Auto Trait Implementations§
impl<Handle, Sink> !Freeze for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> !RefUnwindSafe for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> Send for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> !Sync for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> Unpin for XmlTreeBuilder<Handle, Sink>
impl<Handle, Sink> UnwindSafe for XmlTreeBuilder<Handle, Sink>where
Sink: UnwindSafe,
Handle: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more