Saving, importing, and exporting data > Supported import/export file formats > XML format
 

XML format

Extensible Markup Language (XML) is a language for structured data interchange. Instead of being a rigid file format, XML is a language for defining agreed-upon formats that groups can use for exchanging data. Many individuals, organizations, and businesses use XML to transfer product information, transactions, inventory data, and other business data.

Example files for XML import and export are available for you to download from the Downloads and Resources page. For general information on XML and links to XML resources, see the FileMaker website.

Importing XML

FileMaker Pro Advanced supports the FMPXMLRESULT grammar for XML import. If your XML is in a different format, you can apply an Extensible Stylesheet Language for Transformations (XSLT) style sheet during import to transform your XML into the FMPXMLRESULT grammar.

Exporting XML

FileMaker Pro Advanced can export XML in two grammars: FMPXMLRESULT and FMPDSORESULT. You can apply an XSLT style sheet during export to transform either of the grammars into a different XML format, or into a different format such as HTML or plain text. For example, with XML export, you can create a data-driven webpage, or a text file of data that uses a custom field delimiter.

Note  The XML import and export features in FileMaker Pro Advanced use an XML parser called Xerces and an XSLT style sheet processor called Xalan. As you develop XML and XSL, you may want to test your XML and XSLT with Xerces- and Xalan-based parsers and processors, available at www.apache.org and other third-party locations.

XML FMPDSORESULT grammar

The FMPDSORESULT grammar is useful for exporting databases that you want to format with cascading style sheets or XSL. This grammar is compatible with the Microsoft XML Data Source Object used by Internet Explorer.

Note  Do not name your data fields with leading numbers or single-byte kana characters (for example "7"). The FMPDSORESULT grammar does not allow numeric or single-byte kana characters as field name tags and will not display the resulting XML file in a browser.

Each ROW element in the exported FMPDSORESULT grammar contains a number of FIELD elements that correspond to the field names that you export.

Spaces or single colons in field names are converted to underscores in the element names (for example, <FIRST_NAME>). Double colons in portal fields are converted to periods (for example, <PHONE.PHONE_NUMBER>). This is done because colons are reserved in XML for specifying namespaces, and spaces are not allowed in XML element names.

For repeating and related fields, each FIELD element will contain a DATA element that corresponds to each repetition or portal record.

XML export does not support exporting container field data.

Due to XML limitations, only one record from each related field is exported.

XML FMPXMLRESULT grammar

The FMPXMLRESULT grammar contains additional information about the database that is not in the FMPDSORESULT grammar, such as the number of records, field types, and field formats. These elements and attributes are necessary for the XML to validate properly.

Use the FMPXMLRESULT grammar if you require the METADATA information provided by this grammar. Because FileMaker Pro Advanced supports both importing and exporting in the FMPXMLRESULT grammar, this can be a useful format for transferring data between FileMaker Pro Advanced files.

Note  The FMPXMLRESULT grammar is not well suited for use with cascading style sheets (CSS). Use the FMPDSORESULT grammar if you want to use CSS with your XML data.

In the FMPXMLRESULT grammar, the DATABASE element contains the NAME, RECORDS, DATEFORMAT, LAYOUT, and TIMEFORMAT attributes.

The DATEFORMAT attribute specifies the format of dates in the XML document.

 

Field

Full form

Short form

Year

yyyy (4 digits)

yy (2 digits)

Month

mm (2 digits)

M (1 or 2 digits)

Day

dd (2 digits)

d (1 or 2 digits)

The TIMEFORMAT attribute specifies the format of times in the XML document.

 

Field

Full form

Short form

Hour (1-12)

hh (2 digits)

h (1 or 2 digits)

Hour (1-24)

kk (2 digits)

k (1 or 2 digits)

Minute

mm

 

Second

ss

 

AM/PM

a

 

The METADATA element contains one or more FIELD elements, each containing information for one field/column—including the name of the field as defined in the database, the field type, the Yes or No allowance for empty fields (EMPTYOK attribute), and the maximum number of repeating values (MAXREPEAT attribute). Valid values for field types are TEXT, NUMBER, DATE, TIME, TIMESTAMP, and CONTAINER.

The RESULTSET element contains all of the ROW elements that specify the record data in the XML. Each ROW element contains the field/column data for one row in the result set—including the record ID for the row, the modification ID for the row, and the COL element containing the data for one field/column in the row (where multiple DATA elements represent one of the values in a repeating or portal field).

XML export does not support exporting container field data.

Due to XML limitations, only one record from each related field is exported.

The order of the COL elements corresponds with the order of the FIELD elements in the METADATA element, for example, where the "First Name," "Last Name," and "Department" elements are listed in the METADATA, "Joe," "Smith," and "Engineering" are listed in the same order in the RESULTSET ROW.

Notes 

Before importing the XML, FileMaker Pro Advanced uses a Xerces-based XML parser and a Xalan-based XSLT processor to apply 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.

Though the XML that you import must conform to the FMPXMLRESULT grammar, certain elements and attributes are not used during import. The following table defines which elements and attributes are used during XML import, and lists the allowed default values for attributes. In most cases, attribute values may be null (such as TIMEFORMAT=""). Also, the FMPXMLRESULT element should always declare the FileMaker namespace for the grammar.

 

Element

Attributes

Used during XML import

Default value

FMPXMLRESULT

 

Yes

xmlns="http://www.filemaker.com/ fmpxmlresult"

ERRORCODE

 

No

 

PRODUCT

 

No

" "

 

NAME

No

" "

 

VERSION

No

" "

 

BUILD

No

" "

DATABASE

 

No

 

 

NAME

No

" "

 

RECORDS

No

" "

 

DATEFORMAT

No

" "

 

TIMEFORMAT

No

" "

 

LAYOUT

No

" "

METADATA

 

Yes

 

    FIELD

 

Yes

 

 

NAME

Yes

" "

 

TYPE

Yes

"TEXT", "DATE", "NUMBER", "TIME", "TIMESTAMP", or "CONTAINER"

 

EMPTYOK

No

"YES" or "NO"

 

MAXREPEAT

No

" "

RESULTSET

 

Yes

 

 

FOUND

No

" "

    ROW

 

Yes

 

 

RECORDID

No

" "

 

MODID

No

" "

    COL

 

Yes

 

      DATA

 

Yes

 

Related topics 

Importing data into FileMaker Pro Advanced

Exporting data from FileMaker Pro Advanced