Posted by grossespinne on 04/20/07 21:31
Hi guys!
I have been looking for a PHP5 class like SimpleXMLElement with the
additional feature of being able to reach the parent of its element
node.
For example consider the following example:
$xmlObject = simplexml_load_string(<<<END
<book>
<chapter id = "1"></chapter>
<chapter id = "2"></chapter>
</book>
END
);
function foo($xmlObject) {
// here I would like to be able to access book from element chapter
// for instance something like this:
// $parent = $xmlObject->getParent()
// or:
// $parent = $xmlObject->book
}
foo($xmlObject->chapter[0]);
I have already tried searching with Google and have already looked at
PHPClasses.org but I have not found anything. In spite of this I am
sure that a solution only I cannot find it.
Thanks in advance for your help
Andras
[Back to original message]
|