[][src]Trait augdom::Dom

pub trait Dom: Sized {
    fn write_xml<W: Write>(&self, writer: &mut XmlWriter<W>);
fn create_element(&self, ty: &str) -> Self;
fn create_text_node(&self, contents: &str) -> Self;
fn set_attribute(&self, name: &str, value: &str);
fn remove_attribute(&self, name: &str);
fn next_sibling(&self) -> Option<Self>;
fn first_child(&self) -> Option<Self>;
fn append_child(&self, child: &Self);
fn replace_child(&self, new_child: &Self, existing: &Self);
fn remove_child(&self, to_remove: &Self) -> Option<Self>; fn outer_html(&self) -> String { ... }
fn pretty_outer_html(&self, indent: usize) -> String { ... } }

A value which implements a subset of the web's document object model.

Required methods

fn write_xml<W: Write>(&self, writer: &mut XmlWriter<W>)

Write this value as XML via the provided writer. Consider using Dom::outer_html or Dom::pretty_outer_html unless you need the performance.

fn create_element(&self, ty: &str) -> Self

Create a new element within the same tree as the method receiver.

fn create_text_node(&self, contents: &str) -> Self

Create a new text node within the same tree as the method receiver.

fn set_attribute(&self, name: &str, value: &str)

Set an attribute on this DOM node.

fn remove_attribute(&self, name: &str)

Ensure the provided attribute has been removed from this DOM node.

fn next_sibling(&self) -> Option<Self>

Returns the next child of this node's parent after this node itself.

fn first_child(&self) -> Option<Self>

Returns the first child of this node.

fn append_child(&self, child: &Self)

Adds a new child to the end of this node's children.

fn replace_child(&self, new_child: &Self, existing: &Self)

Replaces the provided child of this node with a new one.

fn remove_child(&self, to_remove: &Self) -> Option<Self>

Removes the provided child from this node.

Loading content...

Provided methods

fn outer_html(&self) -> String

Returns a string of serialized XML without newlines or indentation.

fn pretty_outer_html(&self, indent: usize) -> String

Returns a string of "prettified" serialized XML with the provided indentation.

Loading content...

Implementations on Foreign Types

impl Dom for Rc<VirtNode>[src]

impl Dom for Node[src]

Loading content...


impl Dom for augdom::Node[src]

Loading content...