Documentation
¶
Index ¶
- func CleanInvalid(xmlStr string) string
- func CreateXPath(expr string) (*xpath.Expr, error)
- func ElementText(doc *Document, tagName string) (string, error)
- func GetByXPath(doc *Document, expr string) ([]*xmlquery.Node, error)
- func GetElement(doc *Document, tagName string) *xmlquery.Node
- func GetElements(doc *Document, tagName string) []*xmlquery.Node
- func ReadObjectFromXML(filePath string, obj interface{}) error
- func ToFile(doc *Document, filePath string) error
- func ToStr(doc *Document) (string, error)
- func TransElements(nodeList []*xmlquery.Node) []*xmlquery.Node
- func WriteObjectAsXML(obj interface{}, filePath string) error
- type Document
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanInvalid ¶
CleanInvalid 去除XML文本中的无效字符。 CleanInvalid removes invalid characters from an XML string.
func CreateXPath ¶
CreateXPath 创建一个新的XPath对象。 CreateXPath creates a new XPath object.
func ElementText ¶
ElementText 根据节点名获得第一个子节点的文本值。 ElementText gets the text content of the first child element by tag name.
func GetByXPath ¶
GetByXPath 通过XPath表达式获取XML节点。 GetByXPath gets XML nodes by an XPath expression.
func GetElement ¶
GetElement 根据节点名获得第一个子节点。 GetElement gets the first child element by tag name.
func GetElements ¶
GetElements 根据节点名获得子节点列表。 GetElements gets a list of child elements by tag name.
func ReadObjectFromXML ¶
ReadObjectFromXML 从XML中读取对象。 ReadObjectFromXML reads an object from an XML file.
func TransElements ¶
TransElements 将NodeList转换为Element列表。 TransElements converts a NodeList to a list of Elements.
func WriteObjectAsXML ¶
WriteObjectAsXML 将可序列化的对象转换为XML写入文件。 WriteObjectAsXML writes a serializable object to an XML file.