NO LONGER MAINTAINED
Download Version 2.9.4 (430KB) – 64 & 32-Bit Intel Mac OS X 10.6 or later
Download Version 2.9.3 (424KB) – PowerPC Mac OS X 10.3.9 or later, 32-Bit Intel Mac OS X 10.4 or later
Download Version 2.8 (652KB) – Classic Mac OS (9.2), PowerPC Mac OS X 10.0 or later
The XML Tools AppleScript Scripting Addition allows AppleScript to parse and generate XML data. XML Tools’s parsing can generate a complete DOM-like structure or it can operate in a SAX-like event handling mode.
NOTE: If you are looking for a tool to simply parse Property List data, go to the Property List Tools page.
The XML Tools OSAX uses James Clark’s Expat XML parser. The Expat license and distribution is available here.
THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.
THIS SOFTWARE IS COPYRIGHT © 1998-2010 LATE NIGHT SOFTWARE LTD. & MARK ALLDRITT. YOU MAY USE AND/OR DISTRIBUTE THE SOFTWARE WITHOUT RESTRICTION. IF YOU BUNDLE THE SOFTWARE WITH ANY COMMERCIAL OFFERING, YOU MUST DISPLAY THIS COPYRIGHT NOTICE IN THE SOFTWARE’S DOCUMENTATION AND/OR ABOUT BOX. YOU MUST ALSO COMPLY WITH ANY DISTRIBUTION RESTRICTIONS SET OUT IN THE EXPAT LICENSE THAT MAY APPLY TO YOU.
Mac OS X Installation
Download a Mac OS X version of XML Tools and follow these steps to install the XML Tools scripting addition on Mac OS X systems:
- Create a folder named ScriptingAdditions in your account’s Library folder if one does not already exist.
- Copy the XML Tools.osax file into your account’s
Classic Mac OS Installation
Download the Classic Mac OS version of XML Tools (2.8).
Install XML Tools on Mac OS 9 systems by simply copying the XML Tools scripting addition file to the Scripting Additions folder of your Macintosh. The Scripting Additions folder is located within your System Folder.
NOTE: Do not use the XML Tools.osax file! This file is intended for Mac OS X systems.
Change History/Release Notes
2.9.3 August 28, 2010
- Support 64-Bit Intel systems.
2.9.2 June 5, 2009
- The generate XML command now properly escapes ” characters appearing within attribute values.
2.9.2 May 14, 2009
- Resolved a regression that prevented the 2.9.1 release from operating on 10.4.x systems.
2.9.1 May 7, 2009
- Errors signaled from the XMLParseResult SAX event handler are now reported to the script calling the ‘parse XML’ command.
- Errors signaled from SAX event handlers are now reported to the XMLParseResult SAX event handler via parameters. The XMLParseResult handler is now declared as: on XMLParseResult(errNumber, errMessage). Resolved a crashing bug that occurs when parsing XML data with certain types of namespace declaractions.
2.9 June 7, 2006
- Native Intel Macintosh support (distributed as a Universal binary).
- Added simple dom option to the parse XML command. The simple dom parameter causes parse XML to return an alternate record structure that allows you to navigate directly to elements without having to iterate and search.
- You can now pass aliases and file references to the parse XML command’s base path parameter.
2.8 April 15, 2005
- Fixed a bug when generating XML containing namespace references.
- Fixed a bug when parsing MacRoman XML files where the Apple and Euro symbols are not properly handled.
- Fixed a bug where newline characters are not properly reported to SAX handlers
2.7 May 17, 2004
- Restored support for parsing XML files containg MacRoman high-bit characters. Please refer to the new Encoding page for further details. Note, to parse MacRoman XML files you must now specify the MacRoman encoding.
- Added a new page to the web site explaining how XML Tools supports XML encodings.
- Added a new encoding parameter to the parse XML command which allows you to override the encoding specified in a file’s XML Declaration.
- Fixed a bug where generating XML files with HFS file paths containing long (>31 characters) file names would truncate the file name. To specify an HFS path with a lone file name you must say: file “volume:folder:long-file-name.xml”. Use of AppleScript’s file specification (FSSpec) class will result in truncated file names. POSIX file path specifications are not effected by this bug.
2.6 April 22, 2004
- Revised on-line documentation
- Added XMLToolsLib AppleScript utility/sample code
- The parse XML command can now read XML from files. This means that you no longer have to read the XML data that you want to parse yourself. XML Tools handles MacRoman, UTF-8 and UTF-16 text files.
- The generate XML command can now write the generated XML directly to files using the new saving as parameter. The generating unicode parameter has been renamed generating UTF16, and a new generating UTF8 parameter has been added. The generating UTF16 and the new generating UTF8 parameter control the type of file created.
- A newer version of the expat XML parser is being used to resolve crashing bugs in the older expat code. The parse XML command now returns an XML contents property for empty tags (<tag/>) and a new including empty elements parameter has been added to rever to pre v2.6 behavior.
- The parse XML command provides for SAX-like event-based processing of XML data. More information on event-based XML processing is available here.
2.5 Sepember 29, 2002
- Added a new separate namespace URIs parameter to the parse XML command. This parameter, which is true by default, controls how namespaces are reported when parsing XML data. When true, XML Tools reports tag names and the associated namespace in separate properties of the XML Element record, XML tag and XML namespace uri respectively. When false, only the XML Tag property is generated containing both namespace URI and the tag name in the format UTL:TagName.
- Mac OS X 10.2 introduced changes to the AppleEvent Manager that slowed XML Tools down considerably when parsing complex XML documents. XML Tools 2.5 contains changes that improve performance by roughly 20% on 10.2 systems.
2.4 March 14, 2002
Added a new allowing leading whitespace parameter to the parse XML command. This parameter, which is false by default, causes XML Tools to ignore any leading white space in an XML data stream.
NOTE: XML Tools 2.3.2 introduced a change where leading white space was always ignored. This raised the eyre of XML purists so we’ve made this an optional behavior for XML Tools 2.4.
The XML leading comments property of the XML Document class has been renamed XML Prolog and now includes both comments and processing instructions appearing before the root tag in an XML document. The generate XML command now properly encodes entities for markup characters (&, <, >) appearing in tag attribute values.
- Processing instructions containing colons (e.g. <?xml:stylesheet … >) are now parsed correctly. The generate XML command can now handle the case where processing instructions appear in the XML prolog (i.e. before the root tag).
2.3.2 November 20, 2001
- Whitespace can now appear before the initial element.
- The generate XML command corretly emits whitespace between attributes when pretty printing is disabled.
2.3.1 October 5, 2001
- Corrected problems introduced by the 2.3 release that rendered the generate XML command inoperable.
2.3 August 24, 2001
- XML Tools now supports all aspects of the Native PowerPC Scripting Addition API as defined by Apple. Previous versions did not support reference counting.
- Added XML element id to the XML Element class to indicate element serialization. This replaces the old way of doing this via an ID attribute that proved difficult to use from AppleScript.
- XML Tools now properly reports mismatched tag errors. Previous versions reported a very unhelpful paramErr (-50) in this case. This version will indicate a mismatched tag error and suggest an offending line and character offset, as it does with other XML parsing errors.
- Some memory management errors have been resolved that should address instability problems.
- The generate XML command now properly handles ‘without pretty printing’, and white space is no longer 6. introduced into the resulting XML stream.
2.2 March 24, 2001
- Native support for Mac OS X.
2.1 August 13, 2000
- The parse XML command now supports the xml-space=”preserve” tag attribute that causes white space to be retained within the data associated with the tag.
- The parse XML command now has a boolean preserving whitespace parameter that allows you to direct parse XML to preserve white space characters (space, tab, newline) within XML data.
- The generate XML command now has boolean pretty printing parameter controlling the formatting applied to generated XML data.
- Added the Save & Restore Desktop sample scripts.
2.0 April 13, 2000
- XML Tools now uses the October 12, 1999 Test version of the Expat XML parser (the build system has been changed to allow drop-in integration of future Expat releases).
- The parse XML command can now return XML namespace information.
- The parse XML command can now return XML processing instruction information.
- The parse XML command can now return XML comment information.
- The parse XML command can now process external entity (DTD) references.
- The parse XML command can now serialize each parsed XML Element.
- The parse XML command now returns the XML Document class that contains document level information. All parsed elements continue to be returned as XML Element classes.
- A new generate XML command has been added to provide high speed XML Element/XML Document to XML text conversions.
- XML Tools now uses the native PowerPC OSAX interface supported by Mac OS 8.6 and later.
XML Tools version 2.0 Limitations:
The generate XML command does not generate CDATA elements. External entity SYSTEM IDs must be valid URLs of the form file://…, http://… or ftp://…