PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: mariusht on June 03, 2009, 04:28:58



Title: Converting Array into XML in Proxy or in Command?
Post by: mariusht 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/blog/2009/04/30/converting-array-of-objects-into-hierarchical-xml-data/)
http://mariusht.com/files/blog/array_into_xml/demo/ArrayIntoXml.html (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.


Title: Re: Converting Array into XML in Proxy or in Command?
Post by: puremvc 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>