From 8c4c85b9333c69d14cec9099eecbb4cc2dac2153 Mon Sep 17 00:00:00 2001 From: aurium Date: Wed, 26 Aug 2009 15:32:53 +0000 Subject: [PATCH] adding getElementById() to inkex --- share/extensions/inkex.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 2ae5d6c21..665575c6b 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -166,6 +166,14 @@ class Effect: for node in self.document.xpath(path, namespaces=NSS): self.selected[i] = node + def getElementById(self, id): + path = '//*[@id="%s"]' % id + el_list = self.document.xpath(path, namespaces=NSS) + if el_list: + return el_list[0] + else: + return None + def getdocids(self): docIdNodes = self.document.xpath('//@id', namespaces=NSS) for m in docIdNodes: -- 2.30.2