PATH:
usr
/
share
/
doc
/
cpanel-php81-xml-serializer-0.21.0
/
examples
<?PHP /** * XML Serializer example * * This example makes use of the CData sections option * * @author Stephan Schmidt <schst@php.net> */ error_reporting(E_ALL); require_once 'XML/Serializer.php'; $serializer = new XML_Serializer(); $serializer->setOption(XML_SERIALIZER_OPTION_INDENT, ' '); $serializer->setOption(XML_SERIALIZER_OPTION_DEFAULT_TAG, 'item'); $serializer->setOption(XML_SERIALIZER_OPTION_CDATA_SECTIONS, true); $data = array( 'foo' => 'This is some text...', 'bar' => '& even more text...', 'test' => array('Foo', 'Foo & bar') ); $result = $serializer->serialize($data); if( $result === true ) { $xml = $serializer->getSerializedData(); echo '<pre>'; echo htmlspecialchars($xml); echo '</pre>'; } else { $result->getMessage(); exit(); } ?>
[-] unserializeClassNames.php
[edit]
[-] serializeWithIndentedAttributes.php
[edit]
[-] example.xml
[edit]
[-] serializeRDF.php
[edit]
[-] unserializeRDF.php
[edit]
[-] serializeAndEncode.php
[edit]
[-] serializeWithDtd.php
[edit]
[+]
..
[-] Serializer_Bug7112.php
[edit]
[-] serializeSelectiveAttributes.php
[edit]
[-] unserializeWithTagMap.php
[edit]
[-] serializeNullProperties.php
[edit]
[-] serializeIndexedArray.php
[edit]
[-] unserializeWithTypeGuessing.php
[edit]
[-] serializeWithComment.php
[edit]
[-] serializeCData.php
[edit]
[-] unserializeWithAttributes.php
[edit]
[-] unserializeAnyXML.php
[edit]
[-] unserializeWhitespace.php
[edit]
[-] unserializeObject.php
[edit]
[-] serializeWithAttributes2.php
[edit]
[-] serializeWithAttributes.php
[edit]
[-] serializeObject.php
[edit]
[-] serializeWithTagMap.php
[edit]
[-] serializeAndReturn.php
[edit]
[-] serializeWithNamespace.php
[edit]
[-] serializeIndexedArrayWithContext.php
[edit]
[-] unserializeEncoded.php
[edit]
[-] unserializeEnum.php
[edit]