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


PHP XmlWriter::text方法代码示例

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


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

示例1: toXml

 public function toXml(XmlWriter $x)
 {
     $x->startElement('template');
     $x->text($this->_template);
     $x->endElement();
     $x->startElement('params');
     foreach ($this->getVars() as $k => $v) {
         $x->startElement('param');
         $x->writeAttribute('name', $k);
         $x->text($v);
         $x->endElement();
     }
     $x->endElement();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:14,代码来源:HtmlTemplate.php

示例2: writeValue

 public function writeValue($value)
 {
     if ($this->needsCdataWrapping($value)) {
         $this->cursor->writeCdata($value);
     } else {
         $this->cursor->text($value);
     }
 }
开发者ID:doctrine,项目名称:oxm,代码行数:8,代码来源:WriterHelper.php

示例3: toXml

 function toXml(XmlWriter $x, $writeEnvelope = true)
 {
     if ($writeEnvelope) {
         $x->startElement('http-request');
     }
     $x->startElement('method');
     $x->text($this->getMethod());
     $x->endElement();
     $x->startElement('url');
     $x->text($this->getUrl());
     $x->endElement();
     $x->startElement('headers');
     foreach ($this->getHeaders() as $k => $v) {
         $x->startElement('header');
         $x->writeAttribute('name', $k);
         $x->text($v);
         $x->endElement();
     }
     $x->endElement();
     $x->startElement('params');
     foreach ($this->getPostParams() as $k => $v) {
         $x->startElement('param');
         $x->writeAttribute('name', $k);
         $x->text($v);
         $x->endElement();
     }
     $x->endElement();
     if (!$this->getPostParams() && $this->getBody()) {
         $x->startElement('body');
         $x->writeCdata($this->getBody());
         $x->endElement();
     }
     if ($writeEnvelope) {
         $x->endElement();
     }
 }
开发者ID:irovast,项目名称:eyedock,代码行数:36,代码来源:HttpRequest.php

示例4: run

 private function run($value, $name = null)
 {
     $this->startJSONxElement($value, $name);
     if ($this->isObjectLike($value)) {
         foreach ($value as $k => $v) {
             $this->run($v, $k);
         }
     } else {
         if (is_array($value)) {
             foreach ($value as $x) {
                 $this->run($x);
             }
         } else {
             if (is_string($value) || is_numeric($value) || is_null($value)) {
                 $this->writer->text($value);
             } else {
                 if (is_bool($value)) {
                     $this->writer->text($value ? 'true' : 'false');
                 }
             }
         }
     }
     $this->endJSONxElement();
 }
开发者ID:danharper,项目名称:jsonx,代码行数:24,代码来源:ToJSONx.php

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

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

示例7: generateKeyAttribute

 /**
  * Generates a key attribute with $key as the value, if $key is not null
  *
  * @param \XmlWriter $writer
  * @param string|null $key
  */
 protected function generateKeyAttribute(\XmlWriter $writer, $key = null)
 {
     if ($key !== null) {
         $writer->startAttribute('key');
         $writer->text($key);
         $writer->endAttribute();
     }
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:14,代码来源:FieldTypeHashGenerator.php

示例8: buildXmlFromArray

 /**
  * Function builds OpenPayU Xml Document
  * @access public
  * @param string $data
  * @param string $rootElement
  * @param string $version
  * @param string $encoding
  * @param string $rootElementXsi
  * @return string $xml
  */
 public static function buildXmlFromArray($data, $rootElement, $version = '1.0', $encoding = 'UTF-8', $rootElementXsi = null)
 {
     if (!is_array($data)) {
         return null;
     }
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->startDocument($version, $encoding);
     $xml->startElementNS(null, 'OpenPayU', 'http://www.openpayu.com/20/openpayu.xsd');
     $xml->startElement($rootElement);
     if (!empty($rootElementXsi)) {
         $xml->startAttributeNs('xsi', 'type', 'http://www.w3.org/2001/XMLSchema-instance');
         $xml->text($rootElementXsi);
         $xml->endAttribute();
     }
     self::convertArrayToXml($xml, $data);
     $xml->endElement();
     $xml->endElement();
     $xml->endDocument();
     return trim($xml->outputMemory(true));
 }
开发者ID:eggman64,项目名称:plugin_magento,代码行数:32,代码来源:Util.php

示例9: index

 /**
  * Indexes the document $document using definition $definition
  *
  * @param ezcSearchDocumentDefinition $definition
  * @param mixed $document
  */
 public function index(ezcSearchDocumentDefinition $definition, $document)
 {
     $xml = new XmlWriter();
     $xml->openMemory();
     $xml->startElement('add');
     $xml->startElement('doc');
     $xml->startElement('field');
     $xml->writeAttribute('name', 'ezcsearch_type_s');
     $xml->text($definition->documentType);
     $xml->endElement();
     $xml->startElement('field');
     $xml->writeAttribute('name', 'id');
     $xml->text($document[$definition->idProperty]);
     $xml->endElement();
     foreach ($definition->fields as $field) {
         $value = $this->mapFieldValuesForIndex($field, $document[$field->field]);
         foreach ($value as $fieldValue) {
             $xml->startElement('field');
             $xml->writeAttribute('name', $this->mapFieldType($field->field, $field->type));
             $xml->text($fieldValue);
             $xml->endElement();
         }
     }
     $xml->endElement();
     $xml->endElement();
     $doc = $xml->outputMemory(true);
     $r = $this->sendRawPostCommand('update', array('wt' => 'json'), $doc);
     if ($this->inTransaction == 0) {
         $this->runCommit();
     }
 }
开发者ID:zetacomponents,项目名称:search,代码行数:37,代码来源:solr.php

示例10: createUpdates

 /**
  * Create document(s) update XML
  *
  * @param array $documents
  *
  * @return string
  */
 protected function createUpdates(array $documents)
 {
     $xml = new \XmlWriter();
     $xml->openMemory();
     $xml->startElement('add');
     foreach ($documents as $document) {
         $xml->startElement('doc');
         foreach ($document as $field) {
             foreach ((array) $this->fieldValueMapper->map($field) as $value) {
                 $xml->startElement('field');
                 $xml->writeAttribute('name', $this->nameGenerator->getTypedName($field->name, $field->type));
                 $xml->text($value);
                 $xml->endElement();
             }
         }
         $xml->endElement();
     }
     $xml->endElement();
     return $xml->outputMemory(true);
 }
开发者ID:CG77,项目名称:ezpublish-kernel,代码行数:27,代码来源:Native.php

示例11: _generateProperties

 /**
  * Generates the atom XML properties.
  * 
  * @param \XmlWriter $xmlw       The XML writer.
  * @param array      $properties The atom properties.
  * 
  * @return none
  */
 private function _generateProperties($xmlw, $properties)
 {
     foreach ($properties as $key => $value) {
         $content = key($value);
         $attributes = $value[$content];
         $xmlw->startElementNS($this->_dataServicesPrefix, $key, null);
         if (!is_null($attributes)) {
             foreach ($attributes as $attribute => $attributeValue) {
                 $xmlw->writeAttributeNS($this->_dataServicesMetadataPrefix, $attribute, null, $attributeValue);
             }
         }
         $xmlw->text($content);
         $xmlw->endElement();
     }
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:23,代码来源:AtomReaderWriter.php

示例12: toXml

 function toXml(XmlWriter $x)
 {
     $x->startElement('url');
     $x->startElement('method');
     $x->text($this->getMethod());
     $x->endElement();
     $x->startElement('scheme');
     $x->text($this->getScheme());
     $x->endElement();
     $x->startElement('base_url');
     $x->text($this->getBaseUrl(true));
     $x->endElement();
     $x->startElement('path_info');
     $x->text($this->getPathInfo());
     $x->endElement();
     $x->startElement('host');
     $x->text($this->getHttpHost());
     $x->endElement();
     $x->startElement('remote_addr');
     $x->text($this->getClientIp(false));
     $x->endElement();
     $x->endElement();
     $x->startElement('params');
     foreach ($this->getRequestOnlyParams() as $k => $v) {
         $x->startElement('param');
         $x->writeAttribute('name', $k);
         if (is_array($v) || is_object($v)) {
             $v = json_encode($v);
             $x->writeAttribute("serialized", "json");
             $x->writeCdata($v);
         } else {
             $x->text($v);
         }
         $x->endElement();
     }
     $x->endElement();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:37,代码来源:Request.php


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