I have an array with some SimpleXMLElement Objects inside and now i need to get a well formed XML for Ajax interaction, how can i do?
This is the array:
Array (
[0] => SimpleXMLElement Object (
[count] => 2
[id] => 20
[user_id] => 2
[title] => Polo RL )
[1] => SimpleXMLElement Object (
[count] => 3
[id] => 19
[user_id] => 4
[title] => tshirt fitch )
[2] => SimpleXMLElement Object (
[count] => 2
[id] => 18
[user_id] => 2
[title] => Polo La Martina )
)
I would get this XML result:
<root>
<record>
<count>2</count>
<id>20</id>
<user_id>2</user_id>
<title>Polo RL</title>
</record>
<record>
<count>3</count>
<id>19</id>
<user_id>4</user_id>
<title>tshirt fitch</title>
</record>
<record>
<count>2</count>
<id>18</id>
<user_id>2</user_id>
<title>Polo La Martina</title>
</record>
</root>