Discussion?
While trying to use Dasel as a Go package in a personal project updatecli, I noticed that it drops XML comments, directives, and processes.
Describe the bug
Dasel don't preserve initial XML content.
To Reproduce
The command dasel -f example.xml -p xml
.example.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This a commment -->
<name>
<firstname tag="xx">John</firstname>
<lastname>Doe</lastname>
</name>
.output
<name>
<firstname tag="xx">John</firstname>
<lastname>Doe</lastname>
</name>
.expectedOutput
<?xml version="1.0" encoding="UTF-8"?>
<!-- This a commment -->
<name>
<firstname tag="xx">John</firstname>
<lastname>Doe</lastname>
</name>
Another example is the command dasel put string -p xml -f example.xml .name.firstname Tom on the same example file, generated the following file:
<name>
<firstname>Tom</firstname>
<lastname>Doe</lastname>
</name>
Instead of:
.expectedOutput
<?xml version="1.0" encoding="UTF-8"?>
<!-- This a commment -->
<name>
<firstname tag="xx">John</firstname>
<lastname>Doe</lastname>
</name>
Expected behavior
I would expect Dasel to preserve all original XML instructions
Screenshots
/
Desktop (please complete the following information):
- OS: Linux
- Version [1.21.2]
Additional context
After looking at Dasel and mxj code base, It appears that Dasel is manipulating a mxj.Map and could instead use the mxj.MapSeq which seems to preserve everything. I am still new to the two projects so I may need some guidance to contribute to this issue. It appears that some work is needed here but I may be missing something else.
Discussion?
While trying to use Dasel as a Go package in a personal project updatecli, I noticed that it drops XML comments, directives, and processes.
Describe the bug
Dasel don't preserve initial XML content.
To Reproduce
The command
dasel -f example.xml -p xml.example.xml
.output
.expectedOutput
Another example is the command
dasel put string -p xml -f example.xml .name.firstname Tomon the same example file, generated the following file:Instead of:
.expectedOutput
Expected behavior
I would expect Dasel to preserve all original XML instructions
Screenshots
/
Desktop (please complete the following information):
Additional context
After looking at Dasel and mxj code base, It appears that Dasel is manipulating a mxj.Map and could instead use the mxj.MapSeq which seems to preserve everything. I am still new to the two projects so I may need some guidance to contribute to this issue. It appears that some work is needed here but I may be missing something else.