note 98523 added to simplexml.examples-basic

From: Date: Sun, 20 Jun 2010 21:38:58 +0000
Subject: note 98523 added to simplexml.examples-basic
Groups: php.notes 
Request: Send a blank email to php-notes+get-170336@lists.php.net to get a copy of this message
From the README file: SimpleXML is meant to be an easy way to access XML data. SimpleXML objects follow four basic rules: 1) properties denote element iterators 2) numeric indices denote elements 3) non numeric indices denote attributes 4) string conversion allows to access TEXT data When iterating properties then the extension always iterates over all nodes with that element name. Thus method children() must be called to iterate over subnodes. But also doing the following: foreach ($obj->node_name as $elem) { // do something with $elem } always results in iteration of 'node_name' elements. So no further check is needed to distinguish the number of nodes of that type. When an elements TEXT data is being accessed through a property then the result does not include the TEXT data of subelements. Known issues ============ Due to engine problems it is currently not possible to access a subelement by index 0: $object->property[0]. ---- Server IP: 69.147.83.197 Probable Submitter: 65.255.206.18 ---- Manual Page -- http://www.php.net/manual/en/simplexml.examples-basic.php Edit -- https://master.php.net/note/edit/98523 Del: integrated -- https://master.php.net/note/delete/98523/integrated Del: useless -- https://master.php.net/note/delete/98523/useless Del: bad code -- https://master.php.net/note/delete/98523/bad+code Del: spam -- https://master.php.net/note/delete/98523/spam Del: non-english -- https://master.php.net/note/delete/98523/non-english Del: in docs -- https://master.php.net/note/delete/98523/in+docs Del: other reasons-- https://master.php.net/note/delete/98523 Reject -- https://master.php.net/note/reject/98523 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170336) next »