Parsing XML in php4

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I did the parsing XML and it works on my computer (PHP5), but as usual
it doesn't on the clients server (PHP4) =)

can you look into it: - test file with this in


$doc = DOMDocument::loadHTML("playlist.xml");

$aSongID = array();
$aSongName = array();
$aSongPath = array();

$songs = $doc->getElementsByTagName("Song");

foreach($songs as $song){
array_push($aSongID, $song->getAttribute("ID"));
array_push($aSongName, $song->$song->nodeValue);
array_push($aSongPath, $song->getAttribute("URL"));



it just displays the blank page with no errors, so i can't figure out
what is it.

help needed...

Thanks, Alexander =\

Re: Parsing XML in php4

I guess you fixed it. IE & FF has content for me.

Re: Parsing XML in php4

PHP 5 uses the new Dom functions and PHP 4 uses old Dom Xml functions.
DOMDocument->getElementsByTagName() is valid with  PHP 5 and Dom
DomDocument->get_elements_by_tagname is used with PHP4 and the Dom Xml.

Either have your client upgrade to PHP 5 or you can load the Dom Xml
functions from the pecl and code that way.

Site Timeline