Pretty print XML #114

Merged
merged 1 commit into from Jun 2, 2013

2 participants

@jargonjustin

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
Owner

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

@jkbrzt jkbrzt merged commit 2e57c08 into jkbrzt:master Jun 2, 2013

1 check failed

Details default The Travis build failed
@jkbrzt
Owner

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