dom save element to string

sadeeshp

New Member
I am trying to put a XML object into an array but i get an emty array and i can't find out why.\[code\]<?php$string = '<?xml version="1.0" encoding="UTF-8"?> <confgs> # System Settings # ############################################################ ## Login Account Settings ADMIN_ID="<confg rang="0" soort="veld" name="config1" />" ADMIN_ID="<confg rang="1" soort="veld" name="config2" />" ADMIN_PASS="PKXUT1xxRoutIT" USER_ID="<confg rang="2" soort="veld" name="config3" />" USER_PASS="<confg rang="3" soort="optie" opties="opt1~opt2~opt3" name="config4" />" ## Time Adjust Settings TIME_ZONE="60" DST_ENABLE="Y" MAC_ADRES="<confg rang="4" soort="veld" name="config5" />" DST_START_MONTH="3" DST_START_ORDINAL_DAY="<stconfg rang="1" soort="veld" name="stanconf1" />" DST_START_ORDINAL_DAY="<confg rang="8" soort="optie" opties="deze~die~endit~optie~extra" name="kijkhetwerkt" />" DST_START_ORDINAL_DAY="5" DST_START_ORDINAL_DAY="<stconfg rang="2" soort="veld" name="stanconf2" />" DST_START_ORDINAL_DAY="<confg rang="5" soort="veld" name="config6" />" DST_START_ORDINAL_DAY="<confg rang="6" soort="optie" opties="dit~dat~bibobla" name="slelect" />" IETS_CONF_ORDINAL_CFG="<confg rang="7" soort="veld" name="ditveld" />" IETS_CONF_ORDINAL_CFG="<confg rang="9" soort="veld" name="hallo" />" </confgs> '; error_reporting(E_ALL ^ E_NOTICE); $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; $dom->loadXML($string); $confg = $dom->getElementsByTagName('confg'); $form = array(); $a = 0; foreach($confg as $configuratie){ $a++; $form[$a] = $dom->saveXML($configuratie); }print_r($form); ?>\[/code\]this is what I get:Array ( [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => )something is telling me that my code loops trough all the 10 elements so it has to be there how do i grab it?
 
Back
Top