{"modulePath":"github.com/dracory/nodebase","version":"v0.8.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package xml\n\nPackage xml contains the xml node implementation.\n\n## Types\n\n```go\ntype XMLConfig struct {\n\t// Property is the message field to convert; \"payload\" (default)\n\t// targets msg.Payload, otherwise a dotted path inside the data map\n\tProperty string `json:\"property\"`\n\t// Attr is the object key element attributes are collected under\n\t// (default \"$\"); an empty value merges attributes into the element\n\t// object\n\tAttr string `json:\"attr\"`\n\t// Chr is the object key element text is stored under (default \"_\")\n\tChr string `json:\"chr\"`\n\t// Pretty indents marshalled output with two spaces\n\tPretty bool `json:\"pretty\"`\n}\n```\nXMLConfig holds configuration for the xml node — a Node-RED XML parser equivalent producing xml2js-shaped objects.\n\n```go\ntype XMLNode struct {\n\t*nodebase.BaseNode\n\t// contains filtered or unexported fields\n}\n```\nXMLNode converts between an XML string and a generic map form using xml2js conventions:\n\n\tParse:   {tag: {\"$\": {attr: value}, childTag: [values], \"_\": text}}\n\tMarshal: an object is wrapped in a root element and prefixed with\n\t         the standard XML declaration.\n\nPer-message conversion options can be supplied via msg.options (explicitArray, mergeAttrs, ignoreAttrs, trim, normalize, attrkey, charkey, rootName). Element order is not preserved — payloads are unordered Go maps, so marshalled children emit in sorted order.\n\n```go\nfunc NewXMLNode(node nodestore.NodeInterface, config *XMLConfig) *XMLNode\n```\nNewXMLNode creates a new xml node\n\n```go\nfunc (n *XMLNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)\n```\nExecute reads the configured property, converts it and writes the result back: string → map (parse), map/other → XML string (marshal).\n\n","path":"github.com/dracory/nodebase/xml","name":"xml","synopsis":"Package xml contains the xml node implementation.","isRedistributable":true}
