-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
xml.dom.minidom wrong indentation writing for CDATA section #80588
Comments
If we are writing xml with CDATA section and leaving non-empty indentation and new-line parameters, a parent node of the section will contain useless indentation, that will be parsed as a text. Example:
If we try to parse this output doc, we won’t get CDATA value correctly. Following code returns a string that contains only indentation characters:
Returns a string with CDATA value and indentation characters:
But we have a workaround:
It will be parsed correctly:
But I think it will be better if we fix the writing function, which would set this as default behavior. |
Yes, this case is incorrect. Pretty printing should not change character content inside of a simple tag. The PR looks good to me. |
Should we backport this change? I am not sure. |
I don't think this should be backported. Pretty-printing is not a production relevant feature, more of a "debugging, diffing and help users see what they get" kind of feature. It's good to have it fixed for the future, but we shouldn't bother users with it during a point release. |
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: