当前位置: 首页>>代码示例>>PHP>>正文


PHP XMLWriter::openUri方法代码示例

本文整理汇总了PHP中XMLWriter::openUri方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::openUri方法的具体用法?PHP XMLWriter::openUri怎么用?PHP XMLWriter::openUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLWriter的用法示例。


在下文中一共展示了XMLWriter::openUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Create a new PHPPowerPoint_Shared_XMLWriter instance
  *
  * @param int		$pTemporaryStorage			Temporary storage location
  * @param string	$pTemporaryStorageFolder	Temporary storage folder
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './')
 {
     // Create internal XMLWriter
     $this->_xmlWriter = new XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->_xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->_tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
         // Open storage
         if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
             // Fallback to memory...
             $this->_xmlWriter->openMemory();
         }
     }
     // Set default values
     // proposed to be false in production version
     $this->_xmlWriter->setIndent(true);
     //$this->_xmlWriter->setIndent(false);
     // Set indent
     // proposed to be '' in production version
     $this->_xmlWriter->setIndentString('  ');
     //$this->_xmlWriter->setIndentString('');
 }
开发者ID:aleph1888,项目名称:elgg_file_takeout,代码行数:31,代码来源:XMLWriter.php

示例2: setPath

 /**
  * @param string $path Path to be set
  *
  * @return $this
  */
 public function setPath($path)
 {
     parent::setPath($path);
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openUri($path);
     return $this;
 }
开发者ID:havramar,项目名称:next-php-sitemap-generator,代码行数:12,代码来源:WriterXmlAbstract.php

示例3: __construct

 public function __construct($documentUri, $version = '1.0', $encoding = 'utf-8')
 {
     $this->xmlWriter = new \XMLWriter();
     $this->elementWriter = new ElementWriter($this->xmlWriter);
     $this->xmlWriter->openUri($documentUri);
     $this->xmlWriter->setIndent(true);
     $this->xmlWriter->startDocument($version, $encoding);
 }
开发者ID:maximfisyuk,项目名称:price-writer,代码行数:8,代码来源:Document.php

示例4: initialize

 public function initialize(Config $config, $directory, $filenameWithDate = false)
 {
     $this->setFilename($config, $directory, $filenameWithDate);
     $this->xml = new \XMLWriter();
     $this->xml->openUri($this->filename);
     $this->xml->startDocument('1.0', 'utf-8');
     $this->xml->setIndent(true);
     $this->xml->setIndentString('    ');
     $this->xml->writeComment('list of ' . $config->getClassName());
     $this->elementName = strtolower($config->getClassNameLastPart());
     $this->xml->startElement(strtolower($config->getClassNameLastPart(true)));
 }
开发者ID:csanquer,项目名称:fakery-generator,代码行数:12,代码来源:XMLDumper.php

示例5: __construct

 /**
  * Create a new \PhpOffice\PhpPowerpoint\Shared\XMLWriter instance
  *
  * @param int $pTemporaryStorage Temporary storage location
  * @param string $pTemporaryStorageDir Temporary storage folder
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageDir = './')
 {
     // Create internal XMLWriter
     $this->xmlWriter = new \XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml');
         // Open storage
         $this->xmlWriter->openUri($this->tempFileName);
     }
     // Set default values
     $this->xmlWriter->setIndent(true);
 }
开发者ID:cleverape,项目名称:phppowerpoint,代码行数:22,代码来源:XMLWriter.php

示例6: export

 /**
  * Fetches the site with the given name and exports it into XML.
  *
  * @param array<\TYPO3\TYPO3\Domain\Model\Site> $sites
  * @return void
  */
 public function export(array $sites)
 {
     $this->nodeRepository->getContext()->setInvisibleContentShown(TRUE);
     $this->nodeRepository->getContext()->setInaccessibleContentShown(TRUE);
     $xmlWriter = new \XMLWriter();
     $xmlWriter->openUri('php://output');
     $xmlWriter->startDocument('1.0', 'UTF-8');
     $xmlWriter->startElement('root');
     foreach ($sites as $site) {
         $xmlWriter->startElement('site');
         // site attributes
         $xmlWriter->writeAttribute('nodeName', $site->getNodeName());
         // site properties
         $xmlWriter->startElement('properties');
         $xmlWriter->writeElement('name', $site->getName());
         $xmlWriter->writeElement('state', $site->getState());
         $xmlWriter->writeElement('siteResourcesPackageKey', $site->getSiteResourcesPackageKey());
         $xmlWriter->endElement();
         // on to the nodes...
         $node = $this->nodeRepository->getContext()->getNode('/Sites/' . $site->getNodeName());
         foreach ($node->getChildNodes() as $childNode) {
             $this->exportNode($childNode, $xmlWriter);
         }
         $xmlWriter->endElement();
     }
     $xmlWriter->endElement();
     $xmlWriter->endDocument();
     $xmlWriter->flush();
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3,代码行数:35,代码来源:SiteExportService.php

示例7: open

 /**
  * @param \XMLWriter $writer
  * @param resource   $stream
  */
 protected function open(\XMLWriter $writer, $stream)
 {
     if (is_resource($stream)) {
         $writer->openMemory();
     } else {
         $writer->openUri($stream);
     }
 }
开发者ID:bcncommerce,项目名称:serializer,代码行数:12,代码来源:XmlWriter.php

示例8: openUri

 /**
  * Opens and uri.
  *
  * @param string $uri
  *   Uri to be opened.
  *
  * @throws XmlSitemapGenerationException
  *   Throws exception when uri cannot be opened.
  *
  * @return bool
  *   Returns TRUE when uri was successful opened.
  */
 public function openUri($uri)
 {
     $return = parent::openUri($uri);
     if (!$return) {
         throw new XmlSitemapGenerationException(t('Could not open file @file for writing.', array('@file' => $uri)));
     }
     return $return;
 }
开发者ID:jeroenos,项目名称:jeroenos_d8.mypressonline.com,代码行数:20,代码来源:XmlSitemapWriter.php

示例9: __construct

 /**
  * Create a new PHPExcel_Shared_XMLWriter instance
  *
  * @param int	$pTemporaryStorage	Temporary storage location
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY)
 {
     // Create internal XMLWriter
     $this->_xmlWriter = new XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->_xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->_tempFileName = @tempnam('./', 'xml');
         // Open storage
         if ($this->_xmlWriter->openUri($this->_tempFileName) === false) {
             // Fallback to memory...
             $this->_xmlWriter->openMemory();
         }
     }
     // Set default values
     $this->_xmlWriter->setIndent(true);
 }
开发者ID:laiello,项目名称:myopensources,代码行数:24,代码来源:XMLWriter.php

示例10: exportToFile

 /**
  * Fetches the site with the given name and exports it as XML into the given file.
  *
  * @param array<Site> $sites
  * @param boolean $tidy Whether to export formatted XML
  * @param string $pathAndFilename Path to where the export output should be saved to
  * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text")
  * @return void
  */
 public function exportToFile(array $sites, $tidy = false, $pathAndFilename, $nodeTypeFilter = null)
 {
     $this->resourcesPath = Files::concatenatePaths(array(dirname($pathAndFilename), 'Resources'));
     Files::createDirectoryRecursively($this->resourcesPath);
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openUri($pathAndFilename);
     $this->xmlWriter->setIndent($tidy);
     $this->exportSites($sites, $nodeTypeFilter);
     $this->xmlWriter->flush();
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:19,代码来源:SiteExportService.php

示例11: array

 /**
  * 
  */
 function __construct($config = array())
 {
     if (!class_exists('XMLWriter')) {
         require_once 'Spizer/Logger/Exception.php';
         throw new Spizer_Logger_Exception('The XMLWriter PHP extension is not loaded');
     }
     $this->_config = array_merge($this->_config, $config);
     $this->_writer = new XMLWriter();
     if (!$this->_writer->openUri($this->_config['target'])) {
         require_once 'Spizer/Logger/Exception.php';
         throw new Spizer_Logger_Exception('Cannot open log file "' . $this->_config['target'] . '" for writing');
     }
     $this->_writer->setIndent($this->_config['indent']);
     $this->_writer->setIndentString($this->_config['indentstr']);
     $this->_writer->startDocument('1.0', 'UTF-8');
     $this->_writer->startElement('spizerlog');
     $this->_writer->writeAttribute('xmlns', 'http://arr.gr/spizer/xmllog/1.0');
     $this->_writer->writeAttribute('microtime', microtime(true));
 }
开发者ID:highestgoodlikewater,项目名称:spizer,代码行数:22,代码来源:Xml.php

示例12: __construct

 /**
  * Create a new \PhpOffice\PhpPowerpoint\Shared\XMLWriter instance
  *
  * @param int $pTemporaryStorage Temporary storage location
  * @param string $pTemporaryStorageDir Temporary storage folder
  */
 public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageDir = './', $compatibility = false)
 {
     // Create internal XMLWriter
     $this->xmlWriter = new \XMLWriter();
     // Open temporary storage
     if ($pTemporaryStorage == self::STORAGE_MEMORY) {
         $this->xmlWriter->openMemory();
     } else {
         // Create temporary filename
         $this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml');
         // Open storage
         $this->xmlWriter->openUri($this->tempFileName);
     }
     if ($compatibility) {
         $this->xmlWriter->setIndent(false);
         $this->xmlWriter->setIndentString('');
     } else {
         $this->xmlWriter->setIndent(true);
         $this->xmlWriter->setIndentString('  ');
     }
 }
开发者ID:hxsam,项目名称:Common,代码行数:27,代码来源:XMLWriter.php

示例13: saveDiffToFile

 /**
  * Writes the schema difference definition in $dbSchema to the file $file.
  *
  * @param string          $file
  * @param ezcDbSchemaDiff $dbSchema
  * @todo throw exception when file can not be opened
  */
 public function saveDiffToFile($file, ezcDbSchemaDiff $dbSchema)
 {
     $this->writer = new XMLWriter();
     if (!@$this->writer->openUri($file)) {
         throw new ezcBaseFilePermissionException($file, ezcBaseFileException::WRITE);
     }
     $this->writer->startDocument('1.0', 'utf-8');
     $this->writer->setIndent(true);
     $this->writer->startElement('database');
     $this->writer->flush();
     // New tables
     $this->writer->startElement('new-tables');
     $this->writer->flush();
     foreach ($dbSchema->newTables as $tableName => $table) {
         $this->writeTable($tableName, $table);
         $this->writer->flush();
     }
     $this->writer->endElement();
     $this->writer->flush();
     // Removed tables
     $this->writer->startElement('removed-tables');
     $this->writer->flush();
     foreach ($dbSchema->removedTables as $tableName => $tableStatus) {
         $this->writer->startElement('table');
         $this->writer->startElement('name');
         $this->writer->text($tableName);
         $this->writer->endElement();
         $this->writer->startElement('removed');
         $this->writer->text($tableStatus ? 'true' : 'false');
         $this->writer->endElement();
         $this->writer->endElement();
         $this->writer->flush();
     }
     $this->writer->endElement();
     $this->writer->flush();
     // Changed tables
     $this->writer->startElement('changed-tables');
     $this->writer->flush();
     foreach ($dbSchema->changedTables as $tableName => $table) {
         $this->writeChangedTable($tableName, $table);
         $this->writer->flush();
     }
     $this->writer->endElement();
     $this->writer->flush();
     $this->writer->endElement();
     $this->writer->endDocument();
 }
开发者ID:valentinbora,项目名称:joobsbox-php,代码行数:54,代码来源:writer.php

示例14: dump_xml_file

function dump_xml_file($lang, $outDir, $grammemsPrefix, $posesPrefix)
{
    $lang = strtolower($lang);
    $out_file = "{$outDir}/{$lang}.xml";
    $clazz = 'ConstNames_' . ucfirst($lang);
    $php_file = dirname(__FILE__) . '/' . $lang . '.php';
    require_once $php_file;
    $obj = new $clazz();
    $writer = new XMLWriter();
    $writer->openUri($out_file);
    $writer->setIndent(true);
    $writer->setIndentString("    ");
    $writer->startDocument('1.0', 'UTF-8');
    $writer->startElement('gramtab');
    // parts of speech
    $writer->startElement('part_of_speech');
    foreach ($obj->getPartsOfSpeech() as $pos) {
        $writer->startElement('pos');
        $writer->writeAttribute('name', $pos['short_name']);
        $writer->writeAttribute('const_name', $posesPrefix . $pos['long_name']);
        $writer->writeAttribute('id', $pos['id']);
        $writer->endElement();
    }
    $writer->endElement();
    // grammems
    $writer->startElement('grammems');
    $shift = 0;
    foreach ($obj->getGrammems() as $grammem) {
        $writer->startElement('grammem');
        $writer->writeAttribute('name', $grammem['short_name']);
        $writer->writeAttribute('const_name', $grammemsPrefix . $grammem['long_name']);
        $writer->writeAttribute('id', $grammem['id']);
        $writer->writeAttribute('shift', $shift);
        $shift++;
        $writer->endElement();
    }
    $writer->endElement();
    $writer->endElement();
    $writer->endDocument();
}
开发者ID:Arikito,项目名称:webking.xt,代码行数:40,代码来源:convert_gramtab_names.php

示例15: create_item

function create_item($arr)
{
    //  属性数组
    $attribute_array = array('title' => array('size' => 1));
    $xml = new XMLWriter();
    $xml->openUri("php://output");
    //  输出方式,也可以设置为某个xml文件地址,直接输出成文件
    $xml->setIndentString('  ');
    $xml->setIndent(true);
    $xml->startDocument('1.0', 'utf-8');
    //  开始创建文件
    //  根结点
    $xml->startElement('article');
    foreach ($arr as $data) {
        $xml->startElement('item');
        if (is_array($data)) {
            foreach ($data as $key => $row) {
                $xml->startElement($key);
                if (isset($attribute_array[$key]) && is_array($attribute_array[$key])) {
                    foreach ($attribute_array[$key] as $akey => $aval) {
                        //  设置属性值
                        $xml->writeAttribute($akey, $aval);
                    }
                }
                $xml->text($row);
                //  设置内容
                $xml->endElement();
                // $key
            }
        }
        $xml->endElement();
        //  item
    }
    $xml->endElement();
    //  article
    $xml->endDocument();
    $xml->flush();
}
开发者ID:ChanHarold,项目名称:ecshop,代码行数:38,代码来源:function.php


注:本文中的XMLWriter::openUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。