xmlq is a Go library for pretty printing xml and masking element values. XML inside of CDATA stanzas is also masked and indented.
import (
"github.com/adamdecaf/xmlq/pkg/xmlq"
)
var (
xmlData io.Reader
)
output, err := xmlq.MarshalIndent(xmlData, &Options{
Indent: " ", // two spaces
Masks: []Mask{
{
// <ct:Id>11000179512199001</ct:Id>
Name: "Id",
Mask: ShowLastFour,
},
{
// <ct:Nm>John Doe</ct:Nm>
Name: "Nm",
Mask: ShowWordStart,
},
},
})
- 64-bit Linux (Ubuntu, Debian), macOS, and Windows
Apache License 2.0 - See LICENSE for details.