You are here: XML parser class with reference to parent element « PHP Programming Language « IT news, forums, messages
XML parser class with reference to parent element

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация