Documentation
¶
Overview ¶
Package xml contains the xml node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XMLConfig ¶
type XMLConfig struct {
// Property is the message field to convert; "payload" (default)
// targets msg.Payload, otherwise a dotted path inside the data map
Property string `json:"property"`
// Pretty indents marshalled output with two spaces
Pretty bool `json:"pretty"`
}
XMLConfig holds configuration for the xml node — a simplified Node-RED XML parser equivalent.
type XMLNode ¶
XMLNode converts between an XML string and a generic map form.
Map shape produced by parsing:
{tag: {"@attr": value, childTag: child | []child, "#text": "..."}}
The marshal direction accepts that same shape plus flat maps of {tag: scalar}; a map with several keys is wrapped in a <root> element. encoding/xml is lossy compared to Node-RED's xml2js — element order, mixed content and namespaces are not preserved.
func NewXMLNode ¶
func NewXMLNode(node nodestore.NodeInterface, config *XMLConfig) *XMLNode
NewXMLNode creates a new xml node
func (*XMLNode) Execute ¶
func (n *XMLNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute reads the configured property, converts it and writes the result back: string → map (parse), map/other → XML string (marshal).