AW: Buffer restriction in dom.minidom?
Oliver Walczak
oliver.walczak at momatec.de
Fri Nov 28 06:21:10 EST 2003
Can i call normalize to the dom root node so that all adjacent child text
nodes attached to one of the element nodes are joined?
-----Ursprüngliche Nachricht-----
Von: python-list-bounces+oliver.walczak=momatec.de at python.org
[mailto:python-list-bounces+oliver.walczak=momatec.de at python.org] Im Auftrag
von Fredrik Lundh
Gesendet: Freitag, 28. November 2003 12:14
An: python-list at python.org
Betreff: Re: Buffer restriction in dom.minidom?
Oliver Walczak wrote:
> In one of my projects i use dom.minidom as XML parser. I recently had a
> problem when the value of a text node as a child of an element node was
> larger than 1024 characters. It created 2 or more child nodes out of it so
i
> had to concatenate both items again manually. On another machine it only
> created one child node out of the text node as i further expected although
> both are running Python 2.2.3 on WinXP.
> Does anyone know whats going on there?
the parser may chose to split CDATA over multiple Text nodes:
http://www.python.org/doc/current/lib/dom-text-objects.html
"A single CDATA section may be represented by more than one
node in the document tree."
if this matters to your program, use "normalize" before accessing the
contents:
http://www.python.org/doc/current/lib/dom-node-objects.html
(using normalize is a good idea even if you're using a normalizing parser;
it prevents nasty surprises the day you or someone else wants to use
your code on a DOM tree created by some other part of your program...)
</F>
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list