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
toxml generates output that is not well formed #45731
Comments
The attached script yields a non-well-formed xml document. |
That's not a bug in Python, but in your script. You should not pass such |
Either it is a bug in the DOM implementation, which should reject cheers, |
It's not a bug in the DOM implementation, as createCommment does not It's not a bug in toxml, which should always serialize the DOM tree if As for a bug in the documentation: can you propose a change to the |
Hi Martin, You write: Right! In this case it is *not* possible. The generated serialization is Having just consulted the DOM technical reports, I see that Having said that, I still think that toxml should throw an exception. In I can propose a doco change, but I think such would only be a partial Note that comments containing the string C{-->} may make the document cheers, |
I'm not willing to change minidom unless there is precedence of how to |
Hi Martin, toxml() is not part of the DOM, so it could be changed to throw an However, I suggest doing nothing, for the moment - I've posted to the cheers, |
The W3 guys had some information that helps. The DOM3 Core specification contains the following No lexical check is done on the content of a comment and it is This suggest that toxml is does not comply with DOM3 at any rate. cheers, |
Looks like bad design on W3 part: postponing an error happening, though |
Would anybody want to provide a patch, then? |
FWIW, the DOM guys considered mandating a check in createComment, but Here are links to my query about the issue: |
Well, it seems that allows createComment() in minidom to raise something |
It may the intention that these functions may raise exceptions in other Adding an exception there may break existing applications, which already |
I think the specification is reasonably clear: createComment may not The problem of compatibility is, as always, a nasty one: whether or not In this case, I think modifying toxml (and the other serializing If the library is changed to throw an exception, at least it will alert I would estimate the expected number of programs to be broken by such a This is certainly not the first time in the history of software cheers, |
The standard procedure for an incompatible change would be to add such a |
I think unexpected exception in toxml() is not worse than producing |
I wanted to start contributing to python for quite a while, so here's my very So, whatever is the final decision on this, here's a patch. CDATASection.writexml() already raises ValueError when finding invalid data, note: I can't add the "patch" keyword myself? |
On Feb 13, 2008 6:27 AM, Virgil Dupras <report@bugs.python.org> wrote:
That looks fine to me. |
Martin: What do you think of this patch? |
On Thu, Mar 20, 2008 at 8:26 AM, Sean Reifschneider
Looks fine. |
Thanks for the patch. Committed as r63563. Because of the new exception, I won't backport the change to 2.5. |
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: