Documentation
¶
Overview ¶
Package golibxml is a simple wrapper for libxml2.
Index ¶
- Constants
- func CleanupMemory()
- func CleanupParser()
- func GetFeaturesList() []string
- func InitMemory()
- func IsBooleanAttr(name string) bool
- func MemBlocks() int
- func MemUsed() int
- func MemoryDump()
- func RemoveAttribute(attr *Attribute) int
- func SetAllocationScheme(scheme AllocationScheme)
- func SetCompressionLevel(level int)
- func SubstituteEntitiesDefault(val int) int
- func ValidateNCName(value string, space int) int
- func ValidateNMToken(value string, space int) int
- func ValidateName(value string, space int) int
- func ValidateQName(value string, space int) int
- func XpathIsNaN(val float32) int
- type AllocationScheme
- type Attribute
- func (attr *Attribute) Children() *Node
- func (attr *Attribute) Copy(target *Node) *Attribute
- func (attr *Attribute) CopyList(target *Node) *Attribute
- func (attr *Attribute) Free()
- func (attr *Attribute) FreeList()
- func (attr *Attribute) Name() string
- func (attr *Attribute) Namespace() *Namespace
- func (attr *Attribute) Next() *Attribute
- func (attr *Attribute) Type() ElementType
- type Buffer
- func (buffer *Buffer) Add(str []byte) int
- func (buffer *Buffer) AddHead(str []byte) int
- func (buffer *Buffer) Cat(str string) int
- func (buffer *Buffer) Content() string
- func (buffer *Buffer) Empty()
- func (buffer *Buffer) Free()
- func (buffer *Buffer) Grow(length int) int
- func (buffer *Buffer) Length() int
- func (buffer *Buffer) Resize(size int) int
- func (buffer *Buffer) SetAllocationScheme(scheme AllocationScheme)
- func (buffer *Buffer) Shrink(length int) int
- func (buffer *Buffer) WriteChar(str string)
- type Document
- func NewDoc(version string) *Document
- func ParseDoc(cur string) *Document
- func ParseEntity(filename string) *Document
- func ParseFile(filename string) *Document
- func ParseMemory(buffer []byte) *Document
- func ReadDoc(input string, url string, encoding string, options ParserOption) *Document
- func ReadFile(filename string, encoding string, options ParserOption) *Document
- func ReadMemory(buffer []byte, url string, encoding string, options ParserOption) *Document
- func RecoverDoc(cur string) *Document
- func RecoverFile(filename string) *Document
- func RecoverMemory(buffer []byte) *Document
- func (doc *Document) Copy(recursive int) *Document
- func (doc *Document) Free()
- func (doc *Document) NewComment(content string) *Node
- func (doc *Document) NewDtd(name string, ExternalID string, SystemID string) *Dtd
- func (doc *Document) NewFragment() *Node
- func (doc *Document) NewNode(ns *Namespace, name string, content string) *Node
- func (doc *Document) NewProp(name string, value string) *Attribute
- func (doc *Document) NewRawNode(ns *Namespace, name string, content string) *Node
- func (doc *Document) NewText(content string) *TextNode
- func (doc *Document) NodeDump(buf *Buffer, cur *Node, level int, format int) int
- func (doc *Document) OrderDocElems() int
- func (doc *Document) Root() *Node
- func (doc *Document) SaveFile(filename string) int
- func (doc *Document) SaveFileEnc(filename string, encoding string) int
- func (doc *Document) SaveFormatFile(filename string, format int) int
- func (doc *Document) SaveFormatFileEnc(filename string, encoding string, format int) int
- func (doc *Document) SetCompressionLevel(level int)
- func (doc *Document) SetRoot(root *Node) *Node
- func (doc *Document) String() string
- type Dtd
- type ElemDesc
- type ElementType
- type Encoding
- type HTMLDocument
- func NewHTMLDoc(uri string, external_id string) *HTMLDocument
- func NewHTMLDocNoDtd() *HTMLDocument
- func ParseHTMLDoc(cur string, encoding string) *HTMLDocument
- func ParseHTMLFile(filename string, encoding string) *HTMLDocument
- func ReadHTMLDoc(cur string, url string, encoding string, options HTMLParserOption) *HTMLDocument
- func ReadHTMLFile(filename string, encoding string, options HTMLParserOption) *HTMLDocument
- func ReadHTMLMemory(buffer []byte, url string, encoding string, options HTMLParserOption) *HTMLDocument
- func (doc *HTMLDocument) AutoCloseTag(name string, node *Node) bool
- func (doc *HTMLDocument) GetMetaEncoding() string
- func (doc *HTMLDocument) NodeDump(buf *Buffer, cur *HTMLNode) int
- func (doc *HTMLDocument) SaveFile(filename string) int
- func (doc *HTMLDocument) SaveFileEnc(filename string, encoding string) int
- func (doc *HTMLDocument) SaveFileFormat(filename string, encoding string, format int) int
- func (doc *HTMLDocument) SetMetaEncoding(encoding string) int
- func (doc *HTMLDocument) String() string
- type HTMLNode
- type HTMLParser
- type HTMLParserOption
- type Namespace
- type Node
- func (parent *Node) AddChild(cur *Node) *Node
- func (parent *Node) AddChildList(cur Node) *Node
- func (node *Node) AddContent(content string)
- func (cur *Node) AddNextSibling(elem Node) *Node
- func (cur *Node) AddPrevSibling(elem Node) *Node
- func (cur *Node) AddSibling(elem Node) *Node
- func (node *Node) Attributes() *Attribute
- func (node *Node) ChildCount() int
- func (node *Node) Children() *Node
- func (node *Node) Copy(extended int) *Node
- func (node *Node) CopyList() *Node
- func (node *Node) Document() *Document
- func (node *Node) FirstChild() *Node
- func (node *Node) Free()
- func (node *Node) FreeList()
- func (node *Node) GetContent() string
- func (node *Node) LastChild() *Node
- func (node *Node) LastElementChild() *Node
- func (node *Node) ListGetString(inLine bool) string
- func (node *Node) Name() string
- func (node *Node) Namespace() *Namespace
- func (node *Node) NewAttribute(name string, value string) *Attribute
- func (node *Node) NewChild(ns *Namespace, name string, content string) *Node
- func (node *Node) NewNs(href string, prefix string) *Namespace
- func (node *Node) NewTextChild(ns *Namespace, name string, content string) *TextNode
- func (node *Node) Next() *Node
- func (node *Node) NextSibling() *Node
- func (node *Node) Path() string
- func (node *Node) PreviousSibling() *Node
- func (old *Node) Replace(cur *Node) *Node
- func (node *Node) SetAttribute(name string, value string) *Attribute
- func (node *Node) SetContent(content string)
- func (node *Node) SetName(name string)
- func (node *Node) String() string
- func (node *Node) Type() ElementType
- func (node *Node) Unlink()
- func (node *Node) UnsetNsProp(ns *Namespace, name string) int
- func (node *Node) UnsetProp(name string) int
- type NodeSet
- type Parser
- func (p *Parser) ByteConsumed() int
- func (p *Parser) Clear()
- func (p *Parser) Free()
- func (p *Parser) MyDoc() *Document
- func (p *Parser) Parse() int
- func (p *Parser) ReadDoc(input string, url string, encoding string, options ParserOption) *Document
- func (p *Parser) Reset()
- func (p *Parser) Stop()
- func (p *Parser) UseOptions(options ParserOption) int
- type ParserOption
- type ReaderType
- type TextNode
- type TextReader
- func (r *TextReader) Depth() int
- func (r *TextReader) Free()
- func (r *TextReader) GetAttribute(name string) *string
- func (r *TextReader) LocalName() string
- func (r *TextReader) MoveToFirstAttribute() int
- func (r *TextReader) MoveToNextAttribute() int
- func (r *TextReader) Name() string
- func (r *TextReader) NamespaceUri() string
- func (r *TextReader) Next() int
- func (r *TextReader) NodeType() ReaderType
- func (r *TextReader) Prefix() string
- func (r *TextReader) Read() int
- func (r *TextReader) ReadString() string
- func (r *TextReader) Value() string
- type XPath
- type XPathContext
- type XPathObject
- func (obj *XPathObject) CastToNumber() float32
- func (obj *XPathObject) ConvertBoolean() *XPathObject
- func (obj *XPathObject) ConvertNumber() *XPathObject
- func (obj *XPathObject) ConvertString() *XPathObject
- func (obj *XPathObject) Copy() *XPathObject
- func (obj *XPathObject) Free()
- func (obj *XPathObject) FreeList()
- func (obj *XPathObject) Results() chan *Node
- func (obj *XPathObject) String() string
- type XpathObjectType
Constants ¶
const ( HTML_PARSE_RECOVER HTMLParserOption = C.HTML_PARSE_RECOVER //: Relaxed parsing HTML_PARSE_NODEFDTD = C.HTML_PARSE_NODEFDTD //: do not default a doctype if not found HTML_PARSE_NOERROR = C.HTML_PARSE_NOERROR //: suppress error reports HTML_PARSE_NOWARNING = C.HTML_PARSE_NOWARNING //: suppress warning reports HTML_PARSE_PEDANTIC = C.HTML_PARSE_PEDANTIC //: pedantic error reporting HTML_PARSE_NOBLANKS = C.HTML_PARSE_NOBLANKS //: remove blank nodes HTML_PARSE_NONET = C.HTML_PARSE_NONET //: Forbid network access HTML_PARSE_NOIMPLIED = C.HTML_PARSE_NOIMPLIED //: Do not add implied html/body... elements HTML_PARSE_COMPACT = C.HTML_PARSE_COMPACT //: compact small text nodes )
const ( XML_CHAR_ENCODING_ERROR Encoding = -1 //: No char encoding detected XML_CHAR_ENCODING_NONE = 0 //: No char encoding detected XML_CHAR_ENCODING_UTF8 = 1 //: UTF-8 XML_CHAR_ENCODING_UTF16LE = 2 //: UTF-16 little endian XML_CHAR_ENCODING_UTF16BE = 3 //: UTF-16 big endian XML_CHAR_ENCODING_UCS4LE = 4 //: UCS-4 little endian XML_CHAR_ENCODING_UCS4BE = 5 //: UCS-4 big endian XML_CHAR_ENCODING_EBCDIC = 6 //: EBCDIC uh! XML_CHAR_ENCODING_UCS4_2143 = 7 //: UCS-4 unusual ordering XML_CHAR_ENCODING_UCS4_3412 = 8 //: UCS-4 unusual ordering XML_CHAR_ENCODING_UCS2 = 9 //: UCS-2 XML_CHAR_ENCODING_8859_1 = 10 //: ISO-8859-1 ISO Latin 1 XML_CHAR_ENCODING_8859_2 = 11 //: ISO-8859-2 ISO Latin 2 XML_CHAR_ENCODING_8859_3 = 12 //: ISO-8859-3 XML_CHAR_ENCODING_8859_4 = 13 //: ISO-8859-4 XML_CHAR_ENCODING_8859_5 = 14 //: ISO-8859-5 XML_CHAR_ENCODING_8859_6 = 15 //: ISO-8859-6 XML_CHAR_ENCODING_8859_7 = 16 //: ISO-8859-7 XML_CHAR_ENCODING_8859_8 = 17 //: ISO-8859-8 XML_CHAR_ENCODING_8859_9 = 18 //: ISO-8859-9 XML_CHAR_ENCODING_2022_JP = 19 //: ISO-2022-JP XML_CHAR_ENCODING_SHIFT_JIS = 20 //: Shift_JIS XML_CHAR_ENCODING_EUC_JP = 21 //: EUC-JP XML_CHAR_ENCODING_ASCII = 22 //: pure ASCII )
const ( XML_PARSE_RECOVER ParserOption = C.XML_PARSE_RECOVER //: recover on errors XML_PARSE_NOENT = C.XML_PARSE_NOENT //: substitute entities XML_PARSE_DTDLOAD = C.XML_PARSE_DTDLOAD //: load the external subset XML_PARSE_DTDATTR = C.XML_PARSE_DTDATTR //: default DTD attributes XML_PARSE_DTDVALID = C.XML_PARSE_DTDVALID //: validate with the DTD XML_PARSE_NOERROR = C.XML_PARSE_NOERROR //: suppress error reports XML_PARSE_NOWARNING = C.XML_PARSE_NOWARNING //: suppress warning reports XML_PARSE_PEDANTIC = C.XML_PARSE_PEDANTIC //: pedantic error reporting XML_PARSE_NOBLANKS = C.XML_PARSE_NOBLANKS //: remove blank nodes XML_PARSE_SAX1 = C.XML_PARSE_SAX1 //: use the SAX1 interface internally XML_PARSE_XINCLUDE = C.XML_PARSE_XINCLUDE //: Implement XInclude substitition XML_PARSE_NONET = C.XML_PARSE_NONET //: Forbid network access XML_PARSE_NODICT = C.XML_PARSE_NODICT //: Do not reuse the context dictionnary XML_PARSE_NSCLEAN = C.XML_PARSE_NSCLEAN //: remove redundant namespaces declarations XML_PARSE_NOCDATA = C.XML_PARSE_NOCDATA //: merge CDATA as text nodes XML_PARSE_NOXINCNODE = C.XML_PARSE_NOXINCNODE //: do not generate XINCLUDE START/END nodes XML_PARSE_COMPACT = C.XML_PARSE_COMPACT //: compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) XML_PARSE_OLD10 = C.XML_PARSE_OLD10 //: parse using XML-1.0 before update 5 XML_PARSE_NOBASEFIX = C.XML_PARSE_NOBASEFIX //: do not fixup XINCLUDE xml:base uris XML_PARSE_HUGE = C.XML_PARSE_HUGE //: relax any hardcoded limit from the parser XML_PARSE_OLDSAX = C.XML_PARSE_OLDSAX //: parse using SAX2 interface from before 2.7.0 )
const ( XML_READER_TYPE_NONE ReaderType = C.XML_READER_TYPE_NONE XML_READER_TYPE_ELEMENT = C.XML_READER_TYPE_ELEMENT XML_READER_TYPE_ATTRIBUTE = C.XML_READER_TYPE_ATTRIBUTE XML_READER_TYPE_TEXT = C.XML_READER_TYPE_TEXT XML_READER_TYPE_CDATA = C.XML_READER_TYPE_CDATA XML_READER_TYPE_ENTITY_REFERENCE = C.XML_READER_TYPE_ENTITY_REFERENCE XML_READER_TYPE_ENTITY = C.XML_READER_TYPE_ENTITY XML_READER_TYPE_PROCESSING_INSTRUCTION = C.XML_READER_TYPE_PROCESSING_INSTRUCTION XML_READER_TYPE_COMMENT = C.XML_READER_TYPE_COMMENT XML_READER_TYPE_DOCUMENT = C.XML_READER_TYPE_DOCUMENT XML_READER_TYPE_DOCUMENT_TYPE = C.XML_READER_TYPE_DOCUMENT_TYPE XML_READER_TYPE_DOCUMENT_FRAGMENT = C.XML_READER_TYPE_DOCUMENT_FRAGMENT XML_READER_TYPE_NOTATION = C.XML_READER_TYPE_NOTATION XML_READER_TYPE_WHITESPACE = C.XML_READER_TYPE_WHITESPACE XML_READER_TYPE_SIGNIFICANT_WHITESPACE = C.XML_READER_TYPE_SIGNIFICANT_WHITESPACE XML_READER_TYPE_END_ELEMENT = C.XML_READER_TYPE_END_ELEMENT XML_READER_TYPE_END_ENTITY = C.XML_READER_TYPE_END_ENTITY XML_READER_TYPE_XML_DECLARATION = C.XML_READER_TYPE_XML_DECLARATION )
const ( XML_BUFFER_ALLOC_DOUBLEIT AllocationScheme = 1 //: double each time one need to grow XML_BUFFER_ALLOC_EXACT = 2 //: grow only to the minimal size XML_BUFFER_ALLOC_IMMUTABLE = 3 //: immutable buffer XML_BUFFER_ALLOC_IO = 4 //: special allocation scheme used for I/O )
const ( XML_ELEMENT_NODE ElementType = 1 XML_ATTRIBUTE_NODE = 2 XML_TEXT_NODE = 3 XML_CDATA_SECTION_NODE = 4 XML_ENTITY_REF_NODE = 5 XML_ENTITY_NODE = 6 XML_PI_NODE = 7 XML_COMMENT_NODE = 8 XML_DOCUMENT_NODE = 9 XML_DOCUMENT_TYPE_NODE = 10 XML_DOCUMENT_FRAG_NODE = 11 XML_NOTATION_NODE = 12 XML_HTML_DOCUMENT_NODE = 13 XML_DTD_NODE = 14 XML_ELEMENT_DECL = 15 XML_ATTRIBUTE_DECL = 16 XML_ENTITY_DECL = 17 XML_NAMESPACE_DECL = 18 XML_XINCLUDE_START = 19 XML_XINCLUDE_END = 20 XML_DOCB_DOCUMENT_NODE = 21 )
const ( XPATH_UNDEFINED XpathObjectType = 0 XPATH_NODESET = 1 XPATH_BOOLEAN = 2 XPATH_NUMBER = 3 XPATH_STRING = 4 XPATH_POINT = 5 XPATH_RANGE = 6 XPATH_LOCATIONSET = 7 XPATH_USERS = 8 XPATH_XSLT_TREE = 9 //: An XSLT value tree, non modifiable )
Variables ¶
This section is empty.
Functions ¶
func SetAllocationScheme ¶
func SetAllocationScheme(scheme AllocationScheme)
xmlSetBufferAllocationScheme
func SubstituteEntitiesDefault ¶
xmlSubstituteEntitiesDefault
Types ¶
type AllocationScheme ¶
type AllocationScheme int
type Attribute ¶
type Attribute struct {
Ptr C.xmlAttrPtr
}
func (*Attribute) Type ¶
func (attr *Attribute) Type() ElementType
type Buffer ¶
type Buffer struct {
Ptr C.xmlBufferPtr
}
func (*Buffer) SetAllocationScheme ¶
func (buffer *Buffer) SetAllocationScheme(scheme AllocationScheme)
xmlBufferSetAllocationScheme
type Document ¶
func ReadDoc ¶
func ReadDoc(input string, url string, encoding string, options ParserOption) *Document
xmlReadDoc
func ReadFile ¶
func ReadFile(filename string, encoding string, options ParserOption) *Document
xmlReadFile
func ReadMemory ¶
func ReadMemory(buffer []byte, url string, encoding string, options ParserOption) *Document
xmlReadMemory
func (*Document) NewComment ¶
xmlNewDocComment
func (*Document) NewRawNode ¶
xmlNewDocRawNode
func (*Document) SaveFileEnc ¶
xmlSaveFileEnc
func (*Document) SaveFormatFile ¶
xmlSaveFormatFile
func (*Document) SaveFormatFileEnc ¶
xmlSaveFormatFileEnc
func (*Document) SetCompressionLevel ¶
xmlSetDocCompressMode
type ElemDesc ¶
type ElemDesc struct {
Ptr C.htmlElemDescPtr
}
type ElementType ¶
type ElementType int
func (ElementType) GoString ¶
func (elem ElementType) GoString() string
func (ElementType) String ¶
func (elem ElementType) String() string
type HTMLDocument ¶
type HTMLDocument struct {
*Document
*HTMLNode
Ptr C.htmlDocPtr
}
func ParseHTMLFile ¶
func ParseHTMLFile(filename string, encoding string) *HTMLDocument
htmlParseFile
func ReadHTMLDoc ¶
func ReadHTMLDoc(cur string, url string, encoding string, options HTMLParserOption) *HTMLDocument
htmlReadDoc
func ReadHTMLFile ¶
func ReadHTMLFile(filename string, encoding string, options HTMLParserOption) *HTMLDocument
htmlReadFile
func ReadHTMLMemory ¶
func ReadHTMLMemory(buffer []byte, url string, encoding string, options HTMLParserOption) *HTMLDocument
htmlReadMemory
func (*HTMLDocument) AutoCloseTag ¶
func (doc *HTMLDocument) AutoCloseTag(name string, node *Node) bool
htmlAutoCloseTag
func (*HTMLDocument) GetMetaEncoding ¶
func (doc *HTMLDocument) GetMetaEncoding() string
htmlGetMetaEncoding
func (*HTMLDocument) NodeDump ¶
func (doc *HTMLDocument) NodeDump(buf *Buffer, cur *HTMLNode) int
htmlNodeDump
func (*HTMLDocument) SaveFileEnc ¶
func (doc *HTMLDocument) SaveFileEnc(filename string, encoding string) int
htmlSaveFileEnc
func (*HTMLDocument) SaveFileFormat ¶
func (doc *HTMLDocument) SaveFileFormat(filename string, encoding string, format int) int
htmlSaveFileFormat
func (*HTMLDocument) SetMetaEncoding ¶
func (doc *HTMLDocument) SetMetaEncoding(encoding string) int
htmlSetMetaEncoding
func (*HTMLDocument) String ¶
func (doc *HTMLDocument) String() string
type HTMLNode ¶
type HTMLNode struct {
*Node
Ptr C.htmlNodePtr
}
type HTMLParser ¶
type HTMLParser struct {
Ptr C.htmlParserCtxtPtr
}
func (*HTMLParser) ReadDoc ¶
func (p *HTMLParser) ReadDoc(input string, url string, encoding string, options ParserOption) *HTMLDocument
htmlCtxtReadDoc
func (*HTMLParser) UseOptions ¶
func (p *HTMLParser) UseOptions(options HTMLParserOption) int
htmlCtxtUseOptions
type HTMLParserOption ¶
type HTMLParserOption int
type Node ¶
type Node struct {
Ptr C.xmlNodePtr
}
func (*Node) Attributes ¶
func (*Node) ListGetString ¶
xmlNodeListGetString
func (*Node) NewAttribute ¶
xmlNewProp
func (*Node) NewTextChild ¶
xmlNewTextChild
func (*Node) SetAttribute ¶
xmlSetProp
func (*Node) Type ¶
func (node *Node) Type() ElementType
func (*Node) UnsetNsProp ¶
xmlUnsetNsProp
type NodeSet ¶
type NodeSet struct {
Ptr C.xmlNodeSetPtr
}
type ParserOption ¶
type ParserOption int
type ReaderType ¶
type ReaderType int
xmlReaderTypes
func (ReaderType) String ¶
func (t ReaderType) String() string
type TextReader ¶
type TextReader struct {
Ptr C.xmlTextReaderPtr
// contains filtered or unexported fields
}
func ReaderForMemory ¶
func ReaderForMemory(buffer string, url, encoding string, options ParserOption) *TextReader
xmlReaderForMemory
func (*TextReader) GetAttribute ¶
func (r *TextReader) GetAttribute(name string) *string
xmlTextReaderGetAttribute
func (*TextReader) MoveToFirstAttribute ¶
func (r *TextReader) MoveToFirstAttribute() int
xmlTextReaderMoveToFirstAttribute
func (*TextReader) MoveToNextAttribute ¶
func (r *TextReader) MoveToNextAttribute() int
xmlTextReaderMoveToNextAttribute
func (*TextReader) NamespaceUri ¶
func (r *TextReader) NamespaceUri() string
xmlTextReaderConstNamespaceUri
type XPath ¶
type XPath struct {
Ptr C.xmlXPathCompExprPtr
}
type XPathContext ¶
type XPathContext struct {
Ptr C.xmlXPathContextPtr
}
func (*XPathContext) Compile ¶
func (ctx *XPathContext) Compile(str string) *XPath
xmlXPathCtxtCompile
func (*XPathContext) EvalExpression ¶
func (ctx *XPathContext) EvalExpression(str string) *XPathObject
xmlXPathEvalExpression
func (*XPathContext) EvalPredicate ¶
func (ctx *XPathContext) EvalPredicate(res *XPathObject) bool
xmlXPathEvalPredicate
type XPathObject ¶
type XPathObject struct {
Ptr C.xmlXPathObjectPtr
}
func (*XPathObject) CastToNumber ¶
func (obj *XPathObject) CastToNumber() float32
xmlXPathCastToNumber
func (*XPathObject) ConvertBoolean ¶
func (obj *XPathObject) ConvertBoolean() *XPathObject
xmlXPathConvertBoolean
func (*XPathObject) ConvertNumber ¶
func (obj *XPathObject) ConvertNumber() *XPathObject
xmlXPathConvertNumber
func (*XPathObject) ConvertString ¶
func (obj *XPathObject) ConvertString() *XPathObject
xmlXPathConvertString
func (*XPathObject) Results ¶
func (obj *XPathObject) Results() chan *Node
type XpathObjectType ¶
type XpathObjectType int
