note 96224 added to book.dom

From: Date: Tue, 16 Feb 2010 05:52:15 +0000
Subject: note 96224 added to book.dom
Groups: php.notes 
Request: Send a blank email to php-notes+get-165993@lists.php.net to get a copy of this message
xml notes: <tag one="one"/> <tag two="two"/> <tag three="three/> -tags can be read as arrays (their text nodes) BUT multiple attributes means accessing them one at a time. i.e.: <thing1 length="2" width="4" height="4/> thing1["length"] // thing1["width"] // thing1["height"]// -don't even think about this: thing1["length"]["width"]["height"]; // you have to do them one at a time. -it's for your own good. //something to look out for.. <thing1 length="2" width="4" height="4/> <thing1 length="3" width="4" height="4/> can't do this: thing1[0]["length"]; //so very wrong. -however foreach looping might solve it. ->psuedo code below. foreach ($thing1 as $a){ $a["length"] // $a["width"] // $a["height"]// } ----------------------------------------- last note: -analogy. //exhibit a: inefficiency with tags..-good for text storage- large chunks of raw data like news articles.. (char)$var="blue"; <var>blue</var> //exhibit b: efficient attribute implementation (good for data heavy filing (i.e.. like storing a multitude of values (think like exporting images and such)) $var2=array($one,$two,$three, $four=array($haha, $what_now=array($huh, $oh, $oops) ) ); <var2 one='' two='' three=''> <four haha=''> <what_now huh='' oh='' oops=''/> </four> </var2> -be smart with your attributes and make psuedo structures with them as opposed to riddling the doc with more text node tags than data :). ---- Server IP: 69.147.83.197 Probable Submitter: 66.177.227.205 ---- Manual Page -- http://www.php.net/manual/en/book.dom.php Edit -- https://master.php.net/note/edit/96224 Del: integrated -- https://master.php.net/note/delete/96224/integrated Del: useless -- https://master.php.net/note/delete/96224/useless Del: bad code -- https://master.php.net/note/delete/96224/bad+code Del: spam -- https://master.php.net/note/delete/96224/spam Del: non-english -- https://master.php.net/note/delete/96224/non-english Del: in docs -- https://master.php.net/note/delete/96224/in+docs Del: other reasons-- https://master.php.net/note/delete/96224 Reject -- https://master.php.net/note/reject/96224 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165993) next »