Rebuild XML data

Posted on 2004-10-10
Last Modified: 2010-04-03

I am reading a XML file into Flash.

Creating Arrays from the Data.

Then, I am modifying these arrays.

And then, I want to recreate the XML again which will be sent to a server side script to update the origional XML on the server.

Can anyone suggest how to i do this? I dont know how to recreate the XML after the Arrays have been modified.
Any suggestion is welcome.

Question by:ssdesign
  • 3
  • 2
LVL 27

Accepted Solution

negatyve earned 300 total points
Comment Utility
ok, follow me:

• create a new xml file, named "test.xml"
• write inside it:

<?xml version="1.0" encoding="UTF-8" ?>

• create a flash movie in the same folder
• test this code:

data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(success)
            // edit xml file
      } else {
            // xml file missing
            trace("XML FILE NOT FOUND");
function editXML(xml)
      // show source xml file in the output windo
      // create an empty array
      var temp_array = new Array();
      // select the items node sequence in the xml file
      var nodes = xml.firstChild.childNodes;
      for(var i = 0; i < nodes.length; i++){
            // push inside the array the numeric value of each item
      // show in the output window the filled array
      // add a value to each element (modify)
      for(var i = 0; i < temp_array.length; i++){
            temp_array[i] = temp_array[i] * 2;
      // show in the output window the modified array
      // create the new xml
      var new_xml = new XML('<?xml version="1.0" encoding="UTF-8" ?><data></data>');
      // add nodes
      for(var i = 0; i < temp_array.length; i++){
            // create the node
            var new_node = new_xml.createElement("item");
            // append inside it the corresponding array element as text
            // insert it in the new xml
      // trace the new xml

Author Comment

Comment Utility
ok thats looks quiet ok, i will need to try it.

I will get back soon with my feedback wether it worked or not.

Just need to try it with my application.
LVL 27

Expert Comment

Comment Utility
That's ok, take your time.. :)
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline


Author Comment

Comment Utility
I have not forgotten, give me just one more day. Ok?
LVL 27

Expert Comment

Comment Utility
>I have not forgotten, give me just one more day. Ok?

hehe, that's right, no worries...

Expert Comment

Comment Utility
i know this is closed and all but that was a great answer.  to the original poster: feel lucky :D  information like that can be (is) expensive and rare.

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now