Trait xml5ever::tree_builder::interface::TreeSink [] [src]

pub trait TreeSink {
    type Handle: Clone;
    type Output;
    fn finish(self) -> Self::Output;
    fn parse_error(&mut self, msg: Cow<'static, str>);
    fn get_document(&mut self) -> Self::Handle;
    fn elem_name(&self, target: &Self::Handle) -> QName;
    fn create_element(
        &mut self,
        name: QName,
        attrs: Vec<Attribute>
    ) -> Self::Handle; fn create_comment(&mut self, text: StrTendril) -> Self::Handle; fn create_pi(
        &mut self,
        target: StrTendril,
        data: StrTendril
    ) -> Self::Handle; fn append(&mut self, parent: Self::Handle, child: NodeOrText<Self::Handle>); fn append_doctype_to_document(
        &mut self,
        name: StrTendril,
        public_id: StrTendril,
        system_id: StrTendril
    ); fn mark_script_already_started(&mut self, _node: Self::Handle) { ... } fn complete_script(&mut self, _node: Self::Handle) -> NextParserState { ... } fn pop(&mut self, _node: Self::Handle) { ... } }

Types which can process tree modifications from the tree builder.

Associated Types

Handle is a reference to a DOM node. The tree builder requires that a Handle implements Clone to get another reference to the same node.

The overall result of parsing.

TODO:This should defualt to Self, but default associated types are not stable yet. (https://github.com/rust-lang/rust/issues/29661)

Required Methods

Consume this sink and return the overall result of parsing.

TODO:This should default to fn finish(self) -> Self::Output { self }, but default associated types are not stable yet. (https://github.com/rust-lang/rust/issues/29661)

Signal a parse error.

Get a handle to the Document node.

What is the name of this element?

Should never be called on a non-element node; feel free to panic!.

Create an element.

Create a comment node.

Create a Processing Instruction node.

Append a node as the last child of the given node. If this would produce adjacent sibling text nodes, it should concatenate the text instead.

The child node will not already have a parent.

Append a DOCTYPE element to the Document node.

Provided Methods

Mark a HTML <script> as "already started".

Indicate that a script element is complete.

Indicate that a node was popped off the stack of open elements.

Implementors