Write a single sitemap or sitemapindex XML document.

        Must be overridden to support multi-file lists.
15854
def write(self, basename="/tmp/resynclist.xml"):
        
        self.default_capability()
        fh = open(basename, 'w')
        s = self.new_sitemap()
        s.resources_as_xml(self, fh=fh, sitemapindex=self.sitemapindex)
        fh.close()
947553
def save(location)
      if fragments.length == 1
        FileUtils.mv(fragments.first.path, location)
      else
        remove_saved_files(location)
        root = File.join(Pathname.new(location).dirname, "sitemaps")
        Dir.mkdir(root) unless File.directory?(root)
        fragments.each_with_index do |fragment, i|
          file_pattern = File.join(root, "sitemap-fragment-#{i + 1}.xml")
          FileUtils.mv(fragment.path, file_pattern)
          File.chmod(0755, file_pattern)
        end
        file = File.new(location, "w")
        file.write(render "index")
        file.close
      end
      File.chmod(0755, location)
    end
955861
def write(data, file_name, worksheet_names=None):
    '''
    
    '''
    if re.search(XML_EXT_REGEX, file_name):
        return write_xml(data, file_name, worksheet_names=worksheet_names)
    elif re.search(XLSX_EXT_REGEX, file_name):
        return write_xlsx(data, file_name, worksheet_names=worksheet_names)
    elif re.search(XLS_EXT_REGEX, file_name):
        return write_xls(data, file_name, worksheet_names=worksheet_names)
    elif re.search(CSV_EXT_REGEX, file_name):
        return write_csv(data, file_name)
    else:
        return write_csv(data, file_name)
865195
def writeXMLFile(filename, content):
    
    xmlfile = open(filename, 'w')
    # pretty print
    content = etree.tostring(content, pretty_print=True)
    xmlfile.write(content)
    xmlfile.close()
1126124
public final void rewriteXml(
        Writer out,
        String xmlFile,
        String aloneTags[],
        boolean outputXmlHeader
    ) {
        try {
            DocumentBuilderFactory fact = CDocumentBuilderFactory.newParser();
            Document xmlDoc =
                fact.newDocumentBuilder()
                    .parse(new InputSource(new StringReader(xmlFile)));
            rewriteXml(
                out,
                xmlDoc,
                aloneTags,
                outputXmlHeader
            );
        } catch (Exception e) {
            e.printStackTrace();

            return;
        }
    }
669196
@Deprecated
	public void saveSitemap(File file, String[] sitemap) throws IOException {
		try(BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
			for (String string : sitemap) {
				writer.write(string);
			}
		}
	}
636596
void writeTree() throws DocumentException {
		// MBeans pour la plateforme
		margin = 0;
		final MBeanNode platformNode = mbeans.get(0);
		writeTree(platformNode.getChildren());

		for (final MBeanNode node : mbeans) {
			if (node != platformNode) {
				newPage();
				addToDocument(new Chunk(node.getName(), boldFont));
				margin = 0;
				writeTree(node.getChildren());
			}
		}
	}
363278
def write(site_destination_dir)
      if modified?
        Files.copy_p(path, destination(site_destination_dir))
        @is_modified = false
        true
      else
        false
      end
    end
1003434
def childWriteXml(self, w, option):
		""""""
		ch = []
		for c in self.child:
			ch.append(c.WriteXml(w, option))
		return ch
336017
def generate
      sitemaps.group_by(&:folder).each do |folder, sitemaps|
        index_path = "#{DynamicSitemaps.temp_path}/#{folder}/#{DynamicSitemaps.index_file_name}"

        if !DynamicSitemaps.always_generate_index && sitemaps.count == 1 && sitemaps.first.files.count == 1
          file_path = "#{DynamicSitemaps.temp_path}/#{folder}/#{sitemaps.first.files.first}"
          FileUtils.copy file_path, index_path
          File.delete file_path
        else
          File.open(index_path, "w") do |file|
            write_beginning(file)
            write_sitemaps(file, sitemaps)
            write_end(file)
          end
        end
      end
    end
397168
public function createSitemapIndex(Iterator $sitemaps)
    {
        $groupName = $this->randomHash();
        $sitemapIndexes = new ArrayObject();
        $sitemapIndex = new SitemapIndex();
        $lastmod = date(DateTime::W3C);
        foreach ($sitemaps as $sitemapPath) {
            // Ignoring because this is an edge case for HUGE sites...like Facebook.
            // @codeCoverageIgnoreStart
            if ($sitemapIndex->hasMaxUrlCount()) {
                $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));
                $sitemapIndex = new SitemapIndex();
            }
            // @codeCoverageIgnoreEnd

            $sitemapIndex->add($this->fileUrl($sitemapPath), $lastmod);
        }
        $sitemapIndexes->append($this->writeSitemap($groupName, $sitemapIndex));

        // This will probably never happen, as it would mean over 2.5 Billion URLs in the
        // sitemap.  So unless Facebook uses this library, this will never happen, so ignore
        // it from code coverage.
        // @codeCoverageIgnoreStart
        if ($sitemapIndexes->count() > 1) {
            return $this->createSitemapIndex($sitemapIndexes->getIterator());
        }
        // @codeCoverageIgnoreEnd

        return $this->fileUrl($sitemapIndexes[0]);
    }
249920
def write_file(self, fileobject, skip_unknown=False):
        """"""
        self.set_metadata_version()

        for field in _version2fieldlist(self['Metadata-Version']):
            values = self.get(field)
            if skip_unknown and values in ('UNKNOWN', [], ['UNKNOWN']):
                continue
            if field in _ELEMENTSFIELD:
                self._write_field(fileobject, field, ','.join(values))
                continue
            if field not in _LISTFIELDS:
                if field == 'Description':
                    if self.metadata_version in ('1.0', '1.1'):
                        values = values.replace('\n', '\n        ')
                    else:
                        values = values.replace('\n', '\n       |')
                values = [values]

            if field in _LISTTUPLEFIELDS:
                values = [','.join(value) for value in values]

            for value in values:
                self._write_field(fileobject, field, value)
744879
def write(self, fileobj = sys.stdout, xsl_file = None):
		
		fileobj.write(Header)
		fileobj.write(u"\n")
		if xsl_file is not None:
			fileobj.write(u'<?xml-stylesheet type="text/xsl" href="%s" ?>\n' % xsl_file)
		for c in self.childNodes:
			if c.tagName not in self.validchildren:
				raise ElementError("invalid child %s for %s" % (c.tagName, self.tagName))
			c.write(fileobj)
918523
def write_xml(self):
        '''
            
        '''
        key = None
        if self. language is not None:
            lang = {}
            lang['{http://www.w3.org/XML/1998/namespace}lang'] = self.language
            key = etree.Element('vocabulary-key', attrib=lang)
        else:
            key = etree.Element('vocabulary-key')

        name = etree.Element('name')
        name.text = self.name
        key.append(name)

        if self.family is not None:
            family = etree.Element('family')
            family.text = self.family
            key.append(family)

        if self.version is not None:
            version = etree.Element('version')
            version.text = self.version
            key.append(version)

        if self.code_value is not None:
            code_value = etree.Element('code-value')
            code_value.text = self.code_value
            key.append(code_value)

        return key
892855
def write_xml(xml)
      fname = "#{@appliance_name}.xml"
      File.open("#{@dir.tmp}/#{fname}", 'w'){|f| f.write(xml)}
      register_deliverable(:xml => fname)
    end
780950
def write_xspf(f, tuples):
    """"""
    xml = XmlWriter(f, indentAmount='  ')
    xml.prolog()
    xml.start('playlist', { 'xmlns': 'http://xspf.org/ns/0/', 'version': '1' })
    xml.start('trackList')
    for tupe in tuples:
        xml.start('track')
        xml.elem('creator',tupe[0])
        xml.elem('title',tupe[1])
        xml.elem('location', tupe[2])
        xml.end()
    xml.end()
    xml.end()
    f.close()
933237
def generate_sitemap(basedir)
      sitemap_file = File.join(basedir, 'sitemap.xml')
      File.open(sitemap_file, 'w') do |file|
        file.write(sitemap_contents(basedir))
      end
    end