Adam's pretty much correct with his statements on this.

The children() method's real purpose is for using namespaces within the
document.
Without an argument, it retrieves child elements within the default
namespace, otherwise it will retrieve elements within the namespace passed
in. It also sets the namespace scope for the sxe object.

nsuri is considered to be the namespace uri in the following example:.

$children = $sxe->children("nsuri");
$myelement = $children[0]->myelement;

The call to $children[0]->mylement will retrieve the myelement child nodes
within the nsuri namespace (since $children is set to the nsuri scope).

The same pretty much hodls true for attributes() as well.

Rob


From: Adam Maccabee Trachtenberg


> On Sun, 1 Feb 2004, Derick Rethans wrote:
>
> > when I iterate over $s->body->children() I only get the <element/> and
> > the <baz/>. Shouldn't it also show the text nodes?

> The SimpleXML model prefers you to not mix element and text nodes
> side-by-side. You can, and it won't complain, but (IMHO) the theory is
> that an element should either contain other elements or a single text
> (or CDATA) node. This is a more "XML-centric" viewpoint towards data
> than an "HTML-centric" perspective. (Realize these are generalizations
> here about the nature of XML and HTML.)

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

Reply via email to