當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XmlWriter::openMemory方法代碼示例

本文整理匯總了PHP中XmlWriter::openMemory方法的典型用法代碼示例。如果您正苦於以下問題:PHP XmlWriter::openMemory方法的具體用法?PHP XmlWriter::openMemory怎麽用?PHP XmlWriter::openMemory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XmlWriter的用法示例。


在下文中一共展示了XmlWriter::openMemory方法的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: __construct

 public function __construct()
 {
     parent::openMemory();
     //parent::startDocument(); // this hack avoids the output of the <?xml version="1.0" element
     parent::setIndent(true);
     parent::setIndentString('  ');
 }
開發者ID:rasismeiro,項目名稱:cintient,代碼行數:7,代碼來源:XmlDoc.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: unset

 function fill_muc_config_form(array $packet, array $fill_info)
 {
     $ret_val_xml = "";
     $header = $packet["iq"]["@"];
     $nested_conf = $packet["iq"]["#"];
     $fields = $nested_conf["query"]["0"]["#"]["x"]["0"]["#"];
     unset($fields["title"]);
     unset($fields["instructions"]);
     unset($nested_conf["query"]["0"]["#"]["x"]["0"]["#"]);
     $header["type"] = "set";
     $to = $header["from"];
     $header["from"] = $header["to"];
     $header["to"] = $to;
     $nested_conf["query"]["0"]["#"]["x"]["0"]["@"]["type"] = "submit";
     foreach ($fill_info as $var => $value) {
         if (!$this->set_field_value($fields["field"], $var, $value)) {
             return false;
         }
     }
     //		var_dump($packet);
     // Building response array
     $response = array("iq" => array("@" => $header, "#" => $nested_conf));
     $response["iq"]["#"]["query"]["0"]["#"]["x"]["0"]["#"] = $fields;
     //		var_dump($response);
     //		var_dump($header);
     //		var_dump($nested_conf);
     //		var_dump($fields);
     /***********************************
      ******** Generate the XML
      ***********************************/
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString(' ');
     // Starting roots (usualy we've got only 1 root for a pck).
     foreach ($response as $key => $value) {
         $xml->startElement($key);
         if (is_array($value)) {
             // Attributes
             if (is_array($value["@"])) {
                 foreach ($value["@"] as $attr => $attr_value) {
                     $xml->writeAttribute($attr, $attr_value);
                 }
             }
             // Nested elements
             if (is_array($value["#"])) {
                 $this->write($xml, $value["#"]);
             }
         }
         $xml->endElement();
         $ret_val_xml = $xml->outputMemory(true);
     }
     return $ret_val_xml;
     //		var_dump($packet);
     //		var_dump($fill_info);
 }
開發者ID:pombredanne,項目名稱:tuleap,代碼行數:56,代碼來源:PacketMng.php

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

示例8: __construct

 /**
  * @param \XmlWriter $xmlWriter
  * @param array      $writers   An array of instances implementing WriterRegistererInterface
  */
 public function __construct(\XmlWriter $xmlWriter = null, array $writers = [])
 {
     if ($xmlWriter === null) {
         $xmlWriter = new \XmlWriter();
         $xmlWriter->openMemory();
     }
     $this->xmlWriter = $xmlWriter;
     foreach ($writers as $writer) {
         $this->registerWriter($writer);
     }
 }
開發者ID:marcw,項目名稱:rss-writer,代碼行數:15,代碼來源:RssWriter.php

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

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

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

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

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

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

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


注:本文中的XmlWriter::openMemory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。