Struct svgdom::Document [] [src]

pub struct Document {
    pub root: Node,
}

Container of Nodes.

Fields

Root node.

Methods

impl Document
[src]

[src]

Constructs a new Document.

[src]

Constructs a new Document from the text using a default ParseOptions.

[src]

Constructs a new Document from the text using a supplied ParseOptions.

[src]

Constructs a new Node with NodeType::Element type.

Constructed node do belong to this document, but not added to it tree structure.

Panics

Panics if a string tag name is empty.

[src]

Constructs a new Node using the supplied NodeType.

Constructed node do belong to this document, but not added to it tree structure.

This method should be used for any non-element nodes.

[src]

Returns the root Node.

[src]

Returns the first child of the root Node.

Panics

Panics if the root node is currently mutability borrowed.

[src]

Returns the first child with svg tag name of the root Node.

In most of the cases result of this method and first_element_child() will be the same, but an additional check may be helpful.

Panics

Panics if the root node is currently mutability borrowed.

Examples

use svgdom::{Document, ElementId};

let doc = Document::from_str("<!--comment--><svg/>").unwrap();

assert_eq!(doc.svg_element().unwrap().is_tag_name(ElementId::Svg), true);

[src]

Appends a new child to root node, after existing children, and returns it.

Panics

Panics if the node, the new child, or one of their adjoining nodes is currently borrowed.

Examples

use svgdom::{Document, ElementId};

let mut doc = Document::new();
let svg = doc.create_element(ElementId::Svg);
doc.append(&svg);

assert_eq!(doc.to_string(), "<svg/>\n");

[src]

Returns an iterator over descendants.

[src]

Returns an iterator to this node's children elements.

Panics

Panics if the node is currently mutability borrowed.

[src]

Removes only the children nodes specified by the predicate.

The root node ignored.

Trait Implementations

impl WriteBuffer for Document
[src]

[src]

Writes data to the Vec<u8> buffer using specified WriteOptions.

[src]

Writes data to the Vec<u8> buffer using default WriteOptions.

impl Display for Document
[src]

[src]

Formats the value using the given formatter. Read more

impl ToStringWithOptions for Document
[src]

[src]

Writes data to the String using specified WriteOptions.