If you are familiar with the Zend Framework, pass the XML to Zend_Config_Xml
given xml like this
$myXml = ' <?xml version="1.0" ?> <top> <var>value</var> <nested> <var>value</var> </nested> <arrayVar> <item>1</item> <item>2</item> <item>3</item> </arrayVar> </top>';
You can access it this way:
$xml = new Zend_Config_Xml( $myXml ); $var = $xml->var; $nestedVar = $xml->nested->var; $arrayVar = $xml->arrayVar->toArray();
Zend Config XML uses simplexml and builds on this to create a nice interface that makes it easy to access the xml node you are looking for.
It loads more in the ZF manual, including ways to access attributes and some other really useful features.
http://framework.zend.com/manual/en/zend.config.adapters.xml.html
Zend Config is one of the easiest to use parts of ZF, and (I think) it is a standalone component, you can use only Zend Config and no other part of ZF
chim
source share