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


PHP XMLWriter::text方法代码示例

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


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

示例1: writeDiscountsInfo

 /**
  * Write discounts info to order
  * @param array $discount
  * @param XMLWriter $xml
  */
 public function writeDiscountsInfo(array $discounts, XMLWriter $xml)
 {
     foreach ($discounts as $rule => $total) {
         $salesRule = Mage::getModel('salesrule/rule')->load($rule);
         if (!$salesRule->getId()) {
             continue;
         }
         $xml->startElement('Item');
         $xml->startElement('SKU');
         $xml->writeCdata($salesRule->getCouponCode() ? $salesRule->getCouponCode() : 'AUTOMATIC_DISCOUNT');
         $xml->endElement();
         $xml->startElement('Name');
         $xml->writeCdata($salesRule->getName());
         $xml->endElement();
         $xml->startElement('Adjustment');
         $xml->writeCdata('true');
         $xml->endElement();
         $xml->startElement('Quantity');
         $xml->text(1);
         $xml->endElement();
         $xml->startElement('UnitPrice');
         $xml->text(-$total);
         $xml->endElement();
         $xml->endElement();
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:31,代码来源:Data.php

示例2: showResponse

 /**
  * @param array $params
  * @param string $message
  * @param int $code
  */
 private function showResponse(array $params, $message = '', $code = 0)
 {
     header("Content-type: text/xml; charset=utf-8");
     $writer = new XMLWriter();
     $writer->openURI('php://output');
     $writer->startDocument('1.0', 'UTF-8');
     $writer->startElement($params['action'] . 'Response');
     $writer->startAttribute('performedDatetime');
     $writer->text(date('c'));
     $writer->endAttribute();
     $writer->startAttribute('code');
     $writer->text($code);
     $writer->endAttribute();
     $writer->startAttribute('invoiceId');
     $writer->text($params['invoiceId']);
     $writer->endAttribute();
     $writer->startAttribute('message');
     $writer->text($message);
     $writer->endAttribute();
     $writer->startAttribute('shopId');
     $writer->text($params['shopId']);
     $writer->endAttribute();
     $writer->endElement();
     $writer->endDocument();
     Yii::app()->end();
 }
开发者ID:yupe,项目名称:yupe,代码行数:31,代码来源:YandexMoneyPaymentSystem.php

示例3: xml_list

 public static function xml_list()
 {
     $xw = new XMLWriter();
     $xw->openMemory();
     $xw->startDocument('1.0', 'UTF-8');
     $xw->startElement('Albums');
     $xw->setIndent(true);
     foreach (ORM::factory('Album')->with('genre')->order_by('artist')->order_by('name')->find_all()->as_array() as $album) {
         $xw->startElement('Album');
         $xw->startElement('ID');
         $xw->text($album->id);
         $xw->endElement();
         $xw->startElement('Artist');
         $xw->text($album->artist);
         $xw->endElement();
         $xw->startElement('Name');
         $xw->text($album->name);
         $xw->endElement();
         $xw->startElement('Genre');
         $xw->text($album->genre->name);
         $xw->endElement();
         $xw->endElement();
         // Album
     }
     $xw->endElement();
     // Albums
     $data = $xw->outputMemory(true);
     $xw->flush();
     unset($xw);
     return $data;
 }
开发者ID:andygoo,项目名称:kohana_demo,代码行数:31,代码来源:album.php

示例4: creaXml

 public function creaXml()
 {
     $writer = new XMLWriter();
     //$writer->setIndent(true);
     $csc = 1;
     $writer->openMemory();
     $writer->startDocument();
     $writer->startElement("ROOT");
     while (!$this->rs->EOF) {
         $writer->startElement("registro");
         $writer->startElement("CSC");
         $writer->text($csc);
         $writer->endElement();
         for ($x = 0; $x < $this->rs->FieldCount(); $x++) {
             $fld = $this->rs->FetchField($x);
             $writer->startElement(strtoupper($fld->name));
             $writer->text($this->rs->fields[strtoupper($fld->name)]);
             $writer->endElement();
         }
         $writer->endElement();
         $this->rs->MoveNext();
         $csc++;
     }
     $writer->endElement();
     $writer->endDocument();
     $algo = $writer->outputMemory(true);
     return $algo;
 }
开发者ID:kractos26,项目名称:orfeo,代码行数:28,代码来源:RecordSetToXml.class.php

示例5: _addNumber

 /**
  * add number
  * 
  * @param integer $_number
  * @param string $_type
  */
 protected function _addNumber($_number, $_type)
 {
     $this->_writer->startElement("number");
     $this->_writer->writeAttribute("type", $_type);
     $this->_writer->writeAttribute("quickdial", "");
     $this->_writer->writeAttribute("vanity", "");
     $this->_writer->writeAttribute("prio", "");
     $this->_writer->text($_number);
     $this->_writer->endElement();
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:FritzBox.php

示例6: GenerateXMLResponse

 public function GenerateXMLResponse($session_ID, $status_array, $q_access_array = NULL, $associative_array = NULL, $section_name = NULL, $subsection_name = NULL)
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', 'UTF-8');
     $xml->startElement("IMS_RESPONSE");
     $xml->startElement("SID");
     $xml->text($session_ID);
     $xml->endElement();
     $xml->startElement("STATUS");
     $xml->startElement("STATUS_CODE");
     $xml->text($status_array[0]);
     $xml->endElement();
     $xml->startElement("STATUS_MESSAGE");
     $xml->text($status_array[1]);
     $xml->endElement();
     if (count($status_array) == 3) {
         $xml->startElement("RUN_LEVEL");
         if ($status_array[2] == "1") {
             $xml->text("Edit Mode");
         } else {
             $xml->text("View Mode");
         }
         $xml->endElement();
     }
     $xml->endElement();
     if (!($q_access_array === NULL)) {
         $xml->startElement("QACCESS");
         foreach ($q_access_array as $key => $data) {
             $xml->startElement(str_replace(' ', '', $key));
             $xml->text(trim($data));
             $xml->endElement();
         }
         $xml->endElement();
     }
     if (!($associative_array === NULL)) {
         $xml->startElement($section_name);
         foreach ($associative_array as $array_entry) {
             $xml->startElement($subsection_name);
             foreach ($array_entry as $key => $data) {
                 $xml->startElement(str_replace(' ', '', $key));
                 $xml->text($data);
                 $xml->endElement();
             }
             $xml->endElement();
         }
         $xml->endElement();
     }
     $xml->endElement();
     header("Content-type: text/xml");
     echo $xml->outputMemory(true);
 }
开发者ID:AngryShrimp,项目名称:CME495_Design_IMS,代码行数:52,代码来源:IMSBase.php

示例7: 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:grlf,项目名称:eyedock,代码行数:14,代码来源:HtmlTemplate.php

示例8: write

 public function write(RestrictionInterface $restriction, \XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('video:restriction');
     $xmlWriter->writeAttribute('relationship', $restriction->relationship());
     $xmlWriter->text(implode(' ', $restriction->countryCodes()));
     $xmlWriter->endElement();
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:7,代码来源:RestrictionWriter.php

示例9: fromArray

 /**
  * Recursive function for processing nested arrays.
  *
  * @param array $array
  * @param null  $parentName name of parent node
  */
 protected function fromArray(array $array, $parentName = null)
 {
     foreach ($array as $name => $value) {
         if ($newName = $this->mapName($parentName)) {
             $this->xmlWriter->startElement($newName);
         } else {
             $this->xmlWriter->startElement($name);
         }
         if (is_array($value)) {
             $this->fromArray($value, $name);
         } elseif (!zbx_empty($value)) {
             $this->xmlWriter->text($value);
         }
         $this->xmlWriter->endElement();
     }
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:22,代码来源:CXmlExportWriter.php

示例10: write

 public function write(PlatformInterface $platform, \XMLWriter $xmlWriter)
 {
     $xmlWriter->startElement('video:platform');
     $xmlWriter->writeAttribute('relationship', $platform->relationship());
     $xmlWriter->text(implode(' ', $platform->types()));
     $xmlWriter->endElement();
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:7,代码来源:PlatformWriter.php

示例11: writeReaderImpl

 private function writeReaderImpl(XMLWriter $writer, XMLReader $reader)
 {
     switch ($reader->nodeType) {
         case XMLReader::ELEMENT:
             $writer->startElement($reader->name);
             if ($reader->moveToFirstAttribute()) {
                 do {
                     $writer->writeAttribute($reader->name, $reader->value);
                 } while ($reader->moveToNextAttribute());
                 $reader->moveToElement();
             }
             if ($reader->isEmptyElement) {
                 $writer->endElement();
             }
             break;
         case XMLReader::END_ELEMENT:
             $writer->endElement();
             break;
         case XMLReader::COMMENT:
             $writer->writeComment($reader->value);
             break;
         case XMLReader::SIGNIFICANT_WHITESPACE:
         case XMLReader::TEXT:
             $writer->text($reader->value);
             break;
         case XMLReader::PI:
             $writer->writePi($reader->name, $reader->value);
             break;
         default:
             XMLReaderNode::dump($reader);
     }
 }
开发者ID:hakre,项目名称:xmlreaderiterator,代码行数:32,代码来源:XMLWritingIteration.php

示例12: writeNodeAttributeValue

 /**
  * Function to create element with one attribute and value. 
  *  
  * @param string $node           Element name
  * @param string $attribute      Attribute name
  * @param string $attributeValue Attribute value
  * @param string $nodeValue      Element value
  *  
  * @return nothing
  */
 public function writeNodeAttributeValue($node, $attribute, $attributeValue, $nodeValue)
 {
     $this->xmlWriter->startElement($node);
     $this->xmlWriter->writeAttribute($attribute, $attributeValue);
     $this->xmlWriter->text($nodeValue);
     $this->xmlWriter->endElement();
 }
开发者ID:maxromanov,项目名称:odataphpprod,代码行数:17,代码来源:AtomODataWriter.php

示例13: generateFileReport

 /**
  * Generate a partial report for a single processed file.
  *
  * Function should return TRUE if it printed or stored data about the file
  * and FALSE if it ignored the file. Returning TRUE indicates that the file and
  * its data should be counted in the grand totals.
  *
  * @param array   $report      Prepared report data.
  * @param boolean $showSources Show sources?
  * @param int     $width       Maximum allowed line width.
  *
  * @return boolean
  */
 public function generateFileReport($report, $showSources = false, $width = 80)
 {
     $out = new XMLWriter();
     $out->openMemory();
     $out->setIndent(true);
     if ($report['errors'] === 0 && $report['warnings'] === 0) {
         // Nothing to print.
         return false;
     }
     $out->startElement('file');
     $out->writeAttribute('name', $report['filename']);
     $out->writeAttribute('errors', $report['errors']);
     $out->writeAttribute('warnings', $report['warnings']);
     foreach ($report['messages'] as $line => $lineErrors) {
         foreach ($lineErrors as $column => $colErrors) {
             foreach ($colErrors as $error) {
                 $error['type'] = strtolower($error['type']);
                 if (PHP_CODESNIFFER_ENCODING !== 'utf-8') {
                     $error['message'] = iconv(PHP_CODESNIFFER_ENCODING, 'utf-8', $error['message']);
                 }
                 $out->startElement($error['type']);
                 $out->writeAttribute('line', $line);
                 $out->writeAttribute('column', $column);
                 $out->writeAttribute('source', $error['source']);
                 $out->writeAttribute('severity', $error['severity']);
                 $out->text($error['message']);
                 $out->endElement();
             }
         }
     }
     //end foreach
     $out->endElement();
     echo $out->flush();
     return true;
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:48,代码来源:Xml.php

示例14: writeAttr

 /**
  * Write keys in $data prefixed with @ as XML attributes, if $data is an array.
  * When an @ prefixed key is found, a '%' key is expected to indicate the element itself,
  * and '#' prefixed key indicates CDATA content
  *
  * @param object $xml XMLWriter Object
  * @param array $data with attributes filtered out
  */
 protected function writeAttr(XMLWriter $xml, $data)
 {
     if (is_array($data)) {
         $nonAttributes = array();
         foreach ($data as $key => $val) {
             //handle an attribute with elements
             if ($key[0] == '@') {
                 $xml->writeAttribute(substr($key, 1), $val);
             } else {
                 if ($key[0] == '%') {
                     if (is_array($val)) {
                         $nonAttributes = $val;
                     } else {
                         $xml->text($val);
                     }
                 } elseif ($key[0] == '#') {
                     if (is_array($val)) {
                         $nonAttributes = $val;
                     } else {
                         $xml->startElement(substr($key, 1));
                         $xml->writeCData($val);
                         $xml->endElement();
                     }
                 } else {
                     $nonAttributes[$key] = $val;
                 }
             }
         }
         return $nonAttributes;
     } else {
         return $data;
     }
 }
开发者ID:alvin-ho,项目名称:wechat-custom-cms,代码行数:41,代码来源:ArrayToXML.php

示例15: to_html

 public function to_html($parent)
 {
     $w = new XMLWriter();
     $w->openMemory();
     $w->startElement('div');
     $w->writeAttribute('class', 'season');
     $w->startElement('div');
     $w->writeAttribute('class', 'season_name');
     $w->text("Saison " . $this->get_num());
     $w->endElement();
     $w->startElement('div');
     $w->writeAttribute('class', 'episode_container');
     $str = "";
     usort($this->episodes, 'wssub_cmp_num');
     foreach ($this->episodes as $ep) {
         if (!$ep->get_num()) {
             $this->log("Bad ep with no number: " . $ep->to_string(), 'warn');
             continue;
         }
         $str .= $ep->to_html($parent);
     }
     $w->writeRaw($str);
     $w->endElement();
     $w->endElement();
     return $w->flush();
 }
开发者ID:showi,项目名称:prog,代码行数:26,代码来源:wssubSeason.php


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