本文整理匯總了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);