FileMaker Save as XML… Under the Hood
With the release of FileMaker 18, FileMaker Inc introduced “Save a copy as XML”: this new feature puts more capabilities in the hands of professional software developers. It is a further step towards version control and allows developers to better view and compare structural changes within FileMaker Pro files.
This post lays out how the feature differs from the two main pre-existing XML options found in FileMaker Pro Advanced. In addition, we will briefly highlight FileMaker’s long-term goals for the “Save a copy as XML” feature, and how it can be currently used for simple file comparison via common code editors.
XML in a Nutshell
Before we get too far, it might be worth mentioning what XML actually IS, and a simplified overview of how it works. Please note that a thorough overview of XML would require quite a number of blog posts, let alone one or more books to cover properly! We won’t cover all that ground here today: please feel free to view the related references at the end of this article if you are interested in learning more about XML. 
In brief, XML stands for “Extensible Markup Language”, and, at its core, is really just an agreed upon standard for cataloging information that is readable to both humans and computers alike. As its name might suggest, it is meant to be a self-defining standard (hence “extensible”) that can flex based on what data any given block of XML comprises. It both is a way to store information and comes coupled with a tagged markup that also defines what a particular bit of information is.
Like HTML, XML uses a series of opening and closing “tags” to encapsulate pieces of information within a tree-like structure. Unlike HTML, XML allows users to name these tags whatever they wish and is somewhat stricter on how these tags can be used or nested together.
XML itself is not new, it has been around since the mid to late nineties, and its history within FileMaker dates back to at least FileMaker 6 when the ability to import XML into FileMaker Pro was first introduced, and later expanded upon with the option to create XML Database Design Reports (or DDRs) at least as early as FileMaker 8.
Even after the rise of newer and sometimes similar technologies like JSON, XML nevertheless continues to be a valuable and flexible option for programmers and database engineers today and having at least a good understanding of XML is still highly recommended for all software developers.
Further, the underlying architecture of a FileMaker file is XML. While FileMaker developers don’t have direct access to this file format, these new features allow us to work with the structure in useful ways. (More on that later.) The database engine introduced in FileMaker 7 shifted from a proprietary standard within FileMaker files to this well-established industry standard.
Using XML with FileMaker
Before FileMaker 18, the (non-server) options for using XML with FileMaker were primarily the ability to import and/or export data in a particular format of XML (ie a format determined by FileMaker Inc) as well as creating an XML Database Design report or DDR.
In practice, the resulting XML file generated by the new “Save a copy as XML” shares more in common with an XML DDR than an XML file created via the “Export Records” file command or script step. Mainly in that the “Save a copy as XML” ONLY includes details about the structure of a FileMaker file like its table and field definitions, layouts, layout objects, scripts, accounts, themes, etc but NOT any record data or field values.
List of primary XML tags (and nested children tags) found within the resulting file created by “Save a Copy as XML”
- BaseTableCatalogue, BaseTable
- TableOccuerenceCatalogue, TableOccurence
- FieldsForTables, FieldCataloogue, Field
- ThemeCatalogue, Theme, CSS
- LayoutCatalogue, Layout, LayoutObjects, PartsList, Part
- PrivilegeSetsCatalog, PrivilegeSet
- ExtendedPrivilegesCatalog, ExtendedPrivilege
- AccountsCatalog, Accounts
- StepsForScripts, Script, ParameterValues, Parameter, Value, Calculation
Unlike the DDR however, “Save a Copy as XML” IS also available as a script step, allowing for easily automated workflows which have never been possible with DDRs.
Note that FileMaker Inc is still fleshing out how best to present its underlying schema to developers. For example, the XML file created by this new option is never exactly the same even if its source FileMaker file has not been changed in any way. For every XML copy, the XML <TagList> elements (often associated with individual FileMaker Tables or scripts) changes its end string values every time a new XML copy is created.
While FileMaker Inc is somewhat vague on what these <TagList> tags are used for explicitly, developers have speculated that they could potentially represent some sort of automatic timestamp or unique identifier that changes each time the “Save a Copy as XML” step is run.
These mysterious <TagList> elements aside, each XML copy can still provide valuable insight to tons of very specific structural files changes.
The important thing to recognize is that the engineering team at FileMaker is giving us more tools – but isn’t, always, holding our hands. Here at Codence, we think they’re making exactly the right decisions: in some cases, they’re protecting and preserving FileMaker’s legendary ease of use; in other cases, they’re putting powerful capabilities into the hands of professional software developers.
“Save a Copy as XML”: what it is and what it may become
In FileMaker’s Product Roadmap, the company describes this new feature as thus: “Use a preview release script step to save a copy of a FileMaker file as XML. Use the XML file to more easily compare changes and updates. Or use the Render file as XMLpreview script step when you want to store the XML data in a field or variable”. 
As of this writing, no XMLpreview script step exists, nor does any other “render file” option for XML within FileMaker. However, FileMaker’s intention is clear in that this simple new XML option has long term aspirations for better version and change tracking of FileMaker solutions.
While perhaps not yet at its full potential, the new “Save a Copy as XML” feature can at least be currently used for simple FileMaker file comparison. As of this writing, no third-party tools are yet extending this new feature any further. However, we will reference a few more general file comparison tools below if you’d like to explore further.
Using “Save a Copy as XML” to view structural changes of a FileMaker file
As mentioned already, XML files created using the new “Save a Copy as XML” option will only include structural details such as changes in file tables, field definitions, layouts, accounts, or scripts but NOT any record data itself.
Therefore, if you use automatic scripting to create regular XML copies of a particular FileMaker solution (like for instance whenever a FileMaker file is opened or closed via the onFirstWindowOpen or onLastWindowClosed script triggers) you could in effect, create an ongoing history of structural file changes logged as archival XML text files for later reference or comparison.
Once you have at least two different XML versions of a particular FileMaker File, you can then easily open them in a modern code editor like Visual Studio Code (available for free on both Windows or Mac) to receive an easy to read comparison of any and all structural differences between two selected files.
Steps to Easily Compare two XML files using Visual Studio Code
Step 1: create an initial XML copy of desired FileMaker file to use as your base reference. This can be done by opening the FileMaker file in question and either using a script with the “Save a Copy as XML” script step in it, or otherwise going to the Tools menu in FileMaker Pro 18 Advanced and selecting the “Save a Copy as XML” option.
Step 2: Change the structure of your FileMaker file in some way by doing one or more of the following: Add, delete, or rename a field or table, change a field’s auto-enter or validation settings, create or alter a script, or even add or remove a field or layout object from a particular layout.
Step 3: Save a new XML copy like described in step #1
Step 4: Open Visual Studio Code (free download here), and from the menu choose File > Open… and then find and Shift-click on the two XML files that you wish to compare. Then choose the “Open” button to open them in VS Code. (Tip for Mac Users: you can also drag one or more item to a program’s dock icon to open them directly in a particular app like VS Code).
Step 5: Click on the “Explorer” icon near the top left of the VS Code window to view a list of your currently open XML files.
Step 6: Shift-click the two files listed in the VS Code Explorer sidebar to select them simultaneously.
Step 7: With exactly two XML files selected within VS Code, use your mouse or trackpad to right-click on them to choose “compare”.You should now see the two XML files side-by-side with helpful color highlighted sections for each +/- change respectively.
The new “Save a Copy as XML” feature (available as both a Menu command from within FileMaker Pro Advanced, and as a script step with the same name), is yet another way that the FileMaker platform supports and works with the XML format. Offering an easy new way to view incremental structural changes of a FileMaker file allows developers to track changes, better understand how FileMaker solutions operate, and potentially diagnose problems. Gaining access to the XML format within a FileMaker file provides an exciting possibility that may lead to even better version comparison capabilities in the future.
Want to learn more about FileMaker 18? Check out our featured article: The New FileMaker 18 is Here, or our YouTube video playlist FileMaker 18 New Features. Otherwise, if you haven’t already, please subscribe to our blog to receive notifications for our latest news or posts.
 To learn more about XML see: Tom Myer’s Really, Really Good Introduction to XML. For those that still prefer printed text, Simon St. Laurent’s book on XML a Primer is also a valuable resource. For great free step-by-step tutorials on XML basics visit W3Schools https://www.w3schools.com/xml/ Lastly, Tom Strassner wrote an excellent article XML vs JSON that nicely outlines the strengths and disadvantages of these two formats and argues that they need not be mutually exclusive.
 Import XML to FileMaker first Introduced in FileMaker 6 see: https://www.filemaker.com/products/filemaker-pro-advanced/version-comparison.html#fm6
 XML DDR option available as early as FileMaker 8, See the FM 8 User Guide page 59: https://www.filemaker.com/downloads/documentation/fmpa8_development.pdf
 Credit for this slightly re-worded sentiment goes to W3Schools
 Additional file comparison tools for consideration: Diffuse (free for Mac/Windows) – http://diffuse.sourceforge.net/ , Diffmerge (free for Mac/Windows) – http://sourcegear.com/diffmerge/index.html and Kaleidoscope ($69 mac or $20 iOS) https://www.kaleidoscopeapp.com/