al insertar elemento se ubica continuo a los primos

FossilOrigin-Name: 3c26c6d8803c30d15f9baa083fc8cfc2ed8993061196f3299162d6a899680735
This commit is contained in:
bit4bit
2021-11-04 01:46:43 +00:00
parent 2b76cf6a10
commit adbd6d0d0e
2 changed files with 23 additions and 2 deletions

View File

@@ -88,6 +88,9 @@ class LXMLBuilder:
def append(self, elem, child):
elem.append(child)
def append_next(self, elem, slibing):
elem.addnext(slibing)
def remove(self, elem):
elem.getparent().remove(elem)
@@ -223,10 +226,18 @@ class FachoXML:
self.builder.append(current_elem, node)
current_elem = node
# se fuerza la adicion como un nuevo elemento
if append:
node = self.builder.build_from_expression(node_paths[-1])
self.builder.append(parent, node)
node_tag = node_paths[-1]
last_slibing = current_elem
for child in parent.getchildren():
if child.tag == node_tag:
last_slibing = child
node = self.builder.build_from_expression(node_tag)
self.builder.append_next(last_slibing, node)
return node
return current_elem