/usr/share/doc/cpanel-php84-xml-serializer/examples
NameSizeModeActions
example.xml820644editdlrm
serializeAndEncode.php14500644editdlrm
serializeAndReturn.php6090644editdlrm
serializeCData.php8380644editdlrm
serializeIndexedArray.php25480644editdlrm
serializeIndexedArrayWithContext.php10390644editdlrm
serializeNullProperties.php13710644editdlrm
serializeObject.php13250644editdlrm
serializeRDF.php30920644editdlrm
Serializer_Bug7112.php7240644editdlrm
serializeSelectiveAttributes.php16410644editdlrm
serializeWithAttributes.php11910644editdlrm
serializeWithAttributes2.php13620644editdlrm
serializeWithComment.php9740644editdlrm
serializeWithDtd.php9250644editdlrm
serializeWithIndentedAttributes.php14690644editdlrm
serializeWithNamespace.php10720644editdlrm
serializeWithTagMap.php27660644editdlrm
unserializeAnyXML.php26090644editdlrm
unserializeClassNames.php12220644editdlrm
unserializeEncoded.php9490644editdlrm
unserializeEnum.php11870644editdlrm
unserializeObject.php14720644editdlrm
unserializeRDF.php21300644editdlrm
unserializeWhitespace.php11120644editdlrm
unserializeWithAttributes.php7960644editdlrm
unserializeWithTagMap.php16610644editdlrm
unserializeWithTypeGuessing.php9500644editdlrm
Edit: /usr/share/doc/cpanel-php84-xml-serializer/examples/unserializeAnyXML.php (2609B)
*/ error_reporting(E_ALL); // this is a simple XML document $xml = '' . ' Stephan Schmidt' . ' Martin Jansen' . ' PEAR QA Team' . ' This is handled by the default keyAttribute' . ' Another foo tag' . ''; require_once 'XML/Unserializer.php'; // complex structures are arrays, the key is the attribute 'handle' or 'name', if handle is not present $options = array( XML_UNSERIALIZER_OPTION_COMPLEXTYPE => 'array', XML_UNSERIALIZER_OPTION_ATTRIBUTE_KEY => array( 'user' => 'handle', 'group' => 'name', '#default' => 'id' ) ); // be careful to always use the ampersand in front of the new operator $unserializer = &new XML_Unserializer($options); // userialize the document $status = $unserializer->unserialize($xml, false); if (PEAR::isError($status)) { echo 'Error: ' . $status->getMessage(); } else { $data = $unserializer->getUnserializedData(); echo '
';
    print_r($data);
    echo '
'; } // 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 // attribute 'handle' $status = $unserializer->unserialize($xml, false, array(XML_UNSERIALIZER_OPTION_COMPLEXTYPE => 'object')); if (PEAR::isError($status)) { echo 'Error: ' . $status->getMessage(); } else { $data = $unserializer->getUnserializedData(); echo '
';
    print_r($data);
    echo '
'; } // 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 $status = $unserializer->unserialize($xml, false, array(XML_UNSERIALIZER_OPTION_OVERRIDE_OPTIONS => true, XML_UNSERIALIZER_OPTION_COMPLEXTYPE => 'object')); if (PEAR::isError($status)) { echo 'Error: ' . $status->getMessage(); } else { $data = $unserializer->getUnserializedData(); echo '
';
    print_r($data);
    echo '
'; } ?>