Source for file serializeWithIndentedAttributes.php
Documentation is available at serializeWithIndentedAttributes.php
* This example demonstrates, how XML_Serializer is able
* to serialize scalar values as an attribute instead of a nested tag.
* In this example tags with more than one attribute become
* multiline tags, as each attribute gets written to a
* separate line as 'indentAttributes' is set to '_auto'.
* @author Stephan Schmidt <schst@php.net>
require_once 'XML/Serializer.php';
"defaultTagName" => "unnamedItem",
"scalarAsAttributes" => true ,
"indentAttributes" => "_auto"
// this is just to get a nested object
$pearError = PEAR ::raiseError ('This is just an error object',123 );
$foo->value = "My value";
$foo->error = $pearError;
$xml = $serializer->getSerializedData ();
Documentation generated on Mon, 11 Mar 2019 15:41:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|