Re: SimpleXML->children() and text nodes

From: Date: Sun, 01 Feb 2004 09:57:38 +0000
Subject: Re: SimpleXML->children() and text nodes
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-7452@lists.php.net to get a copy of this message
Derick Rethans wrote: > Another thing that would be useful to have is a tag() method, so that > this would work too: (ie, I can check what tag I got during iteration). > > <?php > foreach ($sx->body->children() as $node) { > if ($node->tag() == 'element') { > /* do this */ > } > } > ?> > > or can I do that in a different way now? this works: foreach ($sxe->body as $node) { if (dom_import_simplexml($node)->tagName == 'element') { echo "element"; } } but i don't know how much overhead the conversion from simplexml to dom takes.. webwurst

« previous php.internals (#7452) next »