A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearphp array to xml, using same array key names - page 1
User InfoPosts
php array to xml, using same array key names#1
We are using pear(s xml serializer to turn our request arrays into XML to submit to other servers for an XML response.

The problem is, for one of the attributes we will need to submit an XML similar to this

<totalRooms>
<Room>
...
</Room>
<Room>
...
</Room>
</totalRooms>


How do we compile this in PHP arrays so the Serializer produces the correct XML?

ie, we need:

Array("totalRooms" =>

Array("Room" => ...)

Array("Room" => ...)

)

Currently will not work because of the shared Key names "Room" end up overwriting each other... is there any other method?

posted date: 2009-04-06 13:30:00


Re: php array to xml, using same array key names#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-06 13:30:01


Re: php array to xml, using same array key names#3
what serializer are you using?

posted date: 2009-04-06 13:34:00


Re: php array to xml, using same array key names#4
php-pear serializer version 0.19.2

posted date: 2009-04-06 14:12:00


Re: php array to xml, using same array key names#5
Just making a guess, here, but from what I read from the doc, if you only have "room" unnamed and no further unnamed inner lists.Would work and be serialized okay as long as you set the defaultTagName option using$serializer->setOption("defaultTagName", (Room();That being done, the following would serialize array("totalRooms" => array( array("Room" => ...), array("Room" => ...), array("Room" => ...) ) )

posted date: 2009-04-06 16:15:00


Re: php array to xml, using same array key names#6
We(ve taken this job from the server and given it to Flash (client-side platform), making the problem much easier to handle.Thank you Mr.Zombie for your response.

posted date: 2009-04-09 13:43:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.