Source for file unserializeAnyXML.php
Documentation is available at unserializeAnyXML.php
* This example shows different methods how
* XML_Unserializer can be used to create data structures
* @author Stephan Schmidt <schst@php.net>
// this is a simple XML document
' <user handle="schst">Stephan Schmidt</user>' .
' <user handle="mj">Martin Jansen</user>' .
' <group name="qa">PEAR QA Team</group>' .
' <foo id="test">This is handled by the default keyAttribute</foo>' .
' <foo id="test2">Another foo tag</foo>' .
require_once 'XML/Unserializer.php';
// complex structures are arrays, the key is the attribute 'handle' or 'name', if handle is not present
// be careful to always use the ampersand in front of the new operator
// userialize the document
if (PEAR ::isError ($status)) {
echo 'Error: ' . $status->getMessage ();
$data = $unserializer->getUnserializedData ();
// unserialize it again and change the complexType option
// but leave other options untouched
// now complex types will be an object, and the property name will be in the
if (PEAR ::isError ($status)) {
echo 'Error: ' . $status->getMessage ();
$data = $unserializer->getUnserializedData ();
// unserialize it again and change the complexType option
// and reset all other options
// Now, there's no key so the tags are stored in an array
if (PEAR ::isError ($status)) {
echo 'Error: ' . $status->getMessage ();
$data = $unserializer->getUnserializedData ();
Documentation generated on Mon, 11 Mar 2019 15:41:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|