len(text), subpath_encoded)
self._list(element, subpath)
+ def get_tag_node(self, node, i):
+ n = 0
+ for element in self.getchildren(node):
+ if self.istag(element):
+ n += 1
+ if n == i:
+ return element
+ xml_error('There are less than %d nodes' % i)
+
def attrs2text(self, node):
attr_accumulator = []
for name, value in self.getattrs(node):
def has_ns(self, node):
return False
- def get_child_node(self, node, i):
- n = 0
- for element in self.getchildren(node):
- if self.istag(element):
- n += 1
- if n == i:
- return element
- xml_error('There are less than %d nodes' % i)
-
class MiniDOMXmlVfs(XmlVfs):
def parse(self):
def parse(self):
self.document = etree.parse(sys.argv[2])
+ def getroot(self):
+ return [self.document.getroot()]
+
+ def getlocalname(self, name):
+ return etree.QName(name).localname
+
def has_ns(self, node):
return bool(node.nsmap)
ns_accumulator.append("%s=%s" % (name, value))
return '\n'.join(ns_accumulator)
- def getroot(self):
- return [self.document.getroot()]
-
- def getlocalname(self, name):
- return etree.QName(name).localname
-
def build_xmlvfs():
if force_implementation is None:
for path_comp in xml_filename.split('/'):
if ' ' in path_comp:
i = int(path_comp.split(' ', 1)[0])
- node = xmlvfs.get_child_node(node, i)
+ node = xmlvfs.get_tag_node(node, i)
elif path_comp in ('attributes', 'namespaces', 'text'):
break
else: