I have a load of XML files that I am in need for reformatting and because I have been working with Flash alot recently, I’m familiar with the XML tools and decided that it would be the best choice to reformat the files.
So, right now, I’m loading the files in using XML Objects and then just using a recursive loop to cycle through all the nodes and do what I need to. Now, is there any easy way that I can save the update data back into the same XML file I loaded it from? Since this isn’t going to be going into any sort of public use, it’s all being run directly from the Flash interface. Any suggestions on an easy way to do this?
Just so you have an idea of what I’m doing, here’s an example:
<root > <cm1 label="Company Name" assignedUsers="user1, user2"> <bf1 label="BCS" assignedUsers=""> <bu1 label="BCS" assignedUsers="User12, User3"> <bp1 label="This is the first BP Label" assignedUsers="User4, User8"/> <bp2 label="Another BP" assignedUsers="User 1"/> <bp3 label="The third BP" assignedUsers="User666"/> Continues on with more bp, bu, and bf nodes
Now, I’m not sure why the guy before me did it this way, but what I would am doing is changing it so that each nodes name isn’t bp#, but just bp (or bf, or bu, etc.) and adding another attribute node called ID with the associated number. I’m also looking at doing something with the assignedUsers node to make it easier to work with (ie, easier to query with XPath). So it will hopefully look something like this:
<root > <cm ID="1"> <bf ID="1" label="BCS" ... <bu ID="1" label="BCS" ... <bp ID="1" ... <bp ID="2" ... <bp ID="3" ... <bp ID="4" ... <bp ID="5" ...