note 43530 added to ref.xml

From: Date: Thu, 24 Jun 2004 15:55:52 +0000
Subject: note 43530 added to ref.xml
Groups: php.notes 
Request: Send a blank email to php-notes+get-71597@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/ref.xml.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43530 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43530&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43530&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71597) next »