Make all the xml file for individual components
556645
def _make_xml_files(diffuse_comp_info_dict):
        
        try:
            os.makedirs('srcmdls')
        except OSError:
            pass

        for sourcekey in sorted(diffuse_comp_info_dict.keys()):
            comp_info = diffuse_comp_info_dict[sourcekey]
            if comp_info.components is None:
                SrcmapsDiffuse_SG._handle_component(sourcekey, comp_info)
            else:
                for sub_comp_info in comp_info.components.values():
                    SrcmapsDiffuse_SG._handle_component(sourcekey, sub_comp_info)
1144578
def xml(self, attribs = None,elements = None, skipchildren = False):
        """"""
        if not attribs: attribs = {}
        if self.idref:
            attribs['id'] = self.idref
        return super(AbstractTextMarkup,self).xml(attribs,elements, skipchildren)
379921
def to_xml
      out = ""
      builder = Builder::XmlMarkup.new(:target => out, :indent => 2)
      builder.instruct!
      build_xml(builder)
      out
    end
1072481
def every(colors, output_dir=CACHE_DIR):
    """"""
    colors = flatten_colors(colors)
    template_dir = os.path.join(MODULE_DIR, "templates")
    template_dir_user = os.path.join(CONF_DIR, "templates")
    util.create_dir(template_dir_user)

    join = os.path.join  # Minor optimization.
    for file in [*os.scandir(template_dir),
                 *os.scandir(template_dir_user)]:
        if file.name != ".DS_Store" and not file.name.endswith(".swp"):
            template(colors, file.path, join(output_dir, file.name))

    logging.info("Exported all files.")
    logging.info("Exported all user files.")
1228845
protected function buildXml()
    {
        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
        }

        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_RENAME)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
        }

        if (!isset($_GET["NewFolderName"])) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }

        $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["NewFolderName"]);
        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        if ($_config->forceAscii()) {
            $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFolderName);
        }
        $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();

        if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($newFolderName) || $resourceTypeInfo->checkIsHiddenFolder($newFolderName)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }

        // The root folder cannot be deleted.
        if ($this->_currentFolder->getClientPath() == "/") {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
        }

        $oldFolderPath = $this->_currentFolder->getServerPath();
        $bMoved = false;

        if (!is_dir($oldFolderPath)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
        }

        //let's calculate new folder name
        $newFolderPath = dirname($oldFolderPath).'/'.$newFolderName.'/';

        if (file_exists(rtrim($newFolderPath, '/'))) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
        }

        $bMoved = @rename($oldFolderPath, $newFolderPath);

        if (!$bMoved) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        } else {
            $newThumbsServerPath = dirname($this->_currentFolder->getThumbsServerPath()) . '/' . $newFolderName . '/';
            if (!@rename($this->_currentFolder->getThumbsServerPath(), $newThumbsServerPath)) {
                CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
            }
        }

        $newFolderPath = preg_replace(",[^/]+/?$,", $newFolderName, $this->_currentFolder->getClientPath()) . '/';
        $newFolderUrl = $resourceTypeInfo->getUrl() . ltrim($newFolderPath, '/');

        $oRenameNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFolder");
        $this->_connectorNode->addChild($oRenameNode);

        $oRenameNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderName));
        $oRenameNode->addAttribute("newPath", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderPath));
        $oRenameNode->addAttribute("newUrl", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderUrl));
    }
27225
protected function buildXml()
  {
    if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
    }

    if (!extension_loaded('zip')) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_COMMAND);
    }

    $this->checkConnector();
    $this->checkRequest();

    if ( !$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
    }

    if (!isset($_POST["fileName"])) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
    }

    $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST["fileName"]);
    $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();

    if (!$resourceTypeInfo->checkExtension($fileName)) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
    }

    if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
    }

    $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);

    if (!file_exists($filePath) || !is_file($filePath)) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
    }

    if (!is_writable(dirname($filePath))) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
    }

    if ( strtolower(pathinfo($fileName, PATHINFO_EXTENSION)) !== 'zip'){
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
    }

    $zip = new ZipArchive();
    $result = $zip->open($filePath);
    if ($result !== TRUE) {
      $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNKNOWN);
    }
    $this->zip = $zip;
    $this->filePath = $filePath;
    $this->_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");

    // list of unzipped nodes
    $this->unzippedNodes = new CKFinder_Connector_Utils_XmlNode("UnzippedFiles");

    // list of files which could not be unzipped
    $this->skippedFilesNode = new CKFinder_Connector_Utils_XmlNode("Errors");
    $this->errorCode = CKFINDER_CONNECTOR_ERROR_NONE;
  }
715012
function(xml) {
    var contexp, fn, formatted, indent, l, lastType, len, lines, ln, pad, reg, transitions, wsexp;
    reg = /(>)(<)(\/*)/g;
    wsexp = /[ ]*(.*)[ ]+\n/g;
    contexp = /(<.+>)(.+\n)/g;
    xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
    pad = 0;
    formatted = '';
    lines = xml.split('\n');
    indent = 0;
    lastType = 'other';
    transitions = {
      'single->single': 0,
      'single->closing': -1,
      'single->opening': 0,
      'single->other': 0,
      'closing->single': 0,
      'closing->closing': -1,
      'closing->opening': 0,
      'closing->other': 0,
      'opening->single': 1,
      'opening->closing': 0,
      'opening->opening': 1,
      'opening->other': 1,
      'other->single': 0,
      'other->closing': -1,
      'other->opening': 0,
      'other->other': 0
    };
    fn = function(ln) {
      var fromTo, j, key, padding, type, types, value;
      types = {
        single: Boolean(ln.match(/<.+\/>/)),
        closing: Boolean(ln.match(/<\/.+>/)),
        opening: Boolean(ln.match(/<[^!?].*>/))
      };
      type = ((function() {
        var results;
        results = [];
        for (key in types) {
          value = types[key];
          if (value) {
            results.push(key);
          }
        }
        return results;
      })())[0];
      type = type === void 0 ? 'other' : type;
      fromTo = lastType + '->' + type;
      lastType = type;
      padding = '';
      indent += transitions[fromTo];
      padding = ((function() {
        var m, ref1, results;
        results = [];
        for (j = m = 0, ref1 = indent; 0 <= ref1 ? m < ref1 : m > ref1; j = 0 <= ref1 ? ++m : --m) {
          results.push('  ');
        }
        return results;
      })()).join('');
      if (fromTo === 'opening->closing') {
        formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
      } else {
        formatted += padding + ln + '\n';
      }
    };
    for (l = 0, len = lines.length; l < len; l++) {
      ln = lines[l];
      fn(ln);
    }
    return formatted;
  }
1061795
def load_xml(self, xmlfile):
        

        self.logger.info('Loading XML')

        for c in self.components:
            c.load_xml(xmlfile)

        for name in self.like.sourceNames():
            self.update_source(name)

        self._fitcache = None

        self.logger.info('Finished Loading XML')
634045
protected function buildXml()
    {
        if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
        }

        $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
        if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
        }

        $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
        $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
        $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
        if ($_config->forceAscii()) {
            $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sNewFolderName);
        }

        if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
        }

        $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
        if (!is_writeable($this->_currentFolder->getServerPath())) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        }

        $bCreated = false;

        if (file_exists($sServerDir)) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
        }

        if ($perms = $_config->getChmodFolders()) {
            $oldUmask = umask(0);
            $bCreated = @mkdir($sServerDir, $perms);
            umask($oldUmask);
        }
        else {
            $bCreated = @mkdir($sServerDir);
        }

        if (!$bCreated) {
            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
        } else {
            $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
            $this->_connectorNode->addChild($oNewFolderNode);
            $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
        }
    }
1279280
function initComponentDir (config, absDir, file) {
    // get name from camel-case file
    var name = changeCase.camelCase(file)
    // map of files in directory
    var files = {}
    // read all files
    _.each(fs.readdirSync(absDir), file => {
        files[file] = false
    })
    // component specification
    var component = {name: name}
    // map of files to be required and the property they map to
    var requireFiles = {
        [`${file}.client.js`]: 'client',
        [`${file}.server.js`]: 'server',
    }
    // require files
    _.each(requireFiles, (property, file) => {
        // skip if file does not exist
        if (!defined(files[file])) {
            return
        }
        // require file and set as property for component
        component[property] = require(
            path.relative(__dirname, `${absDir}/${file}`)
        )
        // set flag true once file read
        files[file] = true
    })
    // map of files to load and the property they map to
    var loadFiles = {
        [`${file}.css`]: 'css',
        [`${file}.hbs`]: 'template',
        [`${file}.js`]: 'js',
    }
    // load files
    _.each(loadFiles, (property, file) => {
        // skip if file does not exist
        if (!defined(files[file])) {
            return
        }
        // require file and set as property for component
        component[property] = fs.readFileSync(`${absDir}/${file}`, {
            encoding: 'utf8'
        })
        // set flag true once file read
        files[file] = true
    })
    // load partials if directory exists
    if (defined(files['partials'])) {
        // create partials entry in config
        component.partials = {}
        // get abs path of partials dir
        var partialsDir = `${absDir}/partials`
        // load each file in partials dir
        _.each(fs.readdirSync(partialsDir), file => {
            // get absolute path of file
            var absFile = `${partialsDir}/${file}`
            // partial must have hbs extension
            if (file.match(/\.hbs$/)) {
                // use file name for partial name
                var name = changeCase.camelCase(file.replace(/\.hbs$/, ''))
                // load file
                component.partials[name] = fs.readFileSync(absFile, {
                    encoding: 'utf8'
                })
            }
            else {
                debug('initComponentDir: ignoring %s', absFile)
            }
        })
        // set flag true once file read
        files['partials'] = true
    }
    // load helpers if directory exists
    if (defined(files['helpers'])) {
        // create helpers entry in config
        component.helpers = {}
        // get abs path of helpers dir
        var helpersDir = `${absDir}/helpers`
        // load each file in partials dir
        _.each(fs.readdirSync(helpersDir), file => {
            // get absolute path of file
            var absFile = `${helpersDir}/${file}`
            // helpers must have hbs extension
            if (file.match(/\.js$/)) {
                // require file
                var helper = require(path.relative(__dirname, absFile))
                // helper is single function
                if (typeof helper === 'function') {
                    // use file name for helper name
                    var name = changeCase.camelCase(file.replace(/\.hbs$/, ''))
                    // set helper for component
                    component.helpers[name] = helper
                }
                // otherwise helper should be object keyed by name
                else {
                    _.merge(component.helpers, helper)
                }
            }
            else {
                debug('initComponentDir: ignoring %s', absFile)
            }
        })
        // set flag true once file read
        files['helpers'] = true
    }
    // if component is already defined merge this data over original spec
    if (defined(config.components[name])) {
        _.merge(config.components[name], component)
    }
    // otherwise defined new component
    else {
        config.components[name] = component
    }
}
21908
def to_xml
      xml = %(<method name="#{@name}">\n)
      @params.each do |param|
        name = param.name ? %(name="#{param.name}" ) : ""
        xml += %(<arg #{name}direction="in" type="#{param.type}"/>\n)
      end
      @rets.each do |param|
        name = param.name ? %(name="#{param.name}" ) : ""
        xml += %(<arg #{name}direction="out" type="#{param.type}"/>\n)
      end
      xml += %(</method>\n)
      xml
    end
380142
def build_components(components):
    
    component_list = []

    for comp in components:
        component = ea.Component()

        # id
        component.id = comp.get('id')

        # type
        component.type = comp.get('type')

        # asset, if available
        component.asset = comp.get('asset')

        # DOI
        component.doi = comp.get('doi')

        if component_title(comp) != '':
            component.title = component_title(comp)

        # Subtitle
        if comp.get('type') in ['supplementary-material', 'fig']:

            if comp.get('full_caption'):
                subtitle = comp.get('full_caption')
                subtitle = clean_abstract(subtitle)
                component.subtitle = subtitle

        # Mime type
        if comp.get('type') in ['abstract', 'table-wrap', 'sub-article',
                                'chem-struct-wrap', 'boxed-text']:
            component.mime_type = 'text/plain'
        if comp.get('type') in ['fig']:
            component.mime_type = 'image/tiff'
        elif comp.get('type') in ['media', 'supplementary-material']:
            if comp.get('mimetype') and comp.get('mime-subtype'):
                component.mime_type = (comp.get('mimetype') + '/'
                                       + comp.get('mime-subtype'))

        # Permissions
        component.permissions = comp.get('permissions')

        # Append it to our list of components
        component_list.append(component)

    return component_list
444180
def output_xml(data, code, headers=None):
    """"""
    resp = make_response(dumps({'response' :data}), code)
    resp.headers.extend(headers or {})
    return resp
1234634
def _make_xml(self, endpoints):
        # type: (List[EndpointDescription]) -> ElementTree.Element
        
        root = ElementTree.Element(TAG_ENDPOINT_DESCRIPTIONS)
        for endpoint in endpoints:
            self._make_endpoint(root, endpoint)

        # Prepare pretty-printing
        self._indent(root)
        return root
158174
@Public @Path("/musics/list/xml")
	public void showAllMusicsAsXML() {
		result.use(xml()).from(musicDao.listAll()).serialize();
	}
148846
def to_xml
      builder = Builder::XmlMarkup.new
      builder.instruct!
      xml = builder.notice(:version => Airbrake::API_VERSION) do |notice|
        notice.tag!("api-key", api_key)
        notice.notifier do |notifier|
          notifier.name(notifier_name)
          notifier.version(notifier_version)
          notifier.url(notifier_url)
        end
        notice.error do |error|
          error.tag!('class', error_class)
          error.message(error_message)
          error.backtrace do |backtrace|
            self.backtrace.lines.each do |line|
              backtrace.line(:number => line.number,
                             :file   => line.file,
                             :method => line.method)
            end
          end
        end
        if url ||
            controller ||
            action ||
            !parameters.blank? ||
            !cgi_data.blank? ||
            !session_data.blank?
          notice.request do |request|
            request.url(url)
            request.component(controller)
            request.action(action)
            unless parameters.nil? || parameters.empty?
              request.params do |params|
                xml_vars_for(params, parameters)
              end
            end
            unless session_data.nil? || session_data.empty?
              request.session do |session|
                xml_vars_for(session, session_data)
              end
            end
            unless cgi_data.nil? || cgi_data.empty?
              request.tag!("cgi-data") do |cgi_datum|
                xml_vars_for(cgi_datum, cgi_data)
              end
            end
          end
        end
        notice.tag!("server-environment") do |env|
          env.tag!("project-root", project_root)
          env.tag!("environment-name", environment_name)
          env.tag!("hostname", hostname)
        end
      end
      xml.to_s
    end
788264
def set_components(self):
        

        node_flags = attributes_flags = int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        root_node = umbra.ui.nodes.DefaultNode(name="InvisibleRootNode")

        paths = {}
        for path in self.__engine.components_manager.paths:
            basename = os.path.basename(path)
            if not paths.get(basename):
                paths[basename] = {}

            paths[basename].update(dict((name, component)
                                        for (name, component) in self.__engine.components_manager
                                        if basename == os.path.basename(os.path.dirname(component.directory))))

        for path, components in paths.iteritems():
            path_node = PathNode(name=path.title(),
                                 parent=root_node,
                                 node_flags=node_flags,
                                 attributes_flags=attributes_flags)

            for component in components.itervalues():
                if not component.interface:
                    continue

                component_node = ComponentNode(component,
                                               name=component.title,
                                               parent=path_node,
                                               node_flags=node_flags,
                                               attributes_flags=attributes_flags,
                                               activated=umbra.ui.nodes.GraphModelAttribute(name="activated",
                                                                                            flags=attributes_flags,
                                                                                            roles={
                                                                                            Qt.DisplayRole: foundations.strings.to_string(
                                                                                                component.interface.activated),
                                                                                            Qt.DecorationRole: os.path.join(
                                                                                                self.__ui_resources_directory,
                                                                                                component.interface.activated and
                                                                                                self.__ui_activated_image or self.__ui_deactivated_image)}))
                component_node.roles[Qt.DecorationRole] = os.path.join(self.__ui_resources_directory,
                                                                       "{0}{1}".format(component.category,
                                                                                       self.__ui_category_affixe))

        root_node.sort_children()

        self.__model.initialize_model(root_node)
        return True