本文整理汇总了PHP中DomDocument::createCDataSection方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::createCDataSection方法的具体用法?PHP DomDocument::createCDataSection怎么用?PHP DomDocument::createCDataSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomDocument
的用法示例。
在下文中一共展示了DomDocument::createCDataSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: comastObservations
//.........这里部分代码省略.........
}
// add root fcga -> The header
$fcgaInfo = $dom->createElement('oal:observations');
$fcgaDom = $dom->appendChild($fcgaInfo);
$attr = $dom->createAttribute("version");
$fcgaInfo->appendChild($attr);
$attrText = $dom->createTextNode("2.0");
$attr->appendChild($attrText);
$attr = $dom->createAttribute("xmlns:oal");
$fcgaInfo->appendChild($attr);
$attrText = $dom->createTextNode("http://groups.google.com/group/openastronomylog");
$attr->appendChild($attrText);
$attr = $dom->createAttribute("xmlns:xsi");
$fcgaInfo->appendChild($attr);
$attrText = $dom->createTextNode("http://www.w3.org/2001/XMLSchema-instance");
$attr->appendChild($attrText);
$attr = $dom->createAttribute("xsi:schemaLocation");
$fcgaInfo->appendChild($attr);
$attrText = $dom->createTextNode("http://groups.google.com/group/openastronomylog oal21.xsd");
$attr->appendChild($attrText);
// add root - <observers>
$observersDom = $fcgaDom->appendChild($dom->createElement('observers'));
while (list($key, $value) = each($observers)) {
$observer2 = $dom->createElement('observer');
$observerChild = $observersDom->appendChild($observer2);
$attr = $dom->createAttribute("id");
$observer2->appendChild($attr);
$correctedValue = utf8_encode(html_entity_decode(preg_replace("/\\s+/", "_", $value)));
$attrText = $dom->createTextNode("usr_" . $correctedValue);
$attr->appendChild($attrText);
$name = $observerChild->appendChild($dom->createElement('name'));
$name->appendChild($dom->createCDATASection(utf8_encode(html_entity_decode($observer->getObserverProperty($value, 'firstname')))));
$surname = $observerChild->appendChild($dom->createElement('surname'));
$surname->appendChild($dom->createCDataSection($observer->getObserverProperty($value, 'name')));
$account = $observerChild->appendChild($dom->createElement('account'));
$account->appendChild($dom->createCDataSection(utf8_encode(html_entity_decode($value))));
$attr = $dom->createAttribute("name");
$account->appendChild($attr);
$attrText = $dom->createTextNode("www.deepskylog.org");
$attr->appendChild($attrText);
if ($observer->getObserverProperty($value, 'fstOffset') != 0.0) {
$fst = $observerChild->appendChild($dom->createElement('fstOffset'));
$fst->appendChild($dom->createTextNode($observer->getObserverProperty($value, 'fstOffset')));
}
}
// add root - <sites>
$observersDom = $fcgaDom->appendChild($dom->createElement('sites'));
while (list($key, $value) = each($sites)) {
$site2 = $dom->createElement('site');
$siteChild = $observersDom->appendChild($site2);
$attr = $dom->createAttribute("id");
$site2->appendChild($attr);
$attrText = $dom->createTextNode("site_" . $value);
$attr->appendChild($attrText);
$name = $siteChild->appendChild($dom->createElement('name'));
$name->appendChild($dom->createCDATASection(utf8_encode(html_entity_decode($location->getLocationPropertyFromId($value, 'name')))));
$longitude = $siteChild->appendChild($dom->createElement('longitude'));
$longitude->appendChild($dom->createTextNode($location->getLocationPropertyFromId($value, 'longitude')));
$attr = $dom->createAttribute("unit");
$longitude->appendChild($attr);
$attrText = $dom->createTextNode("deg");
$attr->appendChild($attrText);
$latitude = $siteChild->appendChild($dom->createElement('latitude'));
$latitude->appendChild($dom->createTextNode($location->getLocationPropertyFromId($value, 'latitude')));
$attr = $dom->createAttribute("unit");
$latitude->appendChild($attr);