def _get_attributes_list(self, xpath, xml=None): """Return a list of text attributes for a given xpath or empty list.""" if xml is None: xml = self.pom_data attrs = xml.findall(xpath) attrs = [attr.text for attr in attrs] return [attr.strip() for attr in attrs if attr and attr.strip()]
def _get_attribute(self, xpath, xml=None): """Return a single value text attribute for a given xpath or None.""" if xml is None: xml = self.pom_data attr = xml.findtext(xpath) val = attr and attr.strip() or None if TRACE: if 'artifactId' in xpath: logger.debug('MavenPom._get_attribute: xpath: {}'.format(xpath)) logger.debug('MavenPom._get_attribute: xml: {}'.format(xml)) return val