removed queriesfile.py, implemented XMLObject approach (still shell.py and udf.py TODO)

This commit is contained in:
Miroslav Stampar
2010-10-21 13:13:12 +00:00
parent be443c6947
commit bc79eec702
16 changed files with 169 additions and 401 deletions

View File

@@ -142,6 +142,7 @@ class XMLFile:
fobj = kw.get("file", None)
raw = kw.get("raw", None)
root = kw.get("root", None)
textfilter = kw.get("textfilter", None)
if path:
self.path = path
@@ -176,6 +177,11 @@ class XMLFile:
raise IncorrectRootTag("Gave root='%s', input has root='%s'" % (
root, rootnode.nodeName))
if textfilter:
self.textfilter = textfilter
else:
self.textfilter = lambda x: x
# need this for recursion in XMLNode
self._childrenByName = {}
self._children = []
@@ -278,7 +284,7 @@ class XMLNode:
self._value = None
if isinstance(node, xml.dom.minidom.Text):
self._type = "text"
self._value = node.nodeValue
self._value = self._root.textfilter(node.nodeValue)
elif isinstance(node, xml.dom.minidom.Element):
self._type = "node"
elif isinstance(node, xml.dom.minidom.Comment):