Hello,

I was wondering on how to iterate over the elements of <body> in
the following piece of XML:

<sx>
<body>
  <element>foo</element>
  bar
  <baz>foobar</baz>
</body>
</sx>

when I iterate over $s->body->children() I only get the <element/> and
the <baz/>. Shouldn't it also show the text nodes?

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?


regards,
Derick

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

Reply via email to