se adiciona FachoXml.get_element_attribute para obtener atributo de xpath
FossilOrigin-Name: b3be980dca00b8bd117c4a7e176b8d3a9bac804a1200ad4b7cc39e0f4ab0be15
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user