本文整理匯總了PHP中SimpleXMLElement::saveXml方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleXMLElement::saveXml方法的具體用法?PHP SimpleXMLElement::saveXml怎麽用?PHP SimpleXMLElement::saveXml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SimpleXMLElement
的用法示例。
在下文中一共展示了SimpleXMLElement::saveXml方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getResultsXml
public function getResultsXml()
{
$xml = new SimpleXMLElement('<stats/>');
$xml->clients = $this->_stats->clients;
$xml->domains = $this->_stats->domains;
$xml->mail_boxes = $this->_stats->mail_boxes;
$xml->databases = $this->_stats->databases;
return (string) $xml->saveXml();
}
示例2: setXml
/**
* Set XML
*
* @param SimpleXMLElement $xml OSM XML
*
* @return Services_OpenStreetMap_Comment
*/
public function setXml(SimpleXMLElement $xml)
{
$this->xml = $xml->saveXml();
$obj = $xml->xpath('//' . $this->getType());
$kids = array();
foreach ($obj[0]->children() as $child) {
$key = (string) $child->attributes()->k;
if ($key != '') {
$this->tags[$key] = (string) $child->attributes()->v;
}
$name = (string) $child->getName();
$kids[$name] = (string) $child;
}
$this->tags = $kids;
if (isset($kids['id'])) {
$this->setId($kids['id']);
}
$this->obj = $obj;
return $this;
}
示例3: setXml
/**
* Set XML.
*
* @param SimpleXMLElement $xml OSM XML
*
* @return Services_OpenStreetMap_Object
*/
public function setXml(SimpleXMLElement $xml)
{
$this->xml = $xml->saveXml();
$obj = $xml->xpath('//' . $this->getType());
foreach ($obj[0]->children() as $child) {
$key = (string) $child->attributes()->k;
if ($key != '') {
$this->tags[$key] = (string) $child->attributes()->v;
}
}
$this->obj = $obj;
return $this;
}
示例4: setXml
/**
* Set XML
*
* @param SimpleXMLElement $xml OSM XML
*
* @return Services_OpenStreetMap_Note
*/
public function setXml(SimpleXMLElement $xml)
{
$this->xml = $xml->saveXml();
$obj = $xml->xpath('//' . $this->getType());
$kids = array();
foreach ($obj[0]->children() as $child) {
$key = (string) $child->attributes()->k;
if ($key != '') {
$this->tags[$key] = (string) $child->attributes()->v;
}
$name = (string) $child->getName();
if ($name == 'comments') {
$comments = array();
foreach ($child->children() as $gchild) {
$comment = new Services_OpenStreetMap_Comment();
$comment->setXml($gchild);
$comments[] = $comment;
}
$kids[] = $comments;
} elseif ($name == 'id') {
$this->setId((double) $child);
}
}
$this->comments = new Services_OpenStreetMap_Comments($comments);
$this->tags = $kids;
$this->obj = $obj;
return $this;
}