Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Converting Array into XML in Proxy or in Command?  (Read 8734 times)
mariusht
Full Member
***
Posts: 26


View Profile Email
« on: June 03, 2009, 04:28:58 »

Hi,
I am retrieving an array of objects(categories and subcategories) from MySQL database.
I want to convert this array into hierarchical xml data(please see demo).
 
http://mariusht.com/blog/2009/04/30/converting-array-of-objects-into-hierarchical-xml-data/
http://mariusht.com/files/blog/array_into_xml/demo/ArrayIntoXml.html

Can you tell me where i should put logic for above conversation? Should i do it in Proxy or maybe in Command?

Thank You,
Mariush T.
« Last Edit: June 03, 2009, 09:40:10 by mariusht » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: June 04, 2009, 01:48:29 »

I'd probably to it in a Proxy. But I'd probably break the problem down a bit by having a CategoryVO that holds its own xml representation, and has implicit getters/setters for label and id that write through to the xml it holds. It would also have a method for adding another CategoryVO as a child, and that would take the xml from the passed in CategoryVO and add it as a child. So each CategoryVO then has its own chunk of the XML tree. This allows you to use the XML or object form of the category when appropriate.

-=Cliff>
Logged
Pages: [1]
Print