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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to