Re: Quickie: Why doesn't can't I get a value from this array?

From: Date: Tue, 09 Jan 2001 13:48:12 +0000
Subject: Re: Quickie: Why doesn't can't I get a value from this array?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-33433@lists.php.net to get a copy of this message
Oh, oops, figured it out with help from someone on the list. I had forgotten about case-folding, I needed to be trying R:RESOURCE, not r:resource. ----- Original Message ----- From: Hsieh, Wen-Yang <wh033@csufresno.edu> To: April <april@farstrider.org>; <php-general@lists.php.net> Sent: Tuesday, January 09, 2001 2:42 AM Subject: Re: [PHP] Quickie: Why doesn't can't I get a value from this array? > > ----- Original Message ----- > From: "April" <april@farstrider.org> > To: <php-general@lists.php.net> > Sent: Monday, January 08, 2001 12:36 PM > Subject: [PHP] Quickie: Why doesn't can't I get a value from this array? > > > > Hi, I'm using PHP to process some XML, and I can't figure out how to > access > > the attributes of the tag. Yeah, yeah, it's not brain surgery or > anything, > > but there's a reason I'm not a brain surgeon. > > > > from documentation: > > The third parameter, attribs, contains an associative array with the > > element's attributes (if any). The keys of this array are the attribute > > names, the values are the attribute values. Attribute names are > case-folded > > on the same criteria as element names. Attribute values are not > case-folded. > > > > my code snippet: > > > > function startElementHandler($parser, $name, $attribs) { > > if ($name == "NARROW") { > > echo("<br><br>A narrow.<br>"); > > $array_element = $attribs["r:resource"]; > > echo("r:resource of a narrow: $array_element <br><br>"); > > } > > } > > > > and the xml looks like this: > > > > <Topic r:id="Top"> > > <tag catid="1"/> > > <d:Title>Top</d:Title> > > <narrow r:resource="Top/Arts"/> > > <narrow r:resource="Top/Business"/> > > </Topic> > > > > > > My error code looks like: > > Warning: Undefined index: r:resource in > > c:\apache\htdocs\searchengine\categories.php on line 26 > > (over and over again, of course) > > > > But, count($attribs) returns 1. > > key($attribs) returns ? > > > > > Anyway, any help would be greatly appreciated. > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > >

« previous php.general (#33433) next »