html

package
Version: v0.0.0-...-3bb3441 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2013 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTML_PARSE_RECOVER   xml.ParseOption = 1 << 0  /* Relaxed parsing */
	HTML_PARSE_NODEFDTD  xml.ParseOption = 1 << 2  /* do not default a doctype if not found */
	HTML_PARSE_NOERROR   xml.ParseOption = 1 << 5  /* suppress error reports */
	HTML_PARSE_NOWARNING xml.ParseOption = 1 << 6  /* suppress warning reports */
	HTML_PARSE_PEDANTIC  xml.ParseOption = 1 << 7  /* pedantic error reporting */
	HTML_PARSE_NOBLANKS  xml.ParseOption = 1 << 8  /* remove blank nodes */
	HTML_PARSE_NONET     xml.ParseOption = 1 << 11 /* Forbid network access */
	HTML_PARSE_NOIMPLIED xml.ParseOption = 1 << 13 /* Do not add implied html/body... elements */
	HTML_PARSE_COMPACT   xml.ParseOption = 1 << 16 /* compact small text nodes */
)

xml parse option

View Source
const EmptyHtmlDoc = ""

Variables

View Source
var DefaultEncodingBytes = []byte(xml.DefaultEncoding)

default encoding in byte slice

default parsing option: relax parsing

View Source
var ERR_FAILED_TO_PARSE_HTML = errors.New("failed to parse html input")
View Source
var ErrEmptyFragment = errors.New("empty html fragment")
View Source
var ErrFailParseFragment = errors.New("failed to parse html fragment")
View Source
var ErrSetMetaEncoding = errors.New("Set Meta Encoding failed")

Functions

func ParseFragment

func ParseFragment(content, inEncoding, url []byte, options xml.ParseOption, outEncoding []byte) (fragment *xml.DocumentFragment, err error)

Types

type HtmlDocument

type HtmlDocument struct {
	*xml.XmlDocument
}

func CreateEmptyDocument

func CreateEmptyDocument(inEncoding, outEncoding []byte) (doc *HtmlDocument)

func NewDocument

func NewDocument(p unsafe.Pointer, contentLen int, inEncoding, outEncoding []byte) (doc *HtmlDocument)

create a document

func Parse

func Parse(content, inEncoding, url []byte, options xml.ParseOption, outEncoding []byte) (doc *HtmlDocument, err error)

parse a string to document

func (*HtmlDocument) MetaEncoding

func (doc *HtmlDocument) MetaEncoding() string

func (*HtmlDocument) ParseFragment

func (document *HtmlDocument) ParseFragment(input, url []byte, options xml.ParseOption) (fragment *xml.DocumentFragment, err error)

func (*HtmlDocument) SetMetaEncoding

func (doc *HtmlDocument) SetMetaEncoding(encoding string) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL