471,351 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

AW: Buffer restriction in dom.minidom?

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: py*******************************************@pyth on.org
[mailto:py***************************************** **@python.org] Im Auftrag
von Fredrik Lundh
Gesendet: Freitag, 28. November 2003 12:14
An: py*********@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/li...t-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/li...e-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
Jul 18 '05 #1
0 1351

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by xtian | last post: by
reply views Thread by Oliver Walczak | last post: by
3 posts views Thread by Sunil Movva | last post: by
5 posts views Thread by Skip Montanaro | last post: by
5 posts views Thread by Mike McGavin | last post: by
4 posts views Thread by webdev | last post: by
reply views Thread by Gary | last post: by
3 posts views Thread by aine_canby | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.