[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-10 Thread Francesco Sechi
Francesco Sechi francesco.se...@iet.unipi.it added the comment: I think that the problem is: the xmldoc1 has the newline or not? If it hasn't your patch works only in the particular case you pass a toxml return value to 'parsestring'. If I pass an XML string with newlines it doesn't work. So

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-10 Thread Francesco Sechi
Francesco Sechi francesco.se...@iet.unipi.it added the comment: I try to explain better what is my opinion: - If you add the attribute by using setAttribute the newlines are kept and the toxml works well - If you add the attribute by using the parsestring, passing it an XML string the newlines

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-10 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: Francesco, I think you are missing the point. :-) The problem has two sides. If I create an XML document using the DOM (not by parsing it from a string!), then I can put newline characters into attribute value. This is allowed and conforms

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-08 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: Hmm... I thought toxml() is the part that needs to be fixed, not the parsing/reading. I mentioned the reading only to outline the data loss that occurs eventually. My point is: The toxml() (i.e. _write_data) *actually writes* the newline to

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-08 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: Attaching a patch that fixes the problem. -- keywords: +patch Added file: http://bugs.python.org/file13919/minidom.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-08 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: Attaching a test file that outlines the problem. Output on my system (Windows / Python 3.0) is: Without the patch: C:\Python30python.exe c:\minidom_test.py False 1 --multiline value 2 --multiline value With the patch: C:\Python30python.exe

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-08 Thread Tomalak
Changes by Tomalak m8r-t1tu...@mailinator.com: Removed file: http://bugs.python.org/file13920/toxml_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752 ___

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-08 Thread Tomalak
Changes by Tomalak m8r-t1tu...@mailinator.com: Added file: http://bugs.python.org/file13921/minidom_test.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752 ___

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-06 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: @Francesco Sechi: Would it not just require a minimal change to the _write_data() method? Something along the lines of (sorry, no Python expert, maybe I am way off): def _write_data(writer, data, is_attrib=False): Writes datachars to

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-06 Thread Tomalak
Tomalak m8r-t1tu...@mailinator.com added the comment: Of course it should be: def _write_data(writer, data, is_attrib=False): Writes datachars to writer. data = data.replace(, amp;).replace(, lt;) data = data.replace(\, quot;).replace(, gt;) if is_attrib: data =

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-06 Thread Francesco Sechi
Francesco Sechi francesco.se...@iet.unipi.it added the comment: Don't worry, I'm a newer too. No, your solution does not work, because the method you refer (_write_data) is called by the toxml() function, but the newline is replaced with a whitespace by the parsestring() function. The

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-04 Thread Francesco Sechi
Francesco Sechi francesco.se...@iet.unipi.it added the comment: Ok, I've tried to solve this problem, but I think that the keyword 'easy' is not suitable for this kind of task, because it is necessary to modify the expat module that is very complex. --

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-02 Thread Francesco Sechi
Changes by Francesco Sechi francesco.se...@iet.unipi.it: -- nosy: +sechi_francesco ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752 ___ ___

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-05-02 Thread Francesco Sechi
Changes by Francesco Sechi francesco.se...@iet.unipi.it: Added file: http://bugs.python.org/file13837/test_toxml.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752 ___

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-04-21 Thread Daniel Diniz
Changes by Daniel Diniz aja...@gmail.com: -- keywords: +easy stage: - test needed versions: -Python 2.4, Python 2.5, Python 2.7, Python 3.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-04-14 Thread Tomalak
New submission from Tomalak m8r-t1tu...@mailinator.com: Current behavior upon toxml() is: foo attribute=multiline value / Upon reading the document again, the new line is normalized and collapsed into a space (according to the XML spec, section 3.3.3), which means that it is lost. Better

[issue5752] xml.dom.minidom does not handle newline characters in attribute values

2009-04-14 Thread Tomalak
Changes by Tomalak m8r-t1tu...@mailinator.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5752 ___ ___ Python-bugs-list