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


PHP XmlWriter::setIndent方法代码示例

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


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

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

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

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

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

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

示例11: executeXml

 public function executeXml(AgaviRequestDataHolder $request_data)
 {
     $report = $this->prepareReport($request_data);
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement('application');
     $xml->writeAttribute('name', $report['application']);
     $xml->startElement('status');
     $xml->text($report['status']);
     $xml->endElement();
     $connections = $report['connections'];
     $xml->startElement('connections');
     foreach ($connections['stats'] as $name => $value) {
         $xml->writeAttribute($name, $value);
     }
     $xml->writeElement('status', $connections['status']);
     $xml->startElement('stats');
     foreach ($connections['stats'] as $name => $value) {
         $xml->writeElement($name, $value);
     }
     $xml->endElement();
     // connections/stats
     foreach ($connections['details'] as $name => $value) {
         $xml->startElement('connection');
         $xml->writeAttribute('name', $name);
         if (is_array($value)) {
             $this->array2xml($value, $xml);
         } else {
             $xml->writeCData((string) $value);
         }
         $xml->endElement();
     }
     $xml->endElement();
     // connections
     $xml->endElement();
     // application
     $xml->endDocument();
     return $xml->outputMemory();
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:41,代码来源:StatusSuccessView.class.php

示例12: render

 public function render($response, $viewModel)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->setIndent(true);
     $data = $viewModel->toArray();
     $rootNode = $viewModel->getRootNodeName();
     if (!$rootNode) {
         $rootNode = key($data);
         $data = $data[$rootNode];
     }
     if (is_array($data)) {
         $xml->startElement($rootNode);
         $this->write($xml, $data);
         $xml->endElement();
     } else {
         $xml->writeElement($rootNode, utf8_encode($data));
     }
     $response->headers->set('Content-Type', 'application/xml;charset=utf-8');
     $response->setContent($xml->outputMemory(true));
 }
开发者ID:erpk,项目名称:harserver,代码行数:22,代码来源:XML.php

示例13: buildXML

 /**
  * Build an XML Data Set
  *
  * @param array $data
  *        	Associative Array containing values to be parsed into an XML Data Set(s)
  * @param string $startElement
  *        	Root Opening Tag, default data
  * @return string XML String containig values
  * @return mixed Boolean false on failure, string XML result on success
  */
 public function buildXML($data, $startElement = 'data')
 {
     if (!is_array($data)) {
         $err = 'Invalid variable type supplied, expected array not found on line ' . __LINE__ . " in Class: " . __CLASS__ . " Method: " . __METHOD__;
         trigger_error($err);
         // if($this->_debug) echo $err;
         return false;
         // return false error occurred
     }
     $xml = new \XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     if ($this->version || $this->encoding) {
         $xml->startDocument($this->version, $this->encoding);
     }
     $xml->startElement($startElement);
     $this->writeEl($xml, $data);
     $xml->endElement();
     // write end element
     // returns the XML results
     return $xml->outputMemory(true);
 }
开发者ID:micoli,项目名称:qd_utils,代码行数:33,代码来源:Array2XML.php

示例14: html

 public function html($mysqli_stmt)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $xml->startElement('table');
     $xml->writeAttribute('class', $this->tbl_class);
     $xml->startElement('thead');
     $xml->startElement('tr');
     //////////////////////////////////
     // Column Headers
     /////////////////////////////////
     $cntcol = count($this->col_classes);
     $altcol = 0;
     foreach (array_keys($this->cols) as $th) {
         $xml->startElement('th');
         $xml->writeAttribute('scope', 'col');
         if ($this->col_classes[$altcol] != "") {
             $xml->writeAttribute('class', $this->col_classes[$altcol]);
         }
         $altcol = ++$altcol % $cntcol;
         if (substr($th, 0, 2) == "__") {
             $xml->text('');
         } else {
             //Sorting
             $dir = "A";
             if (isset($_GET["sn"]) && $_GET["sn"] == $th && $_GET["sd"] == "A") {
                 $dir = "D";
             }
             $xml->startElement('a');
             $xml->startAttribute('href');
             $xml->writeRaw(quickgrid::get_href(["sn" => $th, "sd" => $dir, "p" => 1]));
             $xml->endAttribute();
             $xml->text($th);
             $xml->endElement();
             //a
         }
         $xml->endElement();
         //th
     }
     $xml->endElement();
     //tr
     $xml->endElement();
     //thead
     $xml->startElement('tfoot');
     $xml->startElement('tr');
     $xml->startElement('td');
     $xml->writeAttribute('colspan', count($this->cols));
     //////////////////////////////////
     // Pager
     /////////////////////////////////
     $last = ceil($this->row_count / $this->per_page);
     $length = 8;
     $lbound = $this->cur_page - $length / 2;
     $ubound = $this->cur_page + $length / 2;
     if ($lbound < 1) {
         $lbound = 1;
     }
     if ($ubound > $last) {
         $ubound = $last;
     }
     if ($this->cur_page != 1) {
         $xml->startElement('a');
         $xml->startAttribute('href');
         $xml->writeRaw(quickgrid::get_href(["p" => $this->cur_page - 1]));
         $xml->endAttribute();
         $xml->text("<");
         $xml->endElement();
         //a
     }
     for ($i = $lbound; $i <= $ubound; $i++) {
         if ($i != $this->cur_page) {
             $xml->startElement('a');
             $xml->startAttribute('href');
             $xml->writeRaw(quickgrid::get_href(["p" => $i]));
             $xml->endAttribute();
             $xml->text("{$i}");
             $xml->endElement();
             //a
         } else {
             $xml->startElement('span');
             $xml->text("{$i}");
             $xml->endElement();
             //span
         }
     }
     if ($this->cur_page != $last) {
         $xml->startElement('a');
         $xml->startAttribute('href');
         $xml->writeRaw(quickgrid::get_href(["p" => $this->cur_page + 1]));
         $xml->endAttribute();
         $xml->text(">");
         $xml->endElement();
         //a
     }
     $xml->endElement();
     //td
     $xml->endElement();
     //tr
//.........这里部分代码省略.........
开发者ID:jclifford0251,项目名称:quickphp,代码行数:101,代码来源:quickgrid.php

示例15: init

 protected function init()
 {
     if (!$this->inited) {
         if (!$this->outputFilepath) {
             throw new \Exception('outputFilepath option is not valid');
         }
         $writer = new \XmlWriter();
         $writer->openUri('file://' . rawurlencode($this->outputFilepath));
         $writer->setIndent(true);
         $writer->startDocument('1.0', 'utf-8');
         $writer->startElement('SERVER');
         $this->xmlWriter = $writer;
         $this->inited = true;
     }
 }
开发者ID:jancinert,项目名称:lnc-skrz.cz,代码行数:15,代码来源:Writer.php


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