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

Support XML as input format #31

Closed Blacksmoke16 closed 4 years ago

Blacksmoke16 commented 5 years ago

Let's support normal XML before starting on #7. This will lay the groundwork for the logic required to parse the XML. Altering the output JSON should then be easier.

Blacksmoke16 commented 5 years ago

Hey @nichtich. If you had an XML document like:

<root>
  <one>  Some Data</one>
  <two>A bunch of data
  </two>
</root>

Would you expect the output to be:

{
  "root": {
    "one": "Some Data",
    "two": "A bunch of data"
  }
}

Or

{
  "root": {
    "one": "  Some Data",
    "two": "A bunch of data\n  "
  }
}

I.e. should the extra whitespace in the elements be preserved significant or just be stripped out?

nichtich commented 5 years ago

Following XML practice in this case (in text only elements) the whitespace is significant, so the second variant