An easy task:
First, load the external XML. For the sake of an example let's imagine the XML to be of this structure:
<contactData>
<contact firstName="John" lastName="Smith" phone="285-493-5421-793" email="[email protected]"/>
<contact firstName="Jane" lastName="Roberts" phone="285-493-5421-214" email="[email protected]"/>
</contactData>
Second, parse that XML. For that create a value object type of a class, let's call it ContactData. It might look something like this:
package
{
public class ContactData
{
public var firstName:String;
public var lastName:String;
public var email:String;
public var phone:String;
public var id:int; // always nice to store an ID
}
}
Loop through your XML - for every contact node create a ContactData class object and fill it the data from the XML.
Store an array with your ContactData objects somewhere, you'll need them later.
Third, edit the ContactData object, or even remove it from an array if you will. Adding is not a problem too.
Fourth and last, create a new xml with AS3 and loop through the ContactData object array to add contact nodes, then save the XML. Use File and FileStream classes to save the file on the hard drive or URLLoader to pass it to the server.
This is how a primitive XML creation code could look like:
var xml:XML = <contactData></contactData>;
for (var i:int = 0; i < contactDataArray.length; i++)
{
var cd:ContactData = contactDataArray[i];
xml.appendChild(<contact></contact>);
xml.contact[i].@firstName = cd.firstName;
xml.contact[i].@lastName = cd.lastName;
xml.contact[i].@phone = cd.phone;
xml.contact[i].@email = cd.email;
}
I hope it's helpful and easy to understand. Good luck!