On 10/12/05, Garito <[EMAIL PROTECTED]> wrote:
> Alan Milligan escribió:
> >You do realise that pyexpat has a limitation of 8192 bytes between xml
> >tags - if your parse string is longer than this, it will fail. You can
> >recompile your expat parser to accept larger sizes, but this drastically
> >affects performance.
Ok, I don't know just where this assertion comes from; I can't
reproduce this at all with the pyexpat in Python 2.3.5 or 2.4.2. I've
attached a short test program that verifies pyexpat's behavior.
-Fred
--
Fred L. Drake, Jr. <fdrake at gmail.com>
"Society attacks early, when the individual is helpless." --B.F. Skinner
"""Test asserted size limitation of text between tags for pyexpat.
"""
__docformat__ = "reStructuredText"
from xml.parsers import expat
COUNT = 8192 * 10
SAMPLE_TEXT = "<doc>abc" + ("-" * COUNT) + "xyz</doc>"
buffer = []
def characters(text):
buffer.append(text)
p = expat.ParserCreate()
p.CharacterDataHandler = characters
p.Parse(SAMPLE_TEXT, True)
text = u"".join(buffer)
assert len(text) == (COUNT + 6)
assert text.startswith(u"abc---")
assert text.endswith(u"---xyz")
# This is expected to print "abc--- ---xyz"
print text[:6], text[-6:]
_______________________________________________
Zope maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )