From dbe3921f5d87f1ea52179c1c902e34c8e154adb1 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Thu, 16 Dec 2021 22:20:37 +1100 Subject: [PATCH] wipt --- pkg/yqlib/decoder_xml.go | 5 ++++- pkg/yqlib/stream_evaluator.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/yqlib/decoder_xml.go b/pkg/yqlib/decoder_xml.go index f50cdeae..e079e384 100644 --- a/pkg/yqlib/decoder_xml.go +++ b/pkg/yqlib/decoder_xml.go @@ -17,7 +17,10 @@ type xmlDecoder struct { } func NewXmlDecoder(reader io.Reader, attributePrefix string, contentPrefix string) Decoder { - return &xmlDecoder{reader: reader, attributePrefix: attributePrefix, contentPrefix: "c", finished: false} + if contentPrefix == "" { + contentPrefix = "content" + } + return &xmlDecoder{reader: reader, attributePrefix: attributePrefix, contentPrefix: contentPrefix, finished: false} } func (dec *xmlDecoder) createSequence(nodes []*xmlNode) (*yaml.Node, error) { diff --git a/pkg/yqlib/stream_evaluator.go b/pkg/yqlib/stream_evaluator.go index 3c9504b7..34192259 100644 --- a/pkg/yqlib/stream_evaluator.go +++ b/pkg/yqlib/stream_evaluator.go @@ -93,7 +93,7 @@ func (s *streamEvaluator) EvaluateFiles(expression string, filenames []string, p func (s *streamEvaluator) Evaluate(filename string, reader io.Reader, node *ExpressionNode, printer Printer, leadingContent string) (uint, error) { var currentIndex uint - decoder := NewXmlDecoder(reader, "+", "c") + decoder := NewXmlDecoder(reader, "+", "") for { var dataBucket yaml.Node errorReading := decoder.Decode(&dataBucket)