Documentation ¶
Overview ¶
Package libxml2 is an interface to libxml2 library, providing XML and HTML parsers with DOM interface. The inspiration is Perl5's XML::LibXML module.
This library is still in very early stages of development. API may still change without notice.
For the time being, the API is being written so that thye are as close as we can get to DOM Layer 3, but some methods will, for the time being, be punted and aliases for simpler methods that don't necessarily check for the DOM's correctness will be used.
Also, the return values are still shaky -- I'm still debating how to handle error cases gracefully.
Index ¶
- func Parse(buf []byte, o ...parser.Option) (types.Document, error)
- func ParseHTML(content []byte, options ...parser.HTMLOption) (types.Document, error)
- func ParseHTMLReader(in io.Reader, options ...parser.HTMLOption) (types.Document, error)
- func ParseHTMLString(content string, options ...parser.HTMLOption) (types.Document, error)
- func ParseReader(rdr io.Reader, o ...parser.Option) (types.Document, error)
- func ParseString(s string, o ...parser.Option) (types.Document, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseHTML ¶
ParseHTML parses an HTML document. You can omit the options argument, or you can provide one bitwise-or'ed option
func ParseHTMLReader ¶
ParseHTMLReader parses an HTML document. You can omit the options argument, or you can provide one bitwise-or'ed option
func ParseHTMLString ¶
ParseHTMLString parses an HTML document. You can omit the options argument, or you can provide one bitwise-or'ed option
func ParseReader ¶
ParseReader parses XML from the given io.Reader and returns a Document.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package clib holds all of the dirty C interaction for go-libxml2.
|
Package clib holds all of the dirty C interaction for go-libxml2. |
internal
|
|
Package types exist to provide with common types that are used through out in go-libxml2.
|
Package types exist to provide with common types that are used through out in go-libxml2. |
Package xpath contains tools to handle XPath evaluation.
|
Package xpath contains tools to handle XPath evaluation. |
Package xsd contains some of the tools available from libxml2 that allows you to validate your XML against an XSD This is basically all you need to do: schema, err := xsd.Parse(xsdsrc) if err != nil { panic(err) } defer schema.Free() if err := schema.Validate(doc); err != nil{ for _, e := range err.(SchemaValidationErr).Error() { println(e.Error()) } }
|
Package xsd contains some of the tools available from libxml2 that allows you to validate your XML against an XSD This is basically all you need to do: schema, err := xsd.Parse(xsdsrc) if err != nil { panic(err) } defer schema.Free() if err := schema.Validate(doc); err != nil{ for _, e := range err.(SchemaValidationErr).Error() { println(e.Error()) } } |