~hannes-hochreiner/jessyink/effects-2

« back to all changes in this revision

Viewing changes to inkscapeExtensions/jessyInk_isExtUtils.py

  • Committer: Hannes Hochreiner
  • Date: 2008-05-10 02:18:09 UTC
  • mfrom: (8.1.10 effects)
  • Revision ID: hannes@hochreiner.net-20080510021809-t39uge7j5uxgk7ae
Tags: version_0_2
Merging the "effects" branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
                        return node
80
80
        return None
81
81
 
 
82
def getNodeWithId(domDoc, id):
 
83
        return getNodeWithId_sub(domDoc.documentElement, id)
 
84
 
 
85
def getNodeWithId_sub(node, id):
 
86
        if node.nodeType == node.ELEMENT_NODE:
 
87
                if node.getAttribute("id") == id:
 
88
                        return node
 
89
        if node.hasChildNodes():
 
90
                for childNode in node.childNodes:
 
91
                        result = getNodeWithId_sub(childNode, id)
 
92
                        if not result == None:
 
93
                                return result
 
94
        return None
 
95