Employ a dedicated XML library to write XML files

This commit is contained in:
2019-09-30 21:18:04 +02:00
committed by Stefan Rohde-Enslin
parent 52878fee92
commit 1eb21bfc54
5 changed files with 66 additions and 45 deletions

View File

@ -169,7 +169,7 @@ function generateHelpTooltip(string $identifier, string $title, string $explica,
function printDOMDocToXML(DOMDocument $xmlDoc) {
return '<?xml version="1.0" encoding="UTF-8"?>' . $xmlDoc->saveXML($xmlDoc->documentElement);
}
/**
@ -183,7 +183,15 @@ function printDOMDocToXML(DOMDocument $xmlDoc) {
*/
function createTextDomElement(DOMDocument $xmlDoc, string $tag, string $content):DOMElement {
$element = $xmlDoc->createElement($tag);
try {
$element = $xmlDoc->createElement($tag);
}
catch (DOMException $e) {
print_r($e);
print_r($tag);
exit;
}
$element->appendChild($xmlDoc->createTextNode($content));
return $element;