LibreCat / Catmandu-XML

Catmandu modules for working with XML data
https://metacpan.org/module/Catmandu::XML
Other
4 stars 3 forks source link

Support options "path" and "keep-root" #1

Closed nichtich closed 10 years ago

nichtich commented 11 years ago
$cat input.xml
<?xml version="1.0"?>
<doc>
  <id>1</id>
  <id>2</id>
  <id>3</id>
</doc>
$ catmandu convert XML --path "/doc/*" --keep-root 1 to JSON < input.xml
{ "id": 1 }
{ "id": 2 }
{ "id": 3 }

Without --keep-root, each <id> would be ignored as root or a record.

nichtich commented 10 years ago

This works. keep-root is enabled by default, so it's not needed.