Blacksmoke16 / oq

A performant, and portable jq wrapper to facilitate the consumption and output of formats other than JSON; using jq filters to transform the data.
https://blacksmoke16.github.io/oq/
MIT License
190 stars 15 forks source link

Document element XML element handling #8

Closed nichtich closed 5 years ago

nichtich commented 5 years ago
echo '{ "e": [ null, {}, "" ] }' | oq -o xml .
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <e></e>
  <e/>
  <e></e>
</root>

I'd expect

<root>
  <e/>
  <e/>
  <e></e>
</root>

but anyway it should be documented. In theory it is enough to never emit <e></e> but in practice it can be useful to force a closing tag (e.g. when emitting a HTML <script> tag).

This also applies to XML reading:

echo "<root><e/><e></e></root>" | oq -i xml .
{ "e": [ null, "" ] }