Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * 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()));
 }