Menu:

Sponsor

Discover Master of Alchemy, our first iPad/iPhone and iPod touch game!

Follow Me

 

Forum's topics

Latest Files

Archives

Top Rated

Categories

Photo Gallery


Alessandro Crugnola on December 2, 2003 in php

A PHP domxml class in flash style!


Last Day a friend of mine, Daniele, point my attention to an opensource project hosted on sourceforge that is very interesting for PHP/Flash guys :)
This module permit to do an xml parsing, in PHP, using a dom xml in the same way we already do in flash.

Here a little example i made using this class:

<?
// include the php module
include('lib.xml.inc.php');

// load an external xml source
$test = new XML('test.xml');

// make a simple parsing, in AS style ;)
$childs = $test->firstChild->childNodes;
for($a = 0; $a < count($childs); $a++){
echo "nodeName " . $childs[$a]->nodeName . "<br />";
echo "nodeValue " . $childs[$a]->firstChild->nodeValue . "<br />";
}
?>


as you can see, we're already familiar with firstChild, nodeName, nodeValue... etc..
I always hate the PHP SAX parser, and always always prefer a dom xml parser, much more simple to create and to read.

 

Bookmark and Share

 

Tags: dom , opensource , php , xml 

 

1 comments
Does the new XML really accept a local file name or must it be a url or uri?


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Type the characters you see in the picture above.





 

TrackBacks

TrackBack URL for this entry: http://www.sephiroth.it/cgi-bin/mt/mt-tb.cgi/178