facho/facho.py (FachoXML.attach_extension): se retira

FossilOrigin-Name: 5e1a1e394fe0b3d5387a58dbc6c00cff03903718aeb5ff367d71c777ef9baa45
This commit is contained in:
2020-05-28 15:03:21 +00:00
parent 04174317eb
commit ee30ad276a
3 changed files with 15 additions and 23 deletions

View File

@@ -124,21 +124,17 @@ class FachoXML:
self.extensions = []
def add_extension(self, extension):
self.extensions.append(extension)
def attach_extensions(self):
root_tag = self.builder.get_tag(self.root)
# construir las extensiones o adicionar en caso de indicar
for extension in self.extensions:
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)
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):
nodes = xpath.split('/')
nodes.pop()