Documentation ¶
Overview ¶
Package xmlutils provides utilities for working with XML in the context of the Hexya Framework.
Index ¶
- func ApplyExtensions(base *etree.Element, specs *etree.Document) (*etree.Element, error)
- func ConcatXML(fileNames []string) ([]byte, [sha1.Size]byte, error)
- func CopyElement(element *etree.Element) *etree.Element
- func ElementToXML(element *etree.Element) ([]byte, error)
- func ElementToXMLNoIndent(element *etree.Element) ([]byte, error)
- func HasParentTag(element *etree.Element, parent string) bool
- func NextSibling(token etree.Token) etree.Token
- func PreviousSibling(token etree.Token) etree.Token
- func XMLToDocument(xmlStr string) (*etree.Document, error)
- func XMLToElement(xmlStr string) (*etree.Element, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyExtensions ¶
ApplyExtensions returns a copy of base with extension specs applied.
func ConcatXML ¶
ConcatXML concatenates the XML content of the files given by fileNames into a valid XML by importing all children of the root node into the root node of the first file. This function also returns the sha1sum of the result.
func CopyElement ¶
CopyElement deep copies the given element, setting it as root to a new document
func ElementToXML ¶
ElementToXML returns the XML bytes of the given element and all its children.
func ElementToXMLNoIndent ¶
ElementToXMLNoIndent returns the XML bytes of the given element and all its children, without indenting the result.
Use this function when the XML is HTML that needs to keep <tag></tag> syntax
func HasParentTag ¶
HasParentTag returns true if this element has at least one ancestor node with the given parent tag name
func NextSibling ¶
NextSibling returns the next sibling of the given token or nil if this is the last token of its parent
func PreviousSibling ¶
PreviousSibling returns the previous sibling of the given token. If this is the first token of its parent, return this token.
func XMLToDocument ¶
XMLToDocument parses the given xml string and returns an etree.Document
Types ¶
This section is empty.