note 43530 deleted from ref.xml by didou

From: Date: Thu, 03 Feb 2005 19:48:14 +0000
Subject: note 43530 deleted from ref.xml by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84466@lists.php.net to get a copy of this message
Note Submitter: nuncanada at xaraya dot com ---- I wanted something which would make it easy to parse SimpleXML, providing a structure which resembled Xquery. Probably we will be able to handle this much better with PHP 5's DOM extension, but till then here it is: It will take a input like: <moldb> <molecule> <name>Alanine</name> <symbol>ala</symbol> <code>A</code> <type>hydrophobic</type> </molecule> <molecule> <name>Lysine</name> <symbol>lys</symbol> <code>K</code> <type>charged</type> </molecule> </moldb> And consctruct the following array: array(12) { ["/"]=> array(1) { [0]=> string(5) "moldb" } ["/moldb"]=> array(2) { [0]=> string(11) "molecule[0]" [1]=> string(11) "molecule[1]" } ["/moldb/molecule[0]"]=> array(4) { [0]=> string(4) "name" [1]=> string(6) "symbol" [2]=> string(4) "code" [3]=> string(4) "type" } ["/moldb/molecule[0]/code"]=> string(1) "A" ["/moldb/molecule[0]/name"]=> string(7) "Alanine" ["/moldb/molecule[0]/symbol"]=> string(3) "ala" ["/moldb/molecule[0]/type"]=> string(11) "hydrophobic" ["/moldb/molecule[1]"]=> array(4) { [0]=> string(4) "name" [1]=> string(6) "symbol" [2]=> string(4) "code" [3]=> string(4) "type" } ["/moldb/molecule[1]/code"]=> string(1) "K" ["/moldb/molecule[1]/name"]=> string(6) "Lysine" ["/moldb/molecule[1]/symbol"]=> string(3) "lys" ["/moldb/molecule[1]/type"]=> string(7) "charged" } The code can be seen at: http://codedump.nutextonline.com/view/206

« previous php.notes (#84466) next »