wxr

package module
v0.0.0-...-b88ccf8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2014 License: ISC Imports: 3 Imported by: 2

README

Package wxr provides structs for unmarshaling Wordpress WXR content.

docs: http://godoc.org/github.com/tmc/wxr
license: isc

Documentation

Overview

Package wxr implements types corresponding to the Wordpress WXR XML encoding. The initial implementation is consumption oriented and may be incomplete.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID   int    `xml:"term_id"`
	Slug string `xml:"category_nicename"`
	Name string `xml:"cat_name"`
}

Category describes a category in the blog export

type Channel

type Channel struct {
	XMLName     xml.Name   `xml:"channel"`
	Title       string     `xml:"title"`
	Link        string     `xml:"link"`
	Categories  []Category `xml:"category"`
	Tags        []Tag      `xml:"tag"`
	Description string     `xml:"description"`
	WXRVersion  string     `xml:"wxr_version"`
	Items       []Item     `xml:"item"`
}

Channel is the element describing the blog

type Item

type Item struct {
	XMLName    xml.Name       `xml:"item"`
	ID         int            `xml:"post_id"`
	Name       string         `xml:"post_name"`
	Title      string         `xml:"title"`
	Author     string         `xml:"creator"`
	Link       string         `xml:"link"`
	Categories []ItemCategory `xml:"category"`
	Content    []string       `xml:"encoded"`

	//Content    struct {
	//	Body string `xml:",chardata"`
	//} `xml:"encoded"`
	Type    string `xml:"post_type"`
	PubDate WpTime `xml:"pubDate"`
}

Item is a blog post

type ItemCategory

type ItemCategory struct {
	XMLName xml.Name `xml:"category"`
	Domain  string   `xml:"domain,attr"`
	Slug    string   `xml:"nicename,attr"`
	Name    string   `xml:",chardata"`
}

ItemCategory is a Category or Tag that is associated with an Item

type RSS

type RSS struct {
	XMLName xml.Name `xml:"rss"`
	Channel Channel
}

RSS is the root element of an WXR document

func NewRSS

func NewRSS(r io.Reader) (*RSS, error)

NewRSS attempts to parse the provided Reader into an RSS instance

type Tag

type Tag struct {
	ID   int    `xml:"term_id"`
	Slug string `xml:"tag_slug"`
	Name string `xml:"tag_name"`
}

Tag describes a tag in the blog export

type WpTime

type WpTime time.Time

WpTime exists to provide UnMarshaling for the wordpress pubDate format

func (WpTime) String

func (t WpTime) String() string

func (*WpTime) UnmarshalText

func (t *WpTime) UnmarshalText(text []byte) error

UnmarshalText attempts to unmarshall the provided byte slice as a time.RFC1123Z

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL