/** * Formats SimpleXML. * * @return string XML */ public function formatXML() { $errRep = ini_get('error_reporting'); //-- DOMImplementation throws strict errors :( ini_set('error_reporting', 0); $dtd = $this->project->getDTD(JVERSION); if ($dtd) { $doctype = DOMImplementation::createDocumentType($dtd['type'], $dtd['public'], $dtd['uri']); $document = DOMImplementation::createDocument('', '', $doctype); } else { $this->setError('no DTD found for ' . JVERSION . ' - ' . $this->project->type); $document = DOMImplementation::createDocument(); } $domnode = dom_import_simplexml($this->manifest); $domnode = $document->importNode($domnode, true); $domnode = $document->appendChild($domnode); $document->encoding = 'utf-8'; $document->formatOutput = true; ini_set('error_reporting', $errRep); return $document->saveXML(); }