XML scripting examples?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC

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.
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan

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 ...";
Post Reply