loadFromXmlFile - can't get it to work
-
Am I doing something wrong? (probably)
I'm trying to load data from an xml file and parse it to JSON. My code looks like this:var xmlData = File.loadFromXmlFile("path\to\file);
But I'm getting the error
Unknown function 'loadFromXmlFile'
-
@Dan-Korneff Does this work? I don't have any JSON xml files to test but it doesn't return any errors:
var xmlData; FileSystem.browse(FileSystem.AudioFiles, false, "*.xml", function(result) { xmlData = result.loadFromXmlFile(); //maybe some other step here? });
-
@Dan-Korneff when it comes to file loading, you have to get a reference to the file first :
const appData = FileSystem.getFolder(FileSystem.AppData); const myXmlFile = appData.getChildFile("MyFile.xml"); const xmlData = myXmlFile.loadFromXmlFile();
The solution by @iamlamprey works too if you want to open the browser.
-
Thanks guys!