For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > August 2004 > Re: [PEAR] XML_Serializer: adding attributes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] XML_Serializer: adding attributes
Aaron

2004-08-26, 8:56 am

Charles Gebhard wrote:

> 'attributesArray' // all values in this key will be treated as attributes


see the serializeWithAttributes2 example

$options = array(
"indent" => " ",
"linebreak" => "\n",
"rootName" => "books",
"scalarAsAttributes" => false,
"attributesArray" => '_attributes',
"contentName" => '_content'
);

$data = array(
'book' => array(
'author' => array(
'_attributes' => array( 'id' => '455', 'lang' => 'en' ),
'_content' => 'Jim'),
'title' => array(
'_attributes' => array( 'alt' => 'more stuff' ),
'_content' => 'stuff')
)
);



>
> thanks for any help.
>
> -chuck
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com