[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-25 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: There are several modules that expose some of their uses through command line like json.tool, zipfile, tarfile, gzip, webbrowser etc. The initial proposal was to expose the newly added indent function over the command line to provide the same

[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-25 Thread Stefan Behnel
Stefan Behnel added the comment: I agree that formatting is not a use case by itself. I like the idea of XPath grepping, though, especially *without* pretty printing, i.e. one result per line. I admit that there is no strong reason for adding such a command line tool to the stdlib, though.

[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think this should be done: * Guido didn't want Python to grow into a collection of command-line tools * Browsers like Chrome already provide XML viewers * If you pretty print JSON, you don't change its meaning, but for XML, it adds "text" and

[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-25 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks Stefan for the link. XPath support sounds cool to me given that there is already support in stdlib. It could help with filtering using xml.tool itself instead of passing the output to another command to filter. My initial approach was to

[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Stefan Behnel
Stefan Behnel added the comment: Sounds like a good idea to add something like this. Have a look here for some more ideas: https://github.com/lxml/lxml/blob/master/tools/xpathgrep.py ElementTree should be able to provide most of these features as well these days. -- stage: -> needs

[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Karthikeyan Singaravelan
New submission from Karthikeyan Singaravelan : Now that XML has pretty print option with issue14465 would it be handy to add a command line tool pretty printer similar to json.tool? This can be written as one-liner similar to json pretty printing but I think it's a good option and having a