本文整理汇总了PHP中XML::getXMLString方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::getXMLString方法的具体用法?PHP XML::getXMLString怎么用?PHP XML::getXMLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::getXMLString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLTitlesFormatted
/**
* Returns HTML-formatted RSS items
* @method getHTMLTitlesFormatted
* @returns string HTML-formatted RSS items
*/
function getHTMLTitlesFormatted()
{
$itemBranchesXML = new XML("ul");
reset($this->itemBranches);
foreach ($this->itemBranches as $newsItem) {
$itemXML = new XMLBranch("li");
$itemLinkXML = new XMLBranch("a");
$itemLinkXML->setTagContent($newsItem->getTagContent("item/title"));
$itemLinkXML->setTagAttribute("href", $newsItem->getTagContent("item/link"));
$itemXML->addXMLBranch($itemLinkXML);
$itemBranchesXML->addXMLBranch($itemXML);
}
return $itemBranchesXML->getXMLString();
}
示例2: getClassDocFromClass
//.........这里部分代码省略.........
$bodyXML->addXMLBranch($spanXML);
$bodyXML->addXMLBranch($ulXML);
} else {
$spanXML = new XMLBranch("span");
$spanXML->setTagAttribute("class", $infoKey);
$spanXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
$bodyXML->addXMLBranch($spanXML);
}
}
$hrXML = new XMLBranch("hr");
$bodyXML->addXMLBranch($hrXML);
$h2XML = new XMLBranch("h2");
$h2XML->setTagAttribute("class", "methodsTitle");
$h2XML->setTagContent("All Methods");
$bodyXML->addXMLBranch($h2XML);
$spanXML = new XMLBranch("span");
$spanXML->setTagAttribute("class", "methodList");
foreach ($objClass->methods as $methodName => $method) {
$aMethodXML = new XMLBranch("a");
$aMethodXML->setTagAttribute("href", "#" . $methodName);
$aMethodXML->setTagContent($methodName);
$brXML = new XMLBranch("br");
$spanXML->addXMLBranch($aMethodXML);
$spanXML->addXMLBranch($brXML);
}
$bodyXML->addXMLBranch($spanXML);
foreach ($objClass->methods as $methodName => $method) {
$hrXML = new XMLBranch("hr");
$bodyXML->addXMLBranch($hrXML);
$pMethodXML = new XMLBranch("p");
$aMethodXML = new XMLBranch("a");
$aMethodXML->setTagAttribute("name", $methodName);
$spanXMLName = new XMLBranch("span");
$spanXMLName->setTagAttribute("class", "methodName");
$spanXMLName->setTagContent($methodName);
$spanXMLArgs = new XMLBranch("span");
$tagContentArgs = " ( ";
if (is_array($method->params) && count($method->params) > 0) {
$paramCount = 0;
foreach ($method->params as $key => $value) {
if ($paramCount > 0) {
$tagContentArgs .= ", ";
}
$tagContentArgs .= $key;
$paramCount++;
}
}
$tagContentArgs .= " )";
$spanXMLArgs->setTagContent($tagContentArgs);
$aMethodXML->addXMLBranch($spanXMLName);
$aMethodXML->addXMLBranch($spanXMLArgs);
$pMethodXML->addXMLBranch($aMethodXML);
$bodyXML->addXMLBranch($pMethodXML);
unset($method->info["name"]);
foreach ($method->info as $infoKey => $infoValue) {
if (is_array($infoValue)) {
$pXML = new XMLBranch("p");
$pXML->setTagAttribute("class", $infoKey);
$pXML->setTagContent(ucfirst($infoKey) . ":");
$ulXML = new XMLBranch("ul");
$ulXML->setTagAttribute("class", $infoKey);
foreach ($infoValue as $value) {
$liXML = new XMLBranch("li");
$liXML->setTagContent($value);
$ulXML->addXMLBranch($liXML);
}
$bodyXML->addXMLBranch($pXML);
$bodyXML->addXMLBranch($ulXML);
} else {
$pXML = new XMLBranch("p");
$pXML->setTagAttribute("class", $infoKey);
$pXML->setTagContent(ucfirst($infoKey) . ": " . $infoValue);
$bodyXML->addXMLBranch($pXML);
}
}
if (is_array($method->params) && count($method->params) > 0) {
$pParamXML = new XMLBranch("p");
//$pParamXML->setTagAttribute("class", "param");
$paramTitleXML = new XMLBranch("span");
$paramTitleXML->setTagContent("Arguments:");
$pParamXML->addXMLBranch($paramTitleXML);
$paramListXML = new XMLBranch("ul");
foreach ($method->params as $key => $value) {
$paramItemXML = new XMLBranch("li");
$paramItemXML->setTagAttribute("class", "param");
$paramItemXML->setTagContent($key);
$paramListXML->addXMLBranch($paramItemXML);
}
$pParamXML->addXMLBranch($paramListXML);
$bodyXML->addXMLBranch($pParamXML);
}
}
// ---------------------- END ---------------------- //
$classDocXML->addXMLBranch($headXML);
$classDocXML->addXMLBranch($bodyXML);
return $classDocXML->getXMLString(0);
} else {
return false;
}
}