summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2012-09-16 23:26:55 +0200
committerFlorian Bruhin <git@the-compiler.org>2012-09-16 23:26:55 +0200
commita1aec1ea552d3af5f6b21bfa49184dd15d7082c5 (patch)
tree987ae65a8b82b05a2f78551776d5b2582beb1974
parenta18a935834864b6794f59f0f0d08649baf113645 (diff)
downloadxojgrep-a1aec1ea552d3af5f6b21bfa49184dd15d7082c5.tar.gz
xojgrep-a1aec1ea552d3af5f6b21bfa49184dd15d7082c5.zip
Use xpath arrays instead of python arrays in xojfile
-rw-r--r--xojgrep.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/xojgrep.py b/xojgrep.py
index d2997e3..9fb5163 100644
--- a/xojgrep.py
+++ b/xojgrep.py
@@ -84,9 +84,10 @@ class XOJFile:
def getcontent(self):
content = []
# TODO check if that works with a xournal file without texts
- for (pn, page) in enumerate(self.tree.xpath('/xournal/page'), 1):
+ pagecount = len(self.tree.xpath('/xournal/page'))
+ for pn in range(1, pagecount + 1):
pagecontent = []
- texts = page.xpath('//text')
+ texts = self.tree.xpath('/xournal/page[{}]//text'.format(pn))
for text in texts:
pagecontent.append(text.text)
if pagecontent: