def fromXml(cls, xdata, filepath=''):
        """
        Generates a new builder from the given xml data and then
        loads its information.
        
        :param      xdata | <xml.etree.ElementTree.Element>
        
        :return     <Builder> || None
        """
        module = None
        pkg_data = xdata.find('package')
        if pkg_data is not None:
            path = pkg_data.find('path').text
            name = pkg_data.find('name').text

            if filepath:
                path = os.path.join(filepath, path)

            path = os.path.abspath(path)
            sys.path.insert(0, path)
            sys.modules.pop(name, None)

            try:
                __import__(name)
                module = sys.modules[name]
            except (ImportError, KeyError):
                return None
        else:
            return None

        # generate the builder
        builder = cls(module)
        builder.loadXml(xdata, filepath=filepath)
        return builder
def fromXml ( cls , xdata , filepath = '' ) : module = None pkg_data = xdata . find ( 'package' ) if pkg_data is not None : path = pkg_data . find ( 'path' ) . text name = pkg_data . find ( 'name' ) . text if filepath : path = os . path . join ( filepath , path ) path = os . path . abspath ( path ) sys . path . insert ( 0 , path ) sys . modules . pop ( name , None ) try : __import__ ( name ) module = sys . modules [ name ] except ( ImportError , KeyError ) : return None else : return None builder = cls ( module ) builder . loadXml ( xdata , filepath = filepath ) return builder
Generates a new builder from the given xml data and then
        loads its information.
        
        :param      xdata | <xml.etree.ElementTree.Element>
        
        :return     <Builder> || None