summaryrefslogtreecommitdiff
path: root/python/tests/xpath.py
blob: fdbd83959446302d7b74067a634fb38da59681ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python -u
#
# this test exercise the XPath basic engine, parser, etc, and
# allows to detect memory leaks
#
import libxml2

doc = libxml2.parseFile("tst.xml")
print doc
i = 1000
while i > 0:
    doc = libxml2.parseFile("tst.xml")
    ctxt = doc.xpathNewContext()
    res = ctxt.xpathEval("//*")
    doc.freeDoc()
    i = i -1
doc = libxml2.parseFile("tst.xml")
ctxt = doc.xpathNewContext()
res = ctxt.xpathEval("//*")
print res
doc.freeDoc()