本文整理汇总了PHP中XMLWriter::endCdata方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter::endCdata方法的具体用法?PHP XMLWriter::endCdata怎么用?PHP XMLWriter::endCdata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLWriter
的用法示例。
在下文中一共展示了XMLWriter::endCdata方法的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();
}
}
示例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;