![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /usr/share/doc/cpanel-php83-xml-serializer/examples/ |
<?PHP /** * This example shows how to parse attributes from * XML tags. * * @author Stephan Schmidt <[email protected]> * @uses example.xml */ error_reporting(E_ALL); require_once 'XML/Unserializer.php'; $options = array( XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE => true, XML_UNSERIALIZER_OPTION_ATTRIBUTES_ARRAYKEY => false ); // be careful to always use the ampersand in front of the new operator $unserializer = &new XML_Unserializer($options); // userialize the document $status = $unserializer->unserialize('example.xml', true); if (PEAR::isError($status)) { echo 'Error: ' . $status->getMessage(); } else { $data = $unserializer->getUnserializedData(); echo '<pre>'; print_r($data); echo '</pre>'; } ?>