示例#1
0
 /**
  * toXml
  *
  * Outputs current builder to a XML string
  *
  * @return string
  */
 public function toXml($formatted = false)
 {
     if (true === $formatted) {
         $xml = $this->root->saveXml();
         $dom = new \DOMDocument('1.0');
         $dom->preserveWhiteSpace = false;
         $dom->formatOutput = true;
         $dom->loadXML($xml);
         return $dom->saveXML();
     }
     return $this->root->saveXml();
 }