本文整理匯總了PHP中SimpleXMLElement::AsXML方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleXMLElement::AsXML方法的具體用法?PHP SimpleXMLElement::AsXML怎麽用?PHP SimpleXMLElement::AsXML使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SimpleXMLElement
的用法示例。
在下文中一共展示了SimpleXMLElement::AsXML方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SimpleXMLElement
<?
require_once("../bootstrap.inc.php");
header("Content-type: application/xml; charset=utf-8");
//header("Content-type: text/plain; charset=utf-8");
$xml = new SimpleXMLElement("<"."?xml version='1.0' encoding='UTF-8'?"."><xnfo/>");
$prod = PouetProd::Spawn( $_GET["which"] );
$a = array(&$prod);
PouetCollectPlatforms( $a );
if (!$prod)
die($xml->AsXML());
$xml->addAttribute("standard","1.1");
$xml->addAttribute("version","1");
$xml->addAttribute("author","webmaster@pouet.net");
$xml->addAttribute("mode","partial");
$xml->addChild("demo");
$xml->demo->addAttribute("pouet_id",_html($prod->id));
$xml->demo->addChild("name",_html($prod->name));
foreach($prod->types as $v)
$xml->demo->addChild("category",ucfirst(_html($v)))->addAttribute("type",_html($v));
$s = new BM_Query();
$s->AddField("prodotherparty.party_compo");
$s->AddField("prodotherparty.party_place");
示例2: validateXMLCache
private function validateXMLCache(&$xml, $vofile = null)
{
if (is_null($vofile)) {
$vofile = $this->vofile;
}
$valid = true;
try {
$valid = simplexml_load_file($vofile);
} catch (Exception $e) {
$valid = false;
}
if ($valid === false) {
$xml = null;
} else {
$x = new SimpleXMLElement($xml);
$volist = $x->xpath('//VoDump');
if (count($volist) == 0 || count($volist) == 1 && strlen($x->AsXML()) <= 40) {
$xml = null;
}
}
if ($xml === null) {
error_log("Invalid XML cache when syncing VOs");
return false;
} else {
return true;
}
}