コード例 #1
0
ファイル: XMLElement.php プロジェクト: mohiva/common
 /**
  * Return element as XML string.
  *
  * @return string The element as XML string.
  * @throws XMLException if the element isn't a child of a DOMDocument.
  */
 public function toXML()
 {
     if ($this->ownerDocument === null) {
         throw new XMLException('XMLElement has no owner document');
     }
     return $this->ownerDocument->saveXML($this);
 }
コード例 #2
0
ファイル: XMLDocumentTest.php プロジェクト: mohiva/common
 /**
  * Test if can create an empty document with a specified version and encoding.
  */
 public function testCreateDocumentWithVersionAndEncoding()
 {
     $doc = new XMLDocument('1.1', 'ISO-8859-1');
     $this->assertEquals('<?xml version="1.1" encoding="ISO-8859-1"?>', trim($doc->saveXML()));
 }