Some code cleaning, changes to the xml generation

This commit is contained in:
Michael Vogel 2016-03-13 07:10:24 +01:00 committed by Roland Haeder
parent c9100e1102
commit 3e299aa7bf
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
2 changed files with 114 additions and 79 deletions

View file

@ -4,7 +4,7 @@
*
*/
class xml {
function from_array($array, &$xml) {
function from_array($array, &$xml, $remove_header = false) {
if (!is_object($xml)) {
foreach($array as $key => $value) {
@ -14,7 +14,13 @@ class xml {
$dom = dom_import_simplexml($root)->ownerDocument;
$dom->formatOutput = true;
$xml = $dom;
return $dom->saveXML();
$xml_text = $dom->saveXML();
if ($remove_header)
$xml_text = trim(substr($xml_text, 21));
return $xml_text;
}
}