se extendie NominaIndividualDeAjuste de NominaIndividual

FossilOrigin-Name: 10b3af439bee9b932e4f5067bec0768af60e514f595e00ecb1bdf7c88c39afc1
This commit is contained in:
bit4bit
2021-11-10 01:08:39 +00:00
parent b60fe675c1
commit bb16b5e968
3 changed files with 69 additions and 28 deletions

View File

@@ -455,5 +455,16 @@ class FachoXML:
def tostring(self, **kw):
return self.builder.tostring(self.root, **kw)
def xpath_from_root(self, xpath):
nsmap = {}
ns = ''
if isinstance(self.nsmap, dict):
nsmap = dict(map(reversed, self.nsmap.items()))
ns = nsmap[etree.QName(self.root).namespace] + ':'
new_xpath = '/' + ns + etree.QName(self.root).localname + '/' + xpath.lstrip('/')
return new_xpath
def __str__(self):
return self.tostring()