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>
where Handle: Clone, Sink: TreeSink<Handle = Handle>,

source

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.

source

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.

source

fn dump_state(&self, label: String)

source

fn debug_step(&self, mode: XmlPhase, token: &Token)

source

fn declare_ns(&self, attr: &mut Attribute)

source

fn find_uri( &self, prefix: &Option<Prefix>, ) -> Result<Option<Namespace>, Cow<'static, str>>

source

fn bind_qname(&self, name: &mut QualName)

source

fn bind_attr_qname( &self, present_attrs: &mut HashSet<(Namespace, LocalName)>, name: &mut QualName, ) -> bool

source

fn check_duplicate_attr( present_attrs: &mut HashSet<(Namespace, LocalName)>, name: &QualName, ) -> bool

source

fn process_namespaces(&self, tag: &mut Tag)

source

fn process_to_completion(&self, token: Token)

Trait Implementations§

source§

impl<Handle, Sink> TokenSink for XmlTreeBuilder<Handle, Sink>
where Handle: Clone, Sink: TreeSink<Handle = Handle>,

source§

fn process_token(&self, token: Token)

Process a token.
source§

fn end(&self)

Signal to the sink that parsing has ended.
source§

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>
where Sink: Send, Handle: Send,

§

impl<Handle, Sink> !Sync for XmlTreeBuilder<Handle, Sink>

§

impl<Handle, Sink> Unpin for XmlTreeBuilder<Handle, Sink>
where Sink: Unpin, Handle: Unpin,

§

impl<Handle, Sink> UnwindSafe for XmlTreeBuilder<Handle, Sink>
where Sink: UnwindSafe, Handle: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.