def parse_response(self, response): self.parse_info(response) for i in self.info.xpath('response-results/person-info'): self.authorized_people.append(PersonInfo(i)) xmlutils = XmlUtils(self.info) self.more_results = xmlutils.get_bool_by_xpath('more-results')
def parse_xml(self, xml): ''' :param key_xml: lxml.etree.Element representing a single VocabularyCodeSet ''' xmlutils = XmlUtils(xml) self.name = xmlutils.get_string_by_xpath('name') self.family = xmlutils.get_string_by_xpath('family') self.version = xmlutils.get_string_by_xpath('version') for item in xml.xpath('code-item'): self.code_item.append(VocabularyCodeItem(item)) self.is_vocab_truncated = xmlutils.get_bool_by_xpath('is-vocab-truncated') self.language = xmlutils.get_lang()
def parse_xml(self, info_element): xmlutils = XmlUtils(info_element) self.id = xmlutils.get_string_by_xpath('application/id/text()') self.name = self.get_culture_specific_dictionary(info_element, 'name') self.app_auth_required = xmlutils.get_bool_by_xpath('application/app-auth-required/text()') self.restrict_app_users = xmlutils.get_bool_by_xpath('application/restrict-app-users/text()') self.is_published = xmlutils.get_bool_by_xpath('application/is-published/text()') self.action_url = xmlutils.get_string_by_xpath('application/action-url/text()') self.description = self.get_culture_specific_dictionary(info_element, 'description') self.auth_reason = self.get_culture_specific_dictionary(info_element, 'auth-reason') large_logo = info_element.xpath('application/large-logo') if large_logo != []: self.large_logo = ApplicationBinaryContent(large_logo[0]) small_logo = info_element.xpath('application/small-logo') if small_logo != []: self.small_logo = ApplicationBinaryContent(small_logo[0]) online_rules = info_element.xpath('application/person-online-base-auth-xml/auth/rules/rule') if online_rules != []: for rule in online_rules: self.online_base_auth_rules.append(AuthRule(rule)) offline_rules = info_element.xpath('application/person-offline-base-auth-xml/auth/rules/rule') if offline_rules != []: for rule in offline_rules: self.offline_base_auth_rules.append(AuthRule(rule)) if info_element.xpath('application/privacy-statement') != []: self.privacy_statement = Statement(info_element.xpath('application/privacy-statement')[0]) if info_element.xpath('application/terms-of-use') != []: self.terms_of_use = Statement(info_element.xpath('application/terms-of-use')[0]) if info_element.xpath('application/dtc-success-message') != []: self.dtc_success_message = Statement(info_element.xpath('application/dtc-success-message')[0])
def parse_xml(self, meaningful_use_xml): xmlutils = XmlUtils(meaningful_use_xml) self.enabled = xmlutils.get_bool_by_xpath('enabled/text()') for i in meaningful_use_xml.xpath('configuration'): self.configuration[i.get('key')] = i.xpath('text()')[0]