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


PHP XMLWriter::startDocument方法代码示例

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


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

示例1: setupStoreData

 protected function setupStoreData()
 {
     // Using XMLWriter because SimpleXML namespaces on attribute names
     $this->doc = new XMLWriter();
     $this->doc->openMemory();
     $this->doc->setIndent(true);
     $this->doc->setIndentString('    ');
     $this->doc->startDocument('1.0', 'UTF-8');
     $this->doc->startElement('feed');
     $this->doc->writeAttribute('xmlns', 'http://www.w3.org/2005/Atom');
     $this->doc->writeAttribute('xmlns:g', 'http://base.google.com/ns/1.0');
     $this->doc->writeElement('title', $this->getConfig('title'));
     $this->doc->startElement('link');
     $this->doc->writeAttribute('rel', 'self');
     $this->doc->writeAttribute('href', $this->_store->getBaseUrl());
     $this->doc->endElement();
     $date = new Zend_Date();
     $this->doc->writeElement('updated', $date->get(Zend_Date::ATOM));
     $this->doc->startElement('author');
     $this->doc->writeElement('name', $this->getConfig('author'));
     $this->doc->endElement();
     $url = $this->_store->getBaseUrl();
     $day = $date->toString('yyyy-MM-dd');
     $path = $this->getConfig('output');
     $filename = $path . '/' . str_replace('+', '-', strtolower(urlencode($this->_store->getName()))) . '-products.xml';
     $this->doc->writeElement('id', 'tag:' . $url . ',' . $day . ':' . $filename);
 }
开发者ID:0l1v1er,项目名称:MagentoExtensions,代码行数:27,代码来源:Cron.php

示例2: __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

示例3: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     $this->map = new \XMLWriter();
     $this->map->openMemory();
     $this->map->startDocument('1.0', 'utf-8');
     $this->map->setIndent(true);
     $this->startSitemap();
 }
开发者ID:sebastian-marinescu,项目名称:silex-sitemap-service-provider,代码行数:11,代码来源:SitemapGenerator.php

示例4: __construct

 /**
  * Construct a new instance of ConnectionParams.
  *
  * @param array &$connectionParams Connection parameters for database.
  */
 public function __construct(&$connectionParams)
 {
     $this->connectionParams = $connectionParams;
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
     $this->xmlWriter->setIndent(4);
 }
开发者ID:gizur,项目名称:odatamysqlphpconnect,代码行数:13,代码来源:ConnectionParams.php

示例5: __construct

 /**
  * Set and instantiate new UTF-8 XML document
  */
 public function __construct()
 {
     $this->context = new \XMLWriter();
     $this->context->openMemory();
     $this->context->startDocument('1.0', 'UTF-8');
     $this->context->setIndent(true);
     $this->context->setIndentString("  ");
 }
开发者ID:genesisgateway,项目名称:genesis_php,代码行数:11,代码来源:XML.php

示例6: startDocument

 /**
  * Start document
  *
  * @param mixed $data
  */
 public function startDocument($data)
 {
     $this->checkStartDocument($data);
     $this->isEmpty = true;
     $this->xmlWriter = new \XMLWriter();
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($this->formatOutput);
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
 }
开发者ID:dfritschy,项目名称:ezpublish-kernel,代码行数:14,代码来源:Xml.php

示例7: write

 /**
  * Converts array with export data to XML format.
  *
  * @param array $array
  *
  * @return string
  */
 public function write(array $array)
 {
     $this->xmlWriter->openMemory();
     $this->xmlWriter->setIndent($this->formatOutput);
     $this->xmlWriter->setIndentString('    ');
     $this->xmlWriter->startDocument('1.0', 'UTF-8');
     $this->fromArray($array);
     $this->xmlWriter->endDocument();
     return $this->xmlWriter->outputMemory();
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:17,代码来源:CXmlExportWriter.php

示例8: start

 /**
  * Defined by ReportInterface.
  *
  * @see ReportInterface::start()
  */
 public function start()
 {
     $this->writer = new XMLWriter();
     $this->writer->openMemory();
     $this->writer->setIndent(true);
     $this->writer->setIndentString('    ');
     $this->writer->startDocument('1.0', 'UTF-8');
     $this->writer->startElement('checkstyle');
     $this->writer->writeAttribute('version', '5.5');
 }
开发者ID:hippophp,项目名称:hippo,代码行数:15,代码来源:CheckstyleReporter.php

示例9: 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

示例10: __toString

 public function __toString()
 {
     $this->writer->openMemory();
     $this->writer->startDocument($this->version, $this->encoding);
     $this->writer->startElement($this->root);
     foreach ($this->data as $key => $value) {
         $this->writeElement($key, $value);
     }
     $this->writer->endElement();
     $this->writer->endDocument();
     return $this->writer->outputMemory(true);
 }
开发者ID:wells5609,项目名称:wp-app,代码行数:12,代码来源:Document.php

示例11: _getWriter

 protected function _getWriter()
 {
     $writer = new XMLWriter();
     $writer->openMemory();
     if ($this->_format == self::OUTPUT_PRETTY) {
         $writer->setIndent(TRUE);
         $writer->startDocument('1.0', 'UTF-8');
     } else {
         $writer->setIndent(FALSE);
         $writer->startDocument();
     }
     return $writer;
 }
开发者ID:inscriptionweb,项目名称:PhotoShow,代码行数:13,代码来源:Encoder.php

示例12: getWriter

 /**
  * Return an XML writer that will be used
  * to produce XML-RPC requests and responses.
  *
  * \retval XMLWriter
  *      XML writer to use to produce documents.
  */
 protected function getWriter()
 {
     $writer = new \XMLWriter();
     $writer->openMemory();
     if ($this->indent) {
         $writer->setIndent(true);
         $writer->startDocument('1.0', 'UTF-8');
     } else {
         $writer->setIndent(false);
         $writer->startDocument();
     }
     return $writer;
 }
开发者ID:fpoirotte,项目名称:xrl,代码行数:20,代码来源:Encoder.php

示例13: _convertRoot

 protected function _convertRoot()
 {
     // Find first <book> element
     while (!($this->_reader->nodeType == XMLReader::ELEMENT && $this->_reader->name == 'book')) {
         $this->_reader->read();
     }
     if (!($this->_reader->nodeType == XMLReader::ELEMENT && $this->_reader->name == 'book')) {
         throw new ErrorException("Unable to find root book element");
     }
     // Find the title attribute
     $bookTitle = $this->_reader->getAttribute('title');
     if (!$bookTitle) {
         throw new ErrorException("Unable to find book title attribute");
     }
     // Start XML and write root element
     $this->_writer->startDocument('1.0', 'UTF-8');
     $this->_writer->startElement('book');
     $this->_writer->writeAttribute('xmlns', 'http://arr.gr/humanhelp/book');
     $this->_writer->writeAttribute('timestamp', time());
     // Write title
     $this->_writer->writeElement('title', $bookTitle);
     // Write default pageFilters
     $this->_writer->startElement('pageFilters');
     $this->_writer->startElement('filter');
     $this->_writer->writeAttribute('class', 'HHLib_XhtmlFilter_FixMediaUrls');
     $this->_writer->endElement();
     $this->_writer->startElement('filter');
     $this->_writer->writeAttribute('class', 'HHLib_XhtmlFilter_FixBSSCPopupUrls');
     $this->_writer->endElement();
     $this->_writer->endElement();
     // Start creating the the TOC
     $this->_writer->startElement('toc');
     while ($this->_reader->read()) {
         if ($this->_reader->nodeType == XMLReader::ELEMENT) {
             switch ($this->_reader->name) {
                 case 'page':
                     $this->_convertPage();
                     break;
                 case 'book':
                     $this->_convertBook();
                     break;
             }
         }
     }
     $this->_writer->endElement();
     // End of <toc> element
     $this->_writer->endElement();
     // End of root <book> element
     $this->_writer->endDocument();
     $this->_writer->flush();
 }
开发者ID:shevron,项目名称:HumanHelp,代码行数:51,代码来源:robohelp-xhtml-import.php

示例14: to_xml

 /**
  * Convert the request data into XML.
  *
  * @since 4.3.0
  * @return string
  */
 protected function to_xml()
 {
     if (!empty($this->request_xml)) {
         return $this->request_xml;
     }
     $this->xml = new XMLWriter();
     // Create XML document in memory
     $this->xml->openMemory();
     // Set XML version & encoding
     $this->xml->startDocument('1.0', 'UTF-8');
     $request_data = $this->get_request_data();
     SV_WC_Helper::array_to_xml($this->xml, $this->get_root_element(), $request_data[$this->get_root_element()]);
     $this->xml->endDocument();
     return $this->request_xml = $this->xml->outputMemory();
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:21,代码来源:abstract-sv-wc-api-xml-request.php

示例15: initialize

 /**
  * @param Definition $definition
  * @param \XMLWriter $writer
  */
 protected function initialize($writer, Definition $definition)
 {
     $writer->setIndent(true);
     $writer->setIndentString("    ");
     $writer->startDocument("1.0", "UTF-8");
     $writer->startElement($definition->getNodeName() ?: "root");
 }
开发者ID:bcncommerce,项目名称:serializer,代码行数:11,代码来源:XmlWriter.php


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