summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: