— Shang Liang

Archive
October, 2009 Monthly archive

Data visualization for join the pact campaign. Click to view.

data_visualization_box2d

Read More

Messing around with Box2D. Quite fun.

box2d

Read More

Most of my Flash projects use XML as “database” and PHP is my preferred server script.  I found Simple_HTML_DOM Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is that the scripts written for PHP 4 are not compatible with PHP 5.

Simple HTML DOM Parser is designed for reading and editing HTML but it works fine with XML files, since XML files are more tidy than HTML. Reading and traversing the XML is easy, just use the find function.

$xml = file_get_html('http://www.google.com/');
foreach($xml->find('img') as $element)
       echo $element;

Writing a new node is not difficult either.

$node = str_get_html('<sample_node>Hello World</sample>');

Read More