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