[Python-Dev] memory related issues in Python - bug??

Mallick, Pinki pinki_mallick at mentorg.com
Tue Sep 9 12:25:18 EDT 2003


I have a very big XML file that I am trying to parse using xml.dom and xml.dom.minidom. This file has around 100 nodes. Each of these nodes(say 'child_X') have a number of child nodes and each of these child nodes in turn has a text node as its child. So when I try to retrieve all the data from each 'child_X' node, I use this code, 

grandChildren = child_X.childNodes()
for grandChildNode in grandChildren:
	equation = equation + str(grandChildNode.firstChild.data)

This works properly for all files. But when I am trying to use it on a very large XML file, one of the node's data is incomplete. eg. if grandChildNode.toxml() returns "<mi>y18</mi>" for this node, then "str(grandChildNode.firstChild.data)" returns only "y" instead of "y18".

This looks like some memory problem. Is there any workaround for this problem.

Thanks for any suggestion or help,
Pinki Mallick

More information about the Python-Dev mailing list