views:

989

answers:

2

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?

A: 

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" => ...)
            )
         )
MrZombie
A: 

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.

shudson250