I've recently extended
DOMDocument using
Zend_Dom's components to help. I've added some features. However, for those familiar with prototype, they have some functions --
down being perhaps the most important for me at this stage.
I'm wanting to add a feature to
DOMDocument whereby I have a node in the node tree, and from that node I want to be able to query as in Prototype's
down function.
Ideally it would be like so:
php Code:
$pNode = $pCurrentNode->firstChild->query('div img.myImage');
Now, Zend Framework's extension of
DOMDocument allows you to pass a CSS or XPath query. However, the feature that it's missing is the ability to specify the node to select in. So if I pass in the current node as the DIV, then it'll execute the query based on that element and all its children, but not the entire document.
I am not sure how to do this. I could construct the CSS selector query myself by back-tracking through the tree node and finding parent after parent, but this seems like a terribly inefficient way of going about this task.
Does anybody have any idea? I even tried to get the
textContent member variable and set it as the HTML document, but this doesn't appear to help me.