renderData as XML Issue

I have been using ColdBox for quite some time now, since Version 2.6. Recently, I have been doing a lot of work with RESTful services. All seems well, except for one minor frustration reported by clients regarding the way that the renderData as XML works.

If I pass an object into the renderData event method, which includes a structure, the XML tree wraps the structure keys in elements. This seems to be unnecessary as a structure is simply a list of key/value pairs. Is there any way to modify this behavior, other than modifying the toXML method?

Cheers!

Kevin S. Anderson
Sr. Software Engineer

Nevermind on this. I should have searched for this issue first. I found a reference to this issue at here, which basically explains that I would need to override the event.renderData() with a custom requestContextDecorator.

I’ll run down that road and see how that works out.

That was done as you can nest structures within arrays queries or other structs. What behavior woul you expect?

Sample data would be good. Maybe we can add a compiler setting

Hey, Luis:

My expectation would be that a struct named, say, “Person”, with three elements of “Firstname”, “Lastname”, and “Phone” would be listed as:

Luis

Majano

not:

Luis

Majano

The later seems unnecessary to me since a struct is simply key/values. Understandably, you could have complex data types as a struct element, and those would need to be expanded and iterated through. It isn’t a huge deal, just seems like an extra node that has to be parsed by the client.

image001.jpg

Hey, Luis:

My expectation would be that a struct named, say, “Person”, with three elements of “Firstname”, “Lastname”, and “Phone” would be listed as:

Luis

Majano

not:

Luis

Majano

The later seems unnecessary to me since a struct is simply key/values. Understandably, you could have complex data types as a struct element, and those would need to be expanded and iterated through. It isn’t a huge deal, just seems like an extra node that has to be parsed by the client.

Hey, Luis:

My expectation would be that a struct named, say, “Person”, with three elements of “Firstname”, “Lastname”, and “Phone” would be listed as:

Luis

Majano

not:

Luis

Majano

The later seems unnecessary to me since a struct is simply key/values. Understandably, you could have complex data types as a struct element, and those would need to be expanded and iterated through. It isn’t a huge deal, just seems like an extra node that has to be parsed by the client.

I would think nested structs would have a node name of the parent (ie: structVarName -> elementKeyName) like the example below. Does this make sense?

Obviously, this gets squirrelly with structs in an array, in which case I believe the renderer currently uses “items” as the node name, does it not?

image001.jpg

Yes, it gets complex very quick as it can indefinitely recurse. So I need a stable pattern

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

image001.jpg

Hi, Luis:

Let me think on this on a bit. I’ll run some tests. At this point, with my usage thus far, I haven’t seen anything that necessitates the node. It just seems extraneous, but I’ll validate that and send some sample as soon as I get a bit of time.

Thanks for looking at this and I’ll get more info to you.

Cheers!

Kevin S. Anderson

image001.jpg