Anyway, here are two ways of doing this. I happen to think that the
first way is really ugly... but it works:
$test = '<?xml version="1.0"?>
<root>
<c1> 11</c1>
<c2> 222<c3>333</c3></c2>
</root>';
// Get rid of competing children
$qp = qp($test, 'c2');
$qp->branch()->children('c3')->remove();
print $qp->text();
// Get just the first DOMNode and fetch its text. We
// use contents() because it returns text nodes as
// well as elements.
print qp($test, 'c2')->contents()->get(0)->textContent;
This second example can be altered to get *all text in the immediate
element*, but none from the child elements:
$nodes = qp($test, 'c2')->contents()->get();
foreach ($nodes as $node) {
if ($node->nodeType == XML_TEXT_NODE) {
print $node->textContent;
}
}
Again, not pretty... but that's how to do it.
Matt
> --
> You received this message because you are subscribed to the Google Groups "support-querypath" group.
> To post to this group, send email to support-...@googlegroups.com.
> To unsubscribe from this group, send email to support-queryp...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/support-querypath?hl=en.
>
>