Saving, importing, and exporting data > Importing data into FileMaker Pro > Importing XML data
 
Importing XML data
FileMaker Pro can import XML data into an existing FileMaker Pro file, or convert XML into a new FileMaker Pro file.
The XML can be a physical file, or the result of an HTTP request sent to a web server. For example, you could set up an Orders database to send tracking numbers to a package delivery company in the form of an HTTP request, and their web server could return the latest package tracking information in XML format, ready to be imported into the Orders database.
The XML that you import must conform to the FileMaker FMPXMLRESULT document type definition (DTD). If your XML is in a different format, you can apply an Extensible Stylesheet Language (XSLT) style sheet during import to transform your XML into the FMPXMLRESULT grammar. See XML format.
To import XML:
1. What you do first depends on whether you are importing XML into an existing FileMaker Pro file, or converting XML into a new FileMaker Pro file. Do one of the following:
 
To import XML
Do this
Into an existing FileMaker Pro file
Continue with step 2.
By converting the XML into a new FileMaker Pro file
Skip ahead to step 8.
2. If you’re updating existing or matching records, make a backup copy of the target file that you’re importing into.
Important  Updating existing or matching records overwrites data in the target file and cannot be undone. Choose File menu > Save a Copy As to make a backup copy of the target file. Make sure you understand how updating records works. See Methods of importing data into an existing file.
3. Open the FileMaker Pro file that you want to import records into (the target file).
4. If the target file contains multiple tables, use the Layout pop-up menu to display a layout that shows records from the table you want to import data into.
5. If you’re updating existing or matching records, do the following before you import. (If you’re adding new records, skip to the next step.)
If you’re updating existing records in the file, make sure the found set contains only the records you want to replace. Sort the records (for example, by the field name) to ensure that data you’re importing replaces the correct records in the target file.
If you’re updating matching records, make sure the found set contains only the records you want to update. Records outside the found set will not be updated, even if match field data matches.
6. Choose File menu > Import Records > XML Data Source.
The Specify XML and XSL Options dialog box appears.
7. Skip ahead to step 11.
You should only follow steps 8 through 10 if you are converting XML into a new FileMaker Pro file.
8. Choose File menu > Open.
9. In the My Solutions tab in the Launch Center, click Browse.
10. In the Open File dialog box, for Files of type (Windows) or Show (OS X), choose XML Data Source, then select the file.
The Specify XML and XSL Options dialog box appears.
11. For Specify XML Data Source, choose the source of the XML data to import.
The XML source can be a file or the result of an HTTP request. See About importing data using an HTTP request.
12. To apply an XSLT style sheet to the XML before importing, select Use XSL style sheet and specify the source of the XSLT style sheet.
When the XML you’re importing does not conform to the FMPXMLRESULT DTD, you must apply an XSLT style sheet that transforms the XML into the proper grammar. The XSLT source may be a file or the result of an HTTP request. See About importing data using an HTTP request.
13. Click Continue.
Using a Xerces-based XML parser and a Xalan-based XSLT processor, FileMaker Pro applies an XSLT style sheet (if you specified one) to transform the XML data. If an error message appears, correct the error and try importing again.
14. Do one of the following:
 
If you are importing XML
Do this
Into an existing FileMaker Pro file
The Import Field Mapping dialog box appears, where you choose the type of import to perform and map fields in your database to the data to import. (See Setting the import action and mapping fields during import.) Choose options in the dialog box, then click Import.
By converting the XML into a new FileMaker Pro file
The Name Converted File dialog box appears. Type a name for the new file, choose a location, then click Save.
Notes
For details about the requirements for well-formed XML, see the XML specification, which is available at http://www.w3.org/XML/.
FileMaker Pro uses the Xerces-C++ XML parser, which supports XML data in the following character encodings:
ASCII
UTF-8
UTF-16 (Big/Small Endian)
UCS4 (Big/Small Endian)
EBCDIC in both IBM037 and IBM1140 encodings
ISO-8859-1 (Latin1)
Windows-1252
Although Windows-1252 is the default character encoding on Windows, this character encoding is not widely recognized by other XML processing tools. If you’re using a Windows-based editing tool to generate XML, check the encoding="..." declaration to see which character set it generates. See the Xerces C++ FAQ on the Apache website at http://xerces.apache.org/xerces-c/.
If you are using a calculation that generates the file path for the XML file, you must use the format used by the operating system for the full path. For example, the following are valid paths:
Windows: driveletter:/directoryName/fileName
OS X: /Volumes/VolumeName/directoryName/fileName
If you are providing a cross-platform solution, you can use the Get(SystemPlatform) function to identify the current platform and use the correct format for each platform.