Load xml from resources (uri is too long)

Until now I was loading the xml files from StreaminAssets, but I want to hide the files to prevent theft. (gathering the data is time consuming and valuable as it’s a first in the genre)

But what is the proper way to load an xml from Resources?

With the help of some other topics about xml in the resources folder I came to this:

TextAsset xmlFile = Resources.Load<TextAsset>("Airports/Europe");

var doc = new XmlDocument();
doc.Load(xmlFile.text); // <- error happens here
XmlElement root = doc.DocumentElement;
XmlNodeList airportsList = root.SelectNodes("//airport");

But this gives me the following error:

 Invalid URI: The Uri string is too long.

I guess my file is too long, but I’m sure there is a way around this?

I found the solution. It’s quite simple actually. (not sure why the other posts didn’t do this.)

This line:


Should be: