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


PHP XmlWriter::startDocument方法代码示例

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


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

示例1: begin

 public function begin()
 {
     $this->writer->openMemory();
     $this->writer->setIndent(true);
     $this->writer->setIndentString(str_repeat(' ', 4));
     $this->writer->startDocument('1.0', 'UTF-8');
 }
开发者ID:JoshBour,项目名称:karolina,代码行数:7,代码来源:SitemapXmlParser.php

示例2: execute

 public function execute($input)
 {
     $this->isRoot = true;
     $this->writer = new XMLWriter();
     $this->writer->openMemory();
     $this->writer->startDocument('1.0', 'UTF-8');
     $this->writer->setIndent(true);
     $this->run($input);
     return $this->writer->flush();
 }
开发者ID:danharper,项目名称:jsonx,代码行数:10,代码来源:ToJSONx.php

示例3: initialize

 private function initialize()
 {
     if ($this->streamUri !== null) {
         $this->cursor->openUri($this->streamUri);
     } else {
         $this->cursor->openMemory();
     }
     $this->cursor->startDocument($this->marshaller->getSchemaVersion(), $this->marshaller->getEncoding());
     if ($this->marshaller->getIndent() > 0) {
         $this->cursor->setIndent((int) $this->marshaller->getIndent());
     }
 }
开发者ID:GromNaN,项目名称:oxm,代码行数:12,代码来源:WriterHelper.php

示例4: writeChannel

 /**
  * writeChannel writes a Core\Channel instance feed.
  *
  * @param Channel $channel
  *
  * @return mixed Similar to XMLWriter::flush 
  *
  * @see http://php.net/manual/function.xmlwriter-flush.php
  */
 public function writeChannel(Channel $channel)
 {
     $this->xmlWriter->startDocument();
     if ($this->flushEarly) {
         $this->xmlWriter->flush();
     }
     $this->xmlWriter->startElement('rss');
     foreach ($this->namespaces as $ns => $url) {
         $this->xmlWriter->writeAttribute(sprintf('xmlns:%s', $ns), $url);
     }
     $this->xmlWriter->writeAttribute('version', '2.0');
     $this->writeObject($channel);
     $this->xmlWriter->endElement();
     return $this->xmlWriter->flush();
 }
开发者ID:marcw,项目名称:rss-writer,代码行数:24,代码来源:RssWriter.php

示例5: render

 protected function render(Response $response)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $response = clone $response;
     foreach ($response->data as $key => $value) {
         if ($value instanceof ModelSet) {
             $response->data[$key] = $value->toArray();
         }
         if ($value instanceof Form) {
             unset($response->data[$key]);
         }
         if (substr($key, 0, 1) == '_') {
             unset($response->data[$key]);
         }
     }
     if (isset($response->data['application'])) {
         unset($response->data['application']);
     }
     if (isset($response->data['controller'])) {
         unset($response->data['controller']);
     }
     foreach ($response->data as $key => $value) {
         $xml->startElement($key);
         $this->createXML($xml, $value);
         $xml->endElement();
     }
     echo $xml->outputMemory(true);
 }
开发者ID:rday,项目名称:recess,代码行数:30,代码来源:XmlView.class.php

示例6: encode

 public function encode(array $data)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('api_answer');
     $this->write($xml, $data);
     $xml->endElement();
     return $xml->outputMemory(true);
 }
开发者ID:4otaku,项目名称:4otaku,代码行数:10,代码来源:xml.php

示例7: serializeData

 public function serializeData(DataContainer $data)
 {
     $xml = new \XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('root');
     $this->recursiveSerialize($xml, $data);
     $xml->endElement();
     $xml->endDocument();
     return $xml->outputMemory();
 }
开发者ID:skosm,项目名称:LaraShop,代码行数:11,代码来源:DataSerializerXML.php

示例8: initialise

 private function initialise()
 {
     /* Setting XML header */
     @header("content-type: application/vnd.google-earth.kml+xml; charset=UTF-8");
     /* Initializing the XML Object */
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument('1.0', 'UTF-8');
     return $xml;
 }
开发者ID:Abbe98,项目名称:ODOK,代码行数:12,代码来源:FormatKml.php

示例9: criaXML

function criaXML($response)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('bvs');
    write($xml, $response);
    $xml->endElement();
    header("Content-Type:text/xml");
    echo $xml->outputMemory(true);
    die;
}
开发者ID:julianirr,项目名称:TrabalhoSD,代码行数:12,代码来源:retornoXML.php

示例10: arrayToXml

 /**
  * Converts a PHP array to XML (via XMLWriter)
  *
  * @param $array PHP Array
  * @return xml-string
  */
 public static function arrayToXml($array)
 {
     // initalize new XML Writer in memory
     $xml = new \XmlWriter();
     $xml->openMemory();
     // with <root> element as top level node
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('root');
     // add the $array data in between
     $this->writeArray($xml, $array);
     // close with </root>
     $xml->endElement();
     // dump memory
     return $xml->outputMemory(true);
 }
开发者ID:Clansuite,项目名称:Clansuite,代码行数:21,代码来源:Conversion.php

示例11: output_xml

 public static function output_xml($data, $version = '0.1', $root = 'root', $parameters = array(), $sItemName = 'item')
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement($root);
     $xml->setIndent(true);
     if (!empty($version)) {
         $xml->writeAttribute('version', $version);
     }
     foreach ($parameters as $paramk => $paramv) {
         $xml->writeAttribute($paramk, $paramv);
     }
     self::writexml($xml, $data, $sItemName);
     $xml->endElement();
     return $xml->outputMemory(true);
 }
开发者ID:catlabinteractive,项目名称:neuron,代码行数:17,代码来源:XML.php

示例12: outputSitemap

 public function outputSitemap(Kwf_Component_Data $page)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('urlset');
     $xml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     foreach (array_unique($this->_getSitemap($page)) as $url) {
         $xml->startElement('url');
         $xml->writeElement('loc', $url);
         $xml->endElement();
     }
     $xml->endElement();
     $xml->endDocument();
     header('Content-Type: text/xml; charset=utf-8');
     echo $xml->outputMemory(true);
     exit;
 }
开发者ID:nsams,项目名称:koala-framework,代码行数:18,代码来源:Sitemap.php

示例13: getXml

function getXml($results)
{
    $xml = new XmlWriter();
    $xml->openMemory();
    $xml->setIndent(true);
    // new
    $xml->setIndentString("    ");
    // new
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('root');
    write($xml, $results);
    $xml->endElement();
    $xml->endDocument();
    // new
    $data = $xml->outputMemory(true);
    //$file = file_put_contents(APPPATH . '../uploads/data.xml', $data);
    return $data;
}
开发者ID:heptanol,项目名称:Test-git,代码行数:18,代码来源:test.php

示例14: exportJournal

 function exportJournal()
 {
     $writer = new XmlWriter();
     $writer->openURI($this->outputFolder . "/journal.xml");
     $writer->startDocument('1.0', 'utf-8');
     $writer->startElement('journal');
     $writer->setIndent(true);
     $this->exportJournalConfig($writer);
     $this->exportAnnouncements($writer);
     $this->exportReviewForms($writer);
     $this->exportUsers($writer);
     $this->exportGroups($writer);
     $this->exportSections($writer);
     $this->exportIssues($writer);
     $this->exportArticles($writer);
     $writer->endElement();
     $writer->flush();
     return $this->outputFolder . "/journal.xml";
 }
开发者ID:ulsdevteam,项目名称:fullJournalTransfer,代码行数:19,代码来源:XMLAssembler.inc.php

示例15: outputXml

 function outputXml($results, $xsltPath)
 {
     /* Setting XML header */
     @header("content-type: text/xml; charset=UTF-8");
     /* Initializing the XML Object */
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument('1.0', 'UTF-8');
     if (isset($xsltPath)) {
         $xml->WritePi('xml-stylesheet', 'type="text/xsl" href="' . $xsltPath . '"');
     }
     $xml->startElement('callback');
     $xml->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $xml->writeAttribute('xsi:noNamespaceSchemaLocation', 'schema.xsd');
     /* Function that converts each array element to an XML node */
     function write(XMLWriter $xml, $data)
     {
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 if (is_numeric($key)) {
                     #The only time a numeric key would be used is if it labels an array with non-uniqe keys
                     write($xml, $value);
                     continue;
                 } else {
                     $xml->startElement($key);
                     write($xml, $value);
                     $xml->endElement();
                     continue;
                 }
             }
             $xml->writeElement($key, $value);
         }
     }
     /* Calls previously declared function, passing our results array as parameter */
     write($xml, $results);
     /* Closing last XML node */
     $xml->endElement();
     /* Printing the XML */
     echo $xml->outputMemory(true);
 }
开发者ID:Abbe98,项目名称:ODOK,代码行数:42,代码来源:Format.php


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