xml

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type XMLNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

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

Execute reads the configured property, converts it and writes the result back: string → map (parse), map/other → XML string (marshal).

Jump to

Keyboard shortcuts

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