A SERVICE OF

logo

MediaScript Objects and Methods 151
loadFile()
Loads an XML document from the file system.
Syntax
<object name>.loadFile(
<"filename.xml", "virtualfilesystem:/filename.xml">
);
Parameters
The loadFile() function accepts an XML filename as it’s only parameter. By default,
MediaRich looks for XMLDocument files in the write file system which point to the
following directory:
MediaRich/Shared/Originals/Media
NOTE: You can modify the MediaRich server’s local.properties file to change the default
Media directory. See “File Systems” on page 14 for more information.
MediaRich also allows you to set up virtual file systems and then load files from that
location. Virtual file systems are defined in the MediaRich server’s local.properties
file. For example, if you define “XML:” to represent the path “C:/010102/XML/” in the
local.properties file, you can use files from the XML directory with the loadFile()
function:
XMLDoc.loadFile("XML:/customersUS.xml");
loadString()
Loads an XML file as a string, rather than as a file.
Syntax
<object name>.loadString(
<"XML string">
);
Parameters
This function accepts an XML string as its only parameter. The string must include valid
XML start and end tags.
Example
var test = new XMLDocument();
test.loadString("<html>sale</html>");
save()
Saves an XML document to the file system.
Syntax
<object name>.save(
<"filename.xml", "virtualfilesystem:/filename.xml">
);