Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I recently had to consume an xml service; it would've been great to have something like Jq for xml. For some reason I wasn't really interested in xml -> json conversion as a first step. I also found a bunch of xml cli tools, but they are older, had to learn things like XQuery (which actually few tools today seem to support).


I have found `xmlstarlet` to be really useful for working with XML. You can achieve a lot with some basic XPath expressions. No need to learn XSLT. (I should actually update my book Data Science at the Command Line to include this tool.)


For me, that "some reason" is normally the overlap between children and parameters:

    <foo bar="123" baz="456"><qux>789</qux></foo>
There's not a great round-trip mapping of that to JSON, like:

    {"foo": {"bar": 123, "baz": "456", "children": {"qux": 789}}}
(which also illustrates why I dislike XML being untyped unless you have a schema file to interpret it with).


Well there's XProc. But as with everything XML - you shouldn't really edit it by hand without proper editor support at the very least (preferably DTD/XML Schema aware).


I understand XML has namespaces, but I'm not sure what "edit by hand" means in this context. The tools I found previously were xqilla and xmlstarlet, but they seem pretty old and just not as convienient as Jq.

I still think there is space for an XML cli tool that is more convenient for the majority of common tasks working with XML, at simply treating the data as a hierarchical structure, without requiring an interface that is full fully-qualified/needs XSLT/etc..




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: