Re: [flexcoders] Conversion from Array to XML

2006-09-28 Thread DUANE NICKULL


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     // 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 elementmy.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 athttp://livedocs.macromedia.com/labs/as3preview/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=0118.htmlGood 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"Blog - http://technoracle.blogspot.comSite - http://www.nickull.netMy Music - http://www.mix2r.com/ 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 beable to convert that back to an XML object. Is there a generic easyway 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, whichfields the object proxy has) to:  1  2  3...Is there a simple way to convert an array to an XML object or get anXML string representation of an array without hard coding this foreach grid I'd want to do this for?Rich--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links<*> To visit your group on the web, go to:    http://groups.yahoo.com/group/flexcoders/<*> Your email settings:    Individual Email | Traditional<*> To change settings online go to:    http://groups.yahoo.com/group/flexcoders/join    (Yahoo! ID required)<*> To change settings via email:    mailto:[EMAIL PROTECTED]     mailto:[EMAIL PROTECTED]<*> To unsubscribe from this group, send an email to:    [EMAIL PROTECTED]<*> Your use of Yahoo! Groups is subject to:    http://docs.yahoo.com/info/terms/ 
__._,_.___





--
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 
   
 

  




__,_._,___


RE: [flexcoders] Conversion from Array to XML

2006-09-28 Thread Tracy Spratt












No one else responded so I’ll take a
shot.

 

For dynamic properties, like in an
mx:object, the for..in loop should return a reference to each property.  So
maybe something like:

 

Var sXML:String = “”

For (var prop in myObject)  {

    sXML += “<” + prop
+ “>” + myObject[prop] + “”;

}

sXML += “”

 

Tracy









From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of richmcgillicuddy
Sent: Thursday, September 28, 2006
10:47 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Conversion
from Array to XML



 







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:


1
2
3


...

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
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 
   
 

  




__,_._,___






[flexcoders] Conversion from Array to XML

2006-09-28 Thread richmcgillicuddy
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:


  1
  2
  3


...

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
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:[EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/