se adiciona FachoXml.get_element_attribute para obtener atributo de xpath
FossilOrigin-Name: b3be980dca00b8bd117c4a7e176b8d3a9bac804a1200ad4b7cc39e0f4ab0be15
This commit is contained in:
parent
fcd5060485
commit
f975e666ee
@ -2,6 +2,10 @@
|
||||
|
||||
* se extrae documento tecnico de resolucion usando **pdfarranger**
|
||||
|
||||
## CUNE
|
||||
|
||||
ver 8.1.1.1 del archivo **Resolucion 000013 de 11-02-2021.pdf**
|
||||
|
||||
# enlaces
|
||||
|
||||
* https://www.dian.gov.co/impuestos/Paginas/Sistema-de-Factura-Electronica/documento-soporte-de-pago-de-nomina-electronica.aspx
|
||||
|
@ -104,6 +104,9 @@ class LXMLBuilder:
|
||||
def get_text(self, elem):
|
||||
return elem.text
|
||||
|
||||
def get_attribute(self, elem, key):
|
||||
return elem.attrib[key]
|
||||
|
||||
def set_attribute(self, elem, key, value):
|
||||
elem.attrib[key] = value
|
||||
|
||||
@ -276,6 +279,10 @@ class FachoXML:
|
||||
self.builder.set_attribute(elem, k, v)
|
||||
return self
|
||||
|
||||
def get_element_attribute(self, xpath, attribute):
|
||||
elem = self.get_element(xpath)
|
||||
return self.builder.get_attribute(elem, attribute)
|
||||
|
||||
def get_element(self, xpath):
|
||||
xpath = self.fragment_prefix + self._path_xpath_for(xpath)
|
||||
return self.builder.xpath(self.root, xpath)
|
||||
|
@ -204,3 +204,8 @@ def test_facho_xml_set_element_attribute_valid_validation():
|
||||
|
||||
xml.set_element_validator('./Id', lambda text, attrs: attrs['code'] == 'ABC')
|
||||
xml.set_element('./Id', 'mero', code = 'ABC')
|
||||
|
||||
def test_facho_xml_get_element_attribute():
|
||||
xml = facho.FachoXML('root')
|
||||
xml.set_element('./Id', 'mero', code = 'ABC')
|
||||
assert xml.get_element_attribute('/root/Id', 'code') == 'ABC'
|
||||
|
Loading…
Reference in New Issue
Block a user