You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xml.parsers.expat make a dictionary which keys are broken if buffer_text is False. #49286
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:
assignee=Noneclosed_at=<Date2009-01-31.03:16:24.927>created_at=<Date2009-01-23.03:52:20.503>labels= ['expert-XML', 'type-bug', 'invalid']
title='xml.parsers.expat make a dictionary which keys are broken if buffer_text is False.'updated_at=<Date2009-01-31.03:16:24.926>user='https://bugs.python.org/tksmashiw'
When I make a dictionary by parsing "legacy-icon-mapping.xml"(which is a
part of
icon-naming-utils[http://tango.freedesktop.org/Tango_Icon_Library]) with
the following script, the three keys of the dictionary are collapsed if
the "buffer_text" attribute is False.
The result of running this script is
======================
The keys which exist if buffer_text=False but don't exist if
buffer_text=True are
rt-descending
ock_text_right
lc
The keys which exist if buffer_text=True but don't exist if
buffer_text=False are
stock_text_right
gnome-mime-application-vnd.stardivision.calc
gtk-sort-descending
======================
I confirmed it in Python-2.5.2 on Fedora 10.
If the xml file is small enough, could you attach it to the issue? Or
provide a download location? I could not find it myself (without
downloading the whole package)
(Note that Python 2.5 only gets security fixes now, so unless this
still fails with 2.6 or later, this issue is likely to be closed)
(Note that Python 2.5 only gets security fixes now, so unless this
still fails with 2.6 or later, this issue is likely to be closed)
I roughly confirmed the same problem on python-3.0 on MS Windows 2 weeks
ago, but need to verify more strictly...
kawai commented on Jan 24, 2009
kawaimannequin
Mannequin
More actions
The sample code has bug. expat is OK.
Method char_data must append the incoming characters because the
character sequence is an buffered input.
def char_data(self, data):
self.data += data
You should reset it by self.data = '' at end_element().
tksmashiw commented on Jan 24, 2009
tksmashiwmannequin
MannequinAuthor
More actions
Hi kawai.
I got correct output by modifying the code like you say, but I still
cannot understand why this happens.
Could you tell me more briefly, or point any documents about it?
I can't find any notes which say don't pass strings but append it for
CharacterDataHandler in official documents.
Does everyone know/understand it already? Only I am so stupid? (;;)
a mistake of my former message, briefly -> in detail
Please read "The ContentHandler.characters() callback is missing data!" http://www.saxproject.org/faq.html
I was just reading above site. it is now very clear for me.
Thanks kawai and I'm sorry to take up your time, gagenellina.
Activity
tksmashiw commentedon Jan 23, 2009
When I make a dictionary by parsing "legacy-icon-mapping.xml"(which is a
part of
icon-naming-utils[http://tango.freedesktop.org/Tango_Icon_Library]) with
the following script, the three keys of the dictionary are collapsed if
the "buffer_text" attribute is False.
=====================
=====================
The result of running this script is
======================
The keys which exist if buffer_text=False but don't exist if
buffer_text=True are
rt-descending
ock_text_right
lc
The keys which exist if buffer_text=True but don't exist if
buffer_text=False are
stock_text_right
gnome-mime-application-vnd.stardivision.calc
gtk-sort-descending
======================
I confirmed it in Python-2.5.2 on Fedora 10.
ggenellina commentedon Jan 24, 2009
If the xml file is small enough, could you attach it to the issue? Or
provide a download location? I could not find it myself (without
downloading the whole package)
(Note that Python 2.5 only gets security fixes now, so unless this
still fails with 2.6 or later, this issue is likely to be closed)
tksmashiw commentedon Jan 24, 2009
Thanks for reply!
kawai commentedon Jan 24, 2009
The sample code has bug. expat is OK.
Method char_data must append the incoming characters because the
character sequence is an buffered input.
def char_data(self, data):
self.data += data
You should reset it by self.data = '' at end_element().
tksmashiw commentedon Jan 24, 2009
Hi kawai.
I got correct output by modifying the code like you say, but I still
cannot understand why this happens.
Could you tell me more briefly, or point any documents about it?
I can't find any notes which say don't pass strings but append it for
CharacterDataHandler in official documents.
Does everyone know/understand it already? Only I am so stupid? (;;)
kawai commentedon Jan 24, 2009
That's the spec of XML SAX interface.
kawai commentedon Jan 24, 2009
Please read "The ContentHandler.characters() callback is missing data!"
http://www.saxproject.org/faq.html
and close this issue :)
tksmashiw commentedon Jan 24, 2009
a mistake of my former message, briefly -> in detail
tksmashiw commentedon Jan 27, 2009
From msg80438
It seems that we should reset it at start_element() like this,
============================
=============================
or unwanted \s, \t, and \n mix in "self.data".
That's all, thanks.
tksmashiw commentedon Jan 31, 2009
Could someone close this?