Page 1 of 1

XML scripting examples?

Posted: June 14th, 2010, 12:30 pm
by byronnash
Does anyone have any examples of reading in a XML file and using it in a script with the Extendscript tools? I have an older script that parses the file manually but just ran across the XML section in the CS4 Javascript Tools Guide. I wonder if I could overhaul this scrip by using the built in XML tools.

Re: XML scripting examples?

Posted: June 15th, 2010, 5:52 pm
by nab
Here is some pseudocode to get started.

Code: Select all

var file = ...;

// read XML
var content = file.read();
var xml = new XML(content);
var elements = xml.elements(); // retrieve all elements at root level in standard array
...

// write XML
var content = "... xml content ...";
file.write(content);