Exporting to XML from Access

Applies to
Microsoft Office Access 2003
Microsoft Access 2002

In Access 2002 or later, you can output data to Extensible Markup Language (XML) by exporting to an XML document. You can also output schema files to specific the structure of the XML document as well as a style sheet to describe the presentation of your data.

ShowExport a table, query, form, or report as XML

  1. In the Database window, click the name of the table, query, form, or report that you want to export, and then on the File menu, click File.
  2. In the Save as type box, click XML Documents (*.xml).
  3. Click the arrow to the right of the Save in box, and select the drive or folder to export to.
  4. In the File name box, enter a name for the file, and then click Export.
  5. In the Export XML dialog box, do one or more of the following:
    • To export the data to an XML document, select Data (XML).
    • To export the schema to an XML file, select Schema of the data.
    • To format your table or query data by using an Extensible Style Language file, select Presentation of your data (XSL).

 Note    The Data check box must be selected for the Presentation of your data (XSL) drop-down box to be available.

  1. Click OK to export to the XML document.

ShowSet advanced options for exporting XML files

  1. In the Export XML dialog box, click Advanced.
  2. Set options by doing one or more of the following:

ShowExport data to XML

  1. Select the Data tab.

 Note    The Export data check box reflects the selections made in step 5.

  1. Enter a destination for the exported files in the Export location dialog box or use the Browse button. The path can be to a hard disk drive or a universal naming convention (UNC) path on a server.
  2. To select an encoding format other than the default, click the Encoding drop-down box and make a selection.

ShowExport schema to XML

  1. Select the Schema tab.

 Note    The Export Schema check box shows the selection made in step 5.

  1. To include additional information on the underlying structure of the database, select the Include primary key and index information check box.
  2. To embed the schema directly into the XML data document, select the Embed schema in exported XML data document option.

To create a schema file which is separate from the data file, select the Create separate schema document option, and enter a valid destination for the file or use the default.

ShowPresent your data

  1. Select the Presentation tab.

 Note    The Export Presentation (HTML 4.0 Sample XSL) drop-down box shows the selection made in step 5.

  1. Do one of the following:
    • To run the exported file from a client machine, select the Client (HTML) option under the Run from selection. This option generates an HTML file on the client machine which contains scripting code to merge the presentation (XSL) file and the data (XML) file. This option has the advantage of indirectly referencing the presentation file from the HTML file instead of embedding the presentation information in the data. Therefore, either the data (XML) file or presentation (XSL) file can be changed without having to rerun the original document.
    • To run the exported file from a server, select the Server (ASP) option under the Run from selection. This option generates an ASP file that merges the presentation (XSL) information with the data (XML) and sends the resulting HTML file to the client machine for display.
  2. In order for images to appear correctly in an XML presentation, they must be located external to the XSL document which contains internal references to the files. Do one of the following:
    • Select the Put images in option and the file location.
    • Select the Don't include images option to exclude any document images from the XML version.
  3. Enter a destination for the exported presentation file in the Export location dialog box, or use the Browse button. The destination path can be to a hard disk drive or a universal naming convention (UNC) path on a server.
 
 
Applies to:
Access 2003