mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 00:54:51 +08:00
Added XML encoding/decoding (#1067)
* Added XML encoding/decoding * Minor fixes * Improve yq doc * Lint
This commit is contained in:
+16
-2
@@ -18,8 +18,6 @@ type xmlPreferences struct {
|
||||
ContentName string
|
||||
}
|
||||
|
||||
var XmlPreferences = xmlPreferences{AttributePrefix: "+", ContentName: "+content"}
|
||||
|
||||
var log = logging.MustGetLogger("yq-lib")
|
||||
|
||||
// GetLogger returns the yq logger instance.
|
||||
@@ -236,6 +234,22 @@ func createScalarNode(value interface{}, stringValue string) *yaml.Node {
|
||||
return node
|
||||
}
|
||||
|
||||
func headAndLineComment(node *yaml.Node) string {
|
||||
return headComment(node) + lineComment(node)
|
||||
}
|
||||
|
||||
func headComment(node *yaml.Node) string {
|
||||
return strings.Replace(node.HeadComment, "#", "", 1)
|
||||
}
|
||||
|
||||
func lineComment(node *yaml.Node) string {
|
||||
return strings.Replace(node.LineComment, "#", "", 1)
|
||||
}
|
||||
|
||||
func footComment(node *yaml.Node) string {
|
||||
return strings.Replace(node.FootComment, "#", "", 1)
|
||||
}
|
||||
|
||||
func createValueOperation(value interface{}, stringValue string) *Operation {
|
||||
var node *yaml.Node = createScalarNode(value, stringValue)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user