Skip to content

openDocument(xmlFile)

The openDocument(xmlFile) method opens an XML file, making it available for processing. It returns a file ID used as an XML file reference.

The first available ID is equal to zero. The value is incremented by one for each opened file in the same session. For example for the first opened file the ID is set to 0, for the second to 1, for the third to 2 and so on.

A typical openDocument(xmlFile) usage is the following:

var xmlFile = loadFile(taxonomyFileName);
var xmlID = XML.openDocument(xmlFile);

The first instruction loads the file name in memory, the second one opens the file and makes it available for processing by means of its ID.

Info

The taxonomy file must be in the same engine folder. Relative or absolute paths are not permitted for security matters.

Remember to close all the opened files with the closeDocument(xmlID) method to free up the memory space and release the IDs pointers.

The syntax is:

XML.openDocument(xmlFile)

where xmlFile is the XML file to open.