--- C:\Python25\Lib\xml\etree\ElementTree.py Thu Aug 03 08:25:06 2006 +++ E:\python\openrpg dev\OpenRPG\Development\orpg\external\etree\ElementTree.py Wed Aug 05 21:18:06 2009 @@ -330,6 +330,17 @@ return ElementPath.find(self, path) ## + # Finds the first matching subelement, by tag name or path. + # Does so recursivly + # + # @param path What element to look for. + # @return The first matching element, or None if no element was found. + # @defreturn Element or None + + def iter_find(self, path): + return ElementPath.iter_find(self, path) + + ## # Finds text for the first matching subelement, by tag name or path. # # @param path What element to look for. @@ -344,6 +355,21 @@ return ElementPath.findtext(self, path, default) ## + # Finds text for the first matching subelement, by tag name or path. + # Does so recursivly + # + # @param path What element to look for. + # @param default What to return if the element was not found. + # @return The text content of the first matching element, or the + # default value no element was found. Note that if the element + # has is found, but has no text content, this method returns an + # empty string. + # @defreturn string + + def iter_findtext(self, path, default=None): + return ElementPath.iter_findtext(self, path, default) + + ## # Finds all matching subelements, by tag name or path. # # @param path What element to look for. @@ -614,6 +640,20 @@ return self._root.find(path) ## + # Finds the first toplevel element with given tag. + # Same as getroot().find(path). + # + # @param path What element to look for. + # @return The first matching element, or None if no element was found. + # @defreturn Element or None + + def iter_find(self, path): + assert self._root is not None + if path[:1] == "/": + path = "." + path + return self._root.iter_find(path) + + ## # Finds the element text for the first toplevel element with given # tag. Same as getroot().findtext(path). # @@ -630,6 +670,24 @@ if path[:1] == "/": path = "." + path return self._root.findtext(path, default) + + ## + # Finds the element text for the first toplevel element with given + # tag. Same as getroot().findtext(path). + # + # @param path What toplevel element to look for. + # @param default What to return if the element was not found. + # @return The text content of the first matching element, or the + # default value no element was found. Note that if the element + # has is found, but has no text content, this method returns an + # empty string. + # @defreturn string + + def iter_findtext(self, path, default=None): + assert self._root is not None + if path[:1] == "/": + path = "." + path + return self._root.iter_findtext(path, default) ## # Finds all toplevel elements with the given tag.