[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Roundup Robot added the comment: New changeset 13c1c5e3d2ee by R David Murray in branch '3.4': #12220: improve minidom error when URI contains spaces. http://hg.python.org/cpython/rev/13c1c5e3d2ee New changeset 3e67d923a0df by R David Murray in branch 'default': Merge: #12220: improve minidom error when URI contains spaces. http://hg.python.org/cpython/rev/3e67d923a0df -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
R. David Murray added the comment: Thanks, amathew and Marek. -- resolution: - fixed stage: needs patch - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Marek Stepniowski added the comment: I agree that Unsupported syntax is a more accurate message. Changed in the newest patch. -- Added file: http://bugs.python.org/file34866/minidom_space_char_in_namespace_unsupported.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Marek Stepniowski added the comment: Added test to amathew's patch. -- nosy: +mstepniowski Added file: http://bugs.python.org/file34819/minidom_space_char_in_namespace_with_test.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
R. David Murray added the comment: Thanks. Could you also change 'Invalid syntax' to 'Unsupported syntax', per the last bit of the discussion between Terry and I? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
R. David Murray added the comment: Thanks for the patch. It would be nice to have a test before we commit this. The tests should use assertRaisesRegex to look for something specific to this error...probably the word 'syntax'...in the error text. On the other hand, if the spaces are technically legal, is calling it a syntax error appropriate? Perhaps the message should instead say something like spaces in URIs is not supported? -- nosy: +r.david.murray versions: +Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Terry J. Reedy added the comment: 'unsupported syntax' would be more accurate, but I agree that saying what it is that is unsupported is even better. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
amathew added the comment: I added a more descriptive error message for invalid namespaces. I agree that it would be great to eventually move to DOMException's. -- keywords: +patch nosy: +amathew Added file: http://bugs.python.org/file29812/minidom_space_char_in_namespace.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Terry J. Reedy tjre...@udel.edu added the comment: SyntaxErrors refer to Python syntax errors; they are raised during parsing of *Python* code. An error in the value given to a Python sensibly raises a ValueError unless a module does something more specific. From the xml.dom doc DOM Level 2 recommendation defines a single exception, DOMException One subclass is exception xml.dom.SyntaxErr -- Raised when an invalid or illegal string is specified. which would be appropriate here. However, The xml.dom.minidom module is essentially a DOM 1.0-compatible DOM with some DOM 2 features (primarily namespace features). In particular, DOMException is currently not supported in xml.dom.minidom. Instead, xml.dom.minidom uses standard Python exceptions such as TypeError and AttributeError. or ValueError. An improved error report could go into 2.7/3.2. A change in minidom spec to use DOMException would be a feature request for 3.3 or later (and a bigger project -- code welcome). For the moment, I am assuming that you are requesting the former. A Python exception is not a crash. A crash is a Segmentation Fault (*nix) or 'Your program stopped unexpectedly' (Windows) -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
New submission from Herm Fischer fisc...@markv.com: Minidom raises an exception if there's a space anywhere in the URI of an xmlns, but it is legal (but terrible practice) to have spaces in URIs. I think this should work or politely raise a syntax error. E.g., this fails: xmlns:abc=http:abc.com/de f g/hi/j k. The attachment xml file from an end user has this xmlns: xmlns:verrels= http://xbrl.org/2010/versioning-relationship-sets; which causes minidom to raise a ValueError exception, instead of a sensible syntax error message. The relevant python code is expabuilder.py, method _parse_ns_name, which does not have an elif for len(parts) != 2 (to raise a syntax error which identifies the bad construct). -- components: XML files: test.xml messages: 137329 nosy: hfischer priority: normal severity: normal status: open title: minidom xmlns not handling spaces in xmlns attribute value field type: crash versions: Python 3.2 Added file: http://bugs.python.org/file22203/test.xml ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12220] minidom xmlns not handling spaces in xmlns attribute value field
Changes by Ned Deily n...@acm.org: -- stage: - needs patch type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12220 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com