We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

xml.php 500 Bytes
Newer Older
1 2 3 4 5
<?php
class XML {
    public static function prettyXML($xml) {
	$dom = new DOMDocument('1.0'); 
	$dom->preserveWhitespace = false;
6
	$dom->loadXML(utf8_encode($xml->asXML()));  
7 8 9 10 11 12 13 14 15
	$dom->formatOutput = true;
	return($dom->saveXML());
    } 

    public static function error($status, $errcode, $errtext) {
	$xml = new SimpleXMLElement("<lfm></lfm>");
	$xml->addAttribute("status", $status);
	$error = $xml->addChild("error", $errtext);
	$error->addAttribute("code", $errcode);
16
	return($xml);
17 18 19
    }
}
?>