Re: easy and simple way to read xml into array
| From: | Victor Spång Arthursson | Date: | Tue, 18 Nov 2003 12:09:58 +0000 |
| Subject: | Re: easy and simple way to read xml into array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170084@lists.php.net to get a copy of this message | ||
2003-11-17 kl. 17.06 skrev Chris Hayes:
Well, I've, and I also have to say that the XML-support in PHP lacks any usability… 2 pages code later I still cannot get it to work, and the manual is pretty thin on this chapter... For example, I've the following XML: <ingrediens> <ingrediensnummer>1234</ingrediensnummer> <maengde>3,4</maengde> <enhed>kg</enhed> </ingrediens> Here I thought that the startelementfunction should be called upon every start tag, the character_data_handler on every text string and the endelement function on every endelement. But what seems to happen is that the character data handler is called to randomly number of times, and if I output the current element every time it gets called I get the following output for the xml above: ingrediens ingrediens ingrediens ingrediensnummer ingrediensnummer ingrediensnummer ingrediensnummer maengde maengde maengde maengde enhed enhed enhed enhed enhed enhed What I expected to get was: ingrediensnummer maengde enhed So, couldnt anyone please bring some clarity into this matter? Sincerely VictorNeed to read a xml-file into an array, but searching around I havent found a way that's easy and simple… Arent there an easy way in PHP to accomplish this?have you been at http://se.php.net/xml ?