facho/facho.py (FachoXML): se simplifica adicion de extension

FossilOrigin-Name: d939f6486757338766762589965955cd9a9a0a84aaad4c37a848f544d8119ab2
This commit is contained in:
2020-06-15 20:16:49 +00:00
parent 7ebf2a2fab
commit 9b358f690c
2 changed files with 4 additions and 14 deletions

View File

@@ -131,16 +131,8 @@ class FachoXML:
self.builder.append(elem, new_elem)
def add_extension(self, extension):
root_tag = self.builder.get_tag(self.root)
extension.build(self)
# construir las extensiones o adicionar en caso de indicar
xpath, elements = extension.build(self)
if isinstance(elements, str):
elem = self.set_element('/'+ root_tag + xpath, elements)
else:
for new_element in elements:
elem = self.find_or_create_element('/' + root_tag + xpath)
self.builder.append(elem, new_element)
def fragment(self, xpath, append=False, append_not_exists=False):
nodes = xpath.split('/')