SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 372 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

To retrieve child
nodes we use the children() method. This method returns an array of nodes, each
of which is a JSimpleXMLElement object:
$children = $document->children();
What if there was a mixture of album and single nodes? A single node would be
essentially identical to the album node, except it would contain data specifically for
music released as single.
We could use the $children array and determine the type of each node
using the name() method. This is slightly cumbersome, and for larger XML files
rather intensive.
Luckily for us, the child nodes are categorized into types. These are accessible
through attributes that are named after the node type. So, in order to retrieve the
album nodes from the root node we would do this:
$albums =& $document->album;
Our next task is to process the $albums array. As we iterate over the array, we will
have to access the sub-nodes: name, artist, year, and tracks. We could use a similar
method to that we used in the above example. However, there is another way.


Pages:
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6