Ezio Melotti ezio.melo...@gmail.com added the comment:
I did some tests, creating an element ('elem') that contains two adjacent text
nodes ('text'). With my latest patch the prettyprint is:
?xml version=1.0 ?
elem
text
text
/elem
Here both the text nodes are printed on a
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 7262f8f276ff by Ezio Melotti in branch '2.7':
#4147: minidom's toprettyxml no longer adds whitespace around a text node when
it is the only child of an element. Initial patch by Dan Kenigsberg.
Ezio Melotti ezio.melo...@gmail.com added the comment:
I committed my patch with a few more tests. This should be fixed now.
Thanks for the report and the patch!
--
resolution: - fixed
stage: commit review - committed/rejected
status: open - closed
R. David Murray rdmur...@bitdance.com added the comment:
Yeah, I just haven't found time to do the revert yet (my first naive attempt
using hg commands failed and I haven't found time to figure it out or do the
reverse-patch method).
--
___
Python
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
assignee: - ezio.melotti
nosy: +benjamin.peterson, georg.brandl
priority: normal - release blocker
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
Changes by Peter Funk p...@users.sourceforge.net:
--
nosy: +pefu
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Python-bugs-list
Ezio Melotti ezio.melo...@gmail.com added the comment:
Here is a new patch based on Dan's last patch.
Correct me if I'm wrong, but it seems to me that it's not possible for a node
to have only text-nodes as children and yet have more than one child; i.e. you
can't have two or more adjacent
Dan Kenigsberg dan...@redhat.com added the comment:
Technically, adjacent Text nodes are not illegal, but preserving this oddity in
pretty-print is impossible. It is perfectly fine to pretty-print only the
simple case of len()==1.
--
___
Python
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
anatoly techtonik techto...@gmail.com added the comment:
I would revert this patch (leaving several test cases though) until a proper
fix is available.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
Dan Kenigsberg dan...@redhat.com added the comment:
Oh dear.
Thanks, Enzio, for pointing out that former patch is wrong. It is also quite
naive, since the whole NATURE of toprettyprint() is to add whitespace to Text
nodes. Tomas Lee's
Dan Kenigsberg dan...@redhat.com added the comment:
btw, http://www.w3.org/TR/xml/#sec-white-space is a bit vague on how should a
parser deal with whitespace, and seems to allow non-preservation of text nodes.
Preserving simple text nodes is allowed, too, and is more polite to
applications
R. David Murray rdmur...@bitdance.com added the comment:
Heh, you happened to post your patch at a time when I wanted something to do as
a break from something I didn't want to do...and I *thought* I understood the
problem, after reading the various links. But clearly I didn't. We don't have
Dan Kenigsberg dan...@redhat.com added the comment:
Here's another take on fixing this bug, with an accompanying unit test.
Personally, I'm monkey-patching xml.dom.minidom in order to avoid it, but
please consider fixing it properly upstream.
--
Added file:
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 086ca132e161 by R David Murray in branch '3.2':
#4147: minidom's toprettyxml no longer adds whitespace to text nodes.
http://hg.python.org/cpython/rev/086ca132e161
New changeset fa0b1e50270f by R David Murray in
Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset 406c5b69cb1b by R David Murray in branch '2.7':
#4147: minidom's toprettyxml no longer adds whitespace to text nodes.
http://hg.python.org/cpython/rev/406c5b69cb1b
--
___
R. David Murray rdmur...@bitdance.com added the comment:
This looks correct to me, and it tested out fine on the test suite (and the
provided test failed without the provided fix), so I committed it.
I have a small concern that the change in output might be a bit radical for a
bug fix
Ezio Melotti ezio.melo...@gmail.com added the comment:
The patch seems wrong to me:
d = minidom.parseString('foobarAAA/barBBBbarCCC/bar/foo')
print(d.toprettyxml())
?xml version=1.0 ?
foo
barAAA/bar
BBB barCCC/bar
/foo
Even if the newlines are gone, the indentation
Changes by anatoly techtonik techto...@gmail.com:
--
nosy: +techtonik
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Python-bugs-list
anatoly techtonik techto...@gmail.com added the comment:
This one is bug.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Changes by Tod Olson t...@uchicago.edu:
--
nosy: +tod
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Python-bugs-list mailing list
Mark Lawrence breamore...@yahoo.co.uk added the comment:
@Thomas: could you provide a unit test to go with your patch.
--
nosy: +BreamoreBoy
stage: - unit test needed
versions: +Python 3.2 -Python 2.7
___
Python tracker rep...@bugs.python.org
Changes by Dan Kenigsberg dan...@redhat.com:
--
nosy: +danken
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Python-bugs-list mailing
Michel Samia m.sa...@seznam.cz added the comment:
Could you please apply that patch? People are starting to use non-standard
libraries to process xml files because of this issue
for example this man is using lxml or pyxml:
Jim Garrison jgarri...@troux.com added the comment:
To clarify:
... it should never alter the content of (i.e. insert whitespace into)
existing text elements that contain non-whitespace characters.
--
___
Python tracker rep...@bugs.python.org
Jim Garrison jgarri...@troux.com added the comment:
Also needed here. While pretty-printing should be able to insert
non-significant whitespace BETWEEN xml elements, it should never alter
the content of (i.e. insert whitespace into) existing text elements.
--
nosy: +jgarrison
New submission from Thomas Lee [EMAIL PROTECTED]:
For XML elements containing only text data, it would be nice if
toprettyxml could omit the whitespace it normally injects before after
the text, e.g.
person
first-name
Bob
/first-name
/person
Becomes:
person
27 matches
Mail list logo