本文整理汇总了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;
}
}