Android and XML (Reading/Wirting)

Hello everyone,

I have been trying to work with an XML file to store my data.

I was able to read and write data into my xml file when I test the program on my PC. But when I build the program for the android, only the reading works.

Here is how I do it.
I attach my xml file to the variable TA in the Inspector

public static XmlDocument XmlDoc;
public static XmlNodeList xnl;
public TextAsset TA;

void Start()
{    
    XmlDoc = new XmlDocument();
    XmlDoc.Load(new StringReader(TA.text));
    xnl = XmlDoc.GetElementsByTagName("level");
    DataFilePath = Application.dataPath + "/Data/Data.txt";
    // Play with the data / update some innertext ....
    XmlDoc.Save(DataFilePath);
}

This works on my PC … but not on my android …

Is there is a better way?

put the XML file in a folder called “Resources”. then use Resources.Load(path), where the root of path is the resources folder.