Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty print XML #114

Merged
merged 1 commit into from Jun 2, 2013
Merged

Pretty print XML #114

merged 1 commit into from Jun 2, 2013

Conversation

jargonjustin
Copy link
Contributor

Adds an XML processor to pretty print XML response types.

It looks like there was some previous discussion about this in #34. While this change uses the new plugable processor API, it doesn't address:

However, the method used here inserts a lot of blank lines. A bit less agressive formatting is needed.

A little research on pretty printing XML with Python revealed a few options:

  1. Use xml.dom.minidom which apparently does a mediocre job in many cases
  2. Use PyXML or lxml, either of which would require adding a dependency
  3. Write my own pretty printer, which entails a decent amount of complexity.

I've opted to go with the first option above as a starting point. In my testing, it has handled machine-generated XML with no extraneous whitespace well. Please let me know if another option would be more appropriate.

@jkbrzt
Copy link
Member

jkbrzt commented Dec 20, 2012

Thanks, @jargonjustin. This is a good starting point.

@jkbrzt jkbrzt merged commit 2e57c08 into httpie:master Jun 2, 2013
@jkbrzt
Copy link
Member

jkbrzt commented Jun 2, 2013

I've just added some unicode handling and it seems to work very well. Thanks and sorry for the long wait!

63b61b...172df1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants