當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。