xpathEval fails for large files

Kanchana kanchana.senevirathna at gmail.com
Tue Jul 22 05:00:41 EDT 2008


Hi,

I tried to extract some data with xpathEval. Path contain more than
100,000 elements.

doc = libxml2.parseFile("test.xml")
ctxt = doc.xpathNewContext()
result = ctxt.xpathEval('//src_ref/@editions')
doc.freeDoc()
ctxt.xpathFreeContext()

this will stuck in following line and will result in high usage of
CPU.
result = ctxt.xpathEval('//src_ref/@editions')

Any suggestions to resolve this.

Is there any better alternative to handle large documents?

Kanch



More information about the Python-list mailing list