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


PHP XMLWriter::startCdata方法代码示例

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


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

示例1: createElementData

 private function createElementData($strPageId, XMLWriter $objWriter)
 {
     $arrElements = class_module_pages_pageelement::getAllElementsOnPage($strPageId);
     foreach ($arrElements as $objOneElement) {
         $objWriter->startElement("element");
         //elements metadata
         $objWriter->startElement("metadata");
         $objWriter->startElement("systemid");
         $objWriter->text($objOneElement->getSystemid());
         $objWriter->endElement();
         $objWriter->startElement("placeholder");
         $objWriter->text($objOneElement->getStrPlaceholder());
         $objWriter->endElement();
         $objWriter->startElement("name");
         $objWriter->text($objOneElement->getStrName());
         $objWriter->endElement();
         $objWriter->startElement("element");
         $objWriter->text($objOneElement->getStrElement());
         $objWriter->endElement();
         $objWriter->startElement("title");
         $objWriter->text($objOneElement->getStrTitle(false));
         $objWriter->endElement();
         $objWriter->startElement("language");
         $objWriter->text($objOneElement->getStrLanguage());
         $objWriter->endElement();
         $objWriter->endElement();
         //the elements-content itself
         $objElement = $objOneElement->getConcreteAdminInstance();
         //Fetch the table
         $strElementTable = $objElement->getTable();
         $objWriter->startElement("foreignTable");
         $objWriter->startAttribute("table");
         $objWriter->text(uniStrReplace(_dbprefix_, "", $strElementTable));
         $objWriter->endAttribute();
         //content-row
         $arrContentRow = class_carrier::getInstance()->getObjDB()->getPRow("SELECT * FROM " . $strElementTable . " WHERE content_id = ? ", array($objOneElement->getSystemid()));
         $arrColumns = class_carrier::getInstance()->getObjDB()->getColumnsOfTable($strElementTable);
         foreach ($arrColumns as $arrOneCol) {
             $objWriter->startElement("column");
             $objWriter->startAttribute("name");
             $objWriter->text($arrOneCol["columnName"]);
             $objWriter->endAttribute();
             $objWriter->startCdata();
             $objWriter->text($arrContentRow[$arrOneCol["columnName"]]);
             $objWriter->endCdata();
             //column
             $objWriter->endElement();
         }
         //foreignTable
         $objWriter->endElement();
         //element
         $objWriter->endElement();
     }
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:54,代码来源:class_systemtask_pageexport.php

示例2: instruction

<?php

/* $Id$ */
/*
Libxml 2.6.24 and up adds a new line after a processing instruction (PI)
*/
$xw = new XMLWriter();
$xw->openMemory();
$xw->setIndent(TRUE);
$xw->startDocument("1.0", "UTF-8");
$xw->startElement('root');
$xw->writeAttribute('id', 'elem1');
$xw->startElement('elem1');
$xw->writeAttribute('attr1', 'first');
$xw->writeComment('start PI');
$xw->startElement('pi');
$xw->writePi('php', 'echo "hello world"; ');
$xw->endElement();
$xw->startElement('cdata');
$xw->startCdata();
$xw->text('<>&"');
$xw->endCdata();
$xw->endElement();
$xw->endElement();
$xw->endElement();
$xw->endDocument();
// Force to write and empty the buffer
$output = $xw->flush(true);
print $output;
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:29,代码来源:OO_009.php


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