xml

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckWellFormed

func CheckWellFormed(input string, document bool) error

CheckWellFormed returns an error if `input` is not well-formed XML content, or not a well-formed XML document when `document` is set.

func Compile

func Compile(expr string, namespaces map[string]string) (*xpath.Expr, error)

Compile compiles the XPath expression `expr` using the prefix-to-URI map `namespaces`.

func Concat

func Concat(values ...string) string

Concat concatenates the xml values `values`, merging their XML declarations the way PostgreSQL's `xmlconcat` does.

func Declaration

func Declaration(version string, standalone string) string

Declaration returns the XML declaration that PostgreSQL prints for the given version and standalone values, which is empty when the version is 1.0 (or unknown) and standalone is absent.

func EscapeText

func EscapeText(str string) string

EscapeText escapes the characters of `str` that may not appear literally in XML text.

func Evaluate

func Evaluate(expr *xpath.Expr, nav xpath.NodeNavigator) (result any, err error)

Evaluate evaluates `expr` with `nav` as the context node, returning a `*xpath.NodeIterator`, bool, float64, or string.

func NodeToXml

func NodeToXml(nav *xmlquery.NodeNavigator) string

NodeToXml converts a node selected by an XPath expression into the text of an xml value.

func Output

func Output(str string) string

Output returns the text form of an xml value, dropping or trimming a leading XML declaration the way PostgreSQL's `xml_out` does.

func ParseDocument

func ParseDocument(str string) (*xmlquery.Node, error)

ParseDocument parses `str` as an XML document.

func ScalarToString

func ScalarToString(result any) string

ScalarToString formats a non-node XPath result the way the XPath `string` function does.

func SplitDeclaration

func SplitDeclaration(str string) (version string, standalone string, rest string)

SplitDeclaration splits a leading XML declaration off `str`, returning its version and standalone values (both empty when there is no declaration) along with the remaining text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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