Is what you are doing truly an array?  It actually seems like a collection of variables with names that are sequentially incremented.  A true array would use one variable to point at the array then reference each value in an iterative loop.

example:

var foo = new Array();
foo[0] = "bar";
foo[1] = "bah";
foo[2] = "blah";
...

The e4x operators can be used to assign variables to an in memory representation of XML that can later be referenced.  You can assign them using the "=" operator.  The syntax for iterating through the loop is:

function output(arr){
   len = arr.length;
   for(var i=0; i<len; i++){
     // here is where you can assign each value to an xml node;
   }

I have not tried this but I believe the syntax would be similar to this within the previous snippet:

 XMLDocument myDoc = new XMLDocument;
//set your root element
//set your child element
my.child[i]=foo[i]; // this should assign the value of foo[i] to your element[i] for the number of items in your array.

I have not tested this but I think you could figure it out from the examples at

Good luck.  If you cannot get this working, let me know and I can try it.  Of course, there are hundreds of others who are much more qualified that I at this.

Duane

"Speaking only for myself"



On 28-Sep-06, at 7:47 AM, richmcgillicuddy wrote:

I have an array that my user is editing in a data grid. I want to be
able to convert that back to an XML object. Is there a generic easy
way to do this. My array has objects that look like:

var myObject : ObjectProxy = new ObjectProxy();
myObject.f1 = 1;
myObject.f2 = 2;
myObject.f3 = 3;

I want to convert that (generically by determining at runtime, which
fields the object proxy has) to:

<Object>
  <f1>1</f1>
  <f2>2</f2>
  <f3>3</f3>
</Object>
<Object>
...

Is there a simple way to convert an array to an XML object or get an
XML string representation of an array without hard coding this for
each grid I'd want to do this for?


Rich






--
Flexcoders Mailing List
Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    (Yahoo! ID required)

<*> To change settings via email:

<*> To unsubscribe from this group, send an email to:

<*> Your use of Yahoo! Groups is subject to:




__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to