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
minidom pretty xml output improvement #45325
Comments
This patch provides a fix to the minidom pretty xml output. In the initial version when outputing textnodes additional line breaks were added at the beginning and the end of the textnode block thus output false textnode content. If you load and save an xml document with textnodes the size of the textnodes increases every time. To fix this, a simple logic has been added to the textnode output function in order to prevent this behavior. This is my first patch submission so I hope I haven't done anything wrong. I so please let me know I'll be glad to improve it. Cheers and keep up the good work. Teajay |
I think this is a good patch. It gives more useful pretty XML output. There is one bug in the patch in that: the parens around the %s%s should be quotes instead. |
If the patch would have better styling ("if(onetextnode == True):"), correct the test it breaks, and even better, add new ones, I guess it |
Thanks for the feedback. I looked at the issues you mentionned and tried Let me know if there is anything else I need to improve. |
This patch would be very useful to me, so I'm sad to see it's been Is there any way to encourage the maintainer to merge this into the |
@roy: we can try :) Patch updated, tests pass. However, keeping the default output and |
Thanks! :-) On Wed, Feb 11, 2009 at 9:28 PM, Daniel Diniz <report@bugs.python.org>wrote:
|
The patch applies cleanly to the 2.6 branch, and with minimal fuzz to The added testcase seems plainly correct. The first hunk of the diff to Lib/xml/dom/minidom.py is a little messy
The second hunk is somewhat problematic: it changes 'Text.writexml' to I'm not sure about the justification for the third hunk at all (removing |
Removed junk copy of message |
Looking at the comments here msg104801 seems like more work needs to be done on the patch. |
I would prefer to see this improvement as an option, rather than the default, because I believe that 'bpo-4147' satisfies "pretty printing" better. While leaving out whitespace from text-only elements is benefical for compatibility and roundtripping, there are certain situation where it hurts the prettyness of the xml really hard, an example: <root> vs. <root> |
I think this can be closed, since bpo-4147 already improved tpprettyxml(). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: