XML: Similiar Multiple Tags With Different Data

From: Date: Sun, 12 May 2002 16:39:31 +0000
Subject: XML: Similiar Multiple Tags With Different Data
Groups: php.general 
Request: Send a blank email to php-general+get-97223@lists.php.net to get a copy of this message
Hello I have recently been trying to parse an XML document that has different content in the same tags. Here is an example: <LIST_ITEM>1</LIST_ITEM> <LIST_ITEM>2</LIST_ITEM> <LIST_ITEM>3</LIST_ITEM> ... I am trying to get the content from <LIST_ITEM> into an array. I want the content of the first <LIST_ITEM> to go into $p->ART_ID[0] and the next to go into $p->ART_ID[1] and so on. Here is what my Element Content Function looks like: ------------------------------------------------------------- function elementContent($parser, $data, $attrs='') { global $tag, $data, $test; global $p; $ti = sizeof( $tag ) - 1; if ( $tag[$ti] == 'LIST_ITEM' ) { $p->ART_ID[] .= $data; } } ------------------------------------------------------------ When I type in echo $p->ART_ID[0] I should get 1 however I get 1 2 3. For some reason all the content goes only into one section of the array. Does anyone know how I can fix this? Thanks.

« previous php.general (#97223) next »