yq
yq copied to clipboard
Outputting parsed xml loses comment location
Describe the bug When parsing an xml document and outputting it back into xml, if a comment exists , it will be placed at the end of the last line , rather than in the original location.
Version of yq: v4.40.3 Operating system: windows 11 Installed via: download exe file
Input xml test.xml
<?xml version="1.0" encoding="UTF-8"?>
<cat>
<!-- says -->
<says>meow</says>
<!-- legs -->
<legs>abc</legs>
<!-- cute -->
<cute>true</cute>
<cute name="abc">123</cute>
<cute name="1">true</cute>
</cat>
Command
yq -i ".cat.legs=123" test.xml -p xml -o xml
output xml test.xml
<?xml version="1.0" encoding="UTF-8"?>
<cat><!-- says -->
<says>meow</says><!-- legs -->
<legs>123</legs><!-- cute -->
<cute>true</cute>
<cute name="abc">123</cute>
<cute name="1">true</cute>
</cat>
likeness #1475