def process_xml(self, xml):
        '''
        Parse tool configuration data out of the Common Cartridge LTI link XML.
        '''
        root = objectify.fromstring(xml, parser = etree.XMLParser())
        # Parse all children of the root node
        for child in root.getchildren():
            if 'title' in child.tag:
                self.title = child.text
            if 'description' in child.tag:
                self.description = child.text
            if 'secure_launch_url' in child.tag:
                self.secure_launch_url = child.text
            elif 'launch_url' in child.tag:
                self.launch_url = child.text
            if 'icon' in child.tag:
                self.icon = child.text
            if 'secure_icon' in child.tag:
                self.secure_icon = child.text
            if 'cartridge_bundle' in child.tag:
                self.cartridge_bundle = child.attrib['identifierref']
            if 'catridge_icon' in child.tag:
                self.cartridge_icon = child.atrib['identifierref']

            if 'vendor' in child.tag:
                # Parse vendor tag
                for v_child in child.getchildren():
                    if 'code' in v_child.tag:
                        self.vendor_code = v_child.text
                    if 'description' in v_child.tag:
                        self.vendor_description = v_child.text
                    if 'name' in v_child.tag:
                        self.vendor_name = v_child.text
                    if 'url' in v_child.tag:
                        self.vendor_url = v_child.text
                    if 'contact' in v_child.tag:
                        # Parse contact tag for email and name
                        for c_child in v_child:
                            if 'name' in c_child.tag:
                                self.vendor_contact_name = c_child.text
                            if 'email' in c_child.tag:
                                self.vendor_contact_email = c_child.text

            if 'custom' in child.tag:
                # Parse custom tags
                for custom_child in child.getchildren():
                    self.custom_params[custom_child.attrib['name']] =\
                            custom_child.text

            if 'extensions' in child.tag:
                platform = child.attrib['platform']
                properties = {}

                # Parse extension tags
                for ext_child in child.getchildren():
                    if 'property' in ext_child.tag:
                        properties[ext_child.attrib['name']] = ext_child.text
                    elif 'options' in ext_child.tag:
                        opt_name = ext_child.attrib['name']
                        options = {}
                        for option_child in ext_child.getchildren():
                            options[option_child.attrib['name']] =\
                                    option_child.text
                        properties[opt_name] = options

                self.set_ext_params(platform, properties)
def process_xml ( self , xml ) : root = objectify . fromstring ( xml , parser = etree . XMLParser ( ) ) for child in root . getchildren ( ) : if 'title' in child . tag : self . title = child . text if 'description' in child . tag : self . description = child . text if 'secure_launch_url' in child . tag : self . secure_launch_url = child . text elif 'launch_url' in child . tag : self . launch_url = child . text if 'icon' in child . tag : self . icon = child . text if 'secure_icon' in child . tag : self . secure_icon = child . text if 'cartridge_bundle' in child . tag : self . cartridge_bundle = child . attrib [ 'identifierref' ] if 'catridge_icon' in child . tag : self . cartridge_icon = child . atrib [ 'identifierref' ] if 'vendor' in child . tag : for v_child in child . getchildren ( ) : if 'code' in v_child . tag : self . vendor_code = v_child . text if 'description' in v_child . tag : self . vendor_description = v_child . text if 'name' in v_child . tag : self . vendor_name = v_child . text if 'url' in v_child . tag : self . vendor_url = v_child . text if 'contact' in v_child . tag : for c_child in v_child : if 'name' in c_child . tag : self . vendor_contact_name = c_child . text if 'email' in c_child . tag : self . vendor_contact_email = c_child . text if 'custom' in child . tag : for custom_child in child . getchildren ( ) : self . custom_params [ custom_child . attrib [ 'name' ] ] = custom_child . text if 'extensions' in child . tag : platform = child . attrib [ 'platform' ] properties = { } for ext_child in child . getchildren ( ) : if 'property' in ext_child . tag : properties [ ext_child . attrib [ 'name' ] ] = ext_child . text elif 'options' in ext_child . tag : opt_name = ext_child . attrib [ 'name' ] options = { } for option_child in ext_child . getchildren ( ) : options [ option_child . attrib [ 'name' ] ] = option_child . text properties [ opt_name ] = options self . set_ext_params ( platform , properties )
Parse tool configuration data out of the Common Cartridge LTI link XML.