RE: [PHP] XML: Similiar Multiple Tags With Different Data

From: Date: Mon, 13 May 2002 15:49:04 +0000
Subject: RE: [PHP] XML: Similiar Multiple Tags With Different Data
Groups: php.general 
Request: Send a blank email to php-general+get-97369@lists.php.net to get a copy of this message
I tried your suggestion already but It doesn't seem to work. I still can get it to be assigned to different parts of the array. Do you have any other suggestions? -----Original Message----- From: Kjartan Mannes [mailto:kjartan@drupal.org] Sent: Sunday, May 12, 2002 11:10 PM To: Sebastian A. Cc: PHP General List (PHP.NET) Subject: Re: [PHP] XML: Similiar Multiple Tags With Different Data Sunday, May 12, 2002, 6:39:31 PM, Sebastian A. wrote: > 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: Without the rest of the code I would suspect this to work: function elementContent($parser, $data, $attrs='') { global $tag, $p; $ti = sizeof( $tag ) - 1; if ( $tag[$ti] == 'LIST_ITEM' ) { $p->ART_ID[] = $data; } } Basically when you are assigning content to a new part of the array you don't use .= but just = -- Kjartan <kjartan@drupal.org> (http://natrak.net/) :: "A program is a spell cast over a computer, turning input into error messages." :: Drupal (www.drupal.org)

« previous php.general (#97369) next »