(self, element_name, config_xml=None, node=None)
alter an element with the config_xml to current doc's view.  If it
        does not exist, append it. Alternatively, pass in an actual node
alter an element with the config_xml to current doc's view.  If it
        does not exist, append it. Alternatively, pass in an actual node
alter an element with the config_xml to current doc s view . If it does not exist append it . Alternatively pass in an actual node
def alter_xml_element(self, element_name, config_xml=None, node=None):
        '''alter an element with the config_xml to current doc's view.  If it
        does not exist, append it. Alternatively, pass in an actual node
        '''
        if config_xml:
            xml = Xml(string = config_xml)
            new_root_node = xml.get_root_node()
        elif node != None:
            new_root_node = node
        else:
            raise SetupException()
        view_node = self.get_view_node()
        if view_node == None:
            raise SetupException("The view node is not found for [%s]" %self.view)

        target_node = self.get_element_node(element_name)
     
        if target_node is not None:
            #view_node.replaceChild(new_root_node, target_node )
            self.xml.replace_child(view_node, target_node, new_root_node)
        else:
            #view_node.appendChild(new_root_node)
            self.xml.append_child(view_node, new_root_node)
def alter_xml_element ( self , element_name , config_xml = None , node = None ) : if config_xml : xml = Xml ( string = config_xml ) new_root_node = xml . get_root_node ( ) elif node != None : new_root_node = node else : raise SetupException ( ) view_node = self . get_view_node ( ) if view_node == None : raise SetupException ( "The view node is not found for [%s]" % self . view ) target_node = self . get_element_node ( element_name ) if target_node is not None : #view_node.replaceChild(new_root_node, target_node ) self . xml . replace_child ( view_node , target_node , new_root_node ) else : #view_node.appendChild(new_root_node) self . xml . append_child ( view_node , new_root_node )