Module sitemap::writer [] [src]

Contains sitemap writer.

Examples

Writing sitemap into stdout.

extern crate sitemap;
use sitemap::writer::SiteMapWriter;
use sitemap::structs::UrlEntry;
use std::io::stdout;
fn main() {
    let mut output = stdout();
    let sitemap_writer = SiteMapWriter::new(&mut output);
    let mut urlwriter = sitemap_writer.start_urlset().expect("Unable to write urlset");
    urlwriter.url("http://github.com").expect("Unable to write url");
    urlwriter.url(UrlEntry::builder().loc("http://google.com")).expect("Unable to write url");
    urlwriter.url(UrlEntry::builder().loc("http://yandex.ru").build().unwrap()).expect("Unable to write url");
    urlwriter.end().expect("Unable to write close tags");
}

Structs

SiteMapIndexWriter

Writes sitemaps list into writer.

SiteMapWriter

Writes xml tags into writer.

UrlSetWriter

Writes urls into writer.