Advanced XML Export Options

When you exported the Shippers table to XML format, you may have noticed the More Options button in the Export XML dialog box (see Figure 29-2 at the beginning of this chapter). Pressing this button opens a window with three tabs as shown in Figure 29-8. Each tab groups options for the types of XML objects that you can export. The Data tab contains options for the XML document, the Schema tab list options for the XSD document, and the Presentation tab provides options for generating the XSL document.

Data Export Options

The options shown on the Data tab (see Figure 29-8) control the data that is exported to the XML documents. These options are grouped into three main areas.

The Export Data section displays data that you may want to export. In this particular scenario I requested to export the Customers table. Because this table is directly related to the Orders table in the Northwind database, the Orders table is displayed as a child node of Customers. The Orders table is related to the Order Details table and so on. If you click on the plus sign in front of the [Lookup Data] node, you will see the names of tables that provide

^Shippers - Microsoft liii'iExplorer _ ~~ X

File Edt View Favorite? Tools help


Q-** • © ■ g] g| P Search


^JJ"7-> c:\E.eam_>ifU5Nppers.htrn v j 0 ®

Link- »

S:i:( [:: ? ID Company Naitit PI

~ t Speedy Espfiss fcjB) ijj-9331

iUmlci Pitkigt pm JJJ-3199

3 Federal Shipping (JIB) SS.W31

J MfCompjter

Taking Your VBA Programming Skills to the Web lookup information for the main tables. By clicking on the check box you may export just the table that you originally requested or you can export the customers' data along with all the orders, and perhaps include lookup information.

Below the Export Data section is the Export Location area that shows the filename for the XML document that will be created when you click the OK button. You can change the location of this document by using the Browse button. Simply navigate to the folder where you want to save the XML file. You can also change the name of the document by replacing the name shown in the text box with another name.

The area to the right of the Export Data section allows you to specify which records you want to export. This area contains three option buttons that allow you to export all records, filtered records, or the current record. Notice that only two options are enabled in Figure 29-8.

Figure 29-8: Use the Data tab in the Export XML window to set advanced data options.

If you highlight the table to export in the Database window and then choose the Export command on the File menu, only the All Records option button will be enabled in the Records To Export section. Opening the table prior to choosing the Export command tells Access to enable the All Records and Current record option buttons. And if you open the table and apply a filter to the data, then select the Export command, Access will enable the Apply existing filter option button in addition to the other two buttons.

The other options on the Data tab are Apply Existing Sort, Transforms, and Encoding. The Apply Existing Sort check box is enabled if the exported object is open and a sort is applied. Access will export the data in the specified order. By clicking on the Transforms button you can select a custom XSL transform file to apply to the data during export. You can choose from the transforms you have written or received with the XML data. Use the Encoding drop-down list to select UTF-8 or UTF-16 encoding for the exported XML. The default is UTF-8.

When you export an object from an Access .mdb file, Access exports static data. This means that the exported object is not automatically updated when the data changes. If the data in the Access database has changed since you

Part V

exported an Access object to an XML data file, you will need to re-export the object so the new data is available to the client application.

Exporting live data is supported by Access data projects. If the underlying data in the database changes, the client application will receive the updated data automatically when it connects to the SQL Server database. If you are exporting an object from an Access Data Project (.adp) file that connects to the SQL Server database, the Data tab will contain the Live Data check box and the Virtual Directory text box above the Export Location section. The Virtual Directory text box holds the URL of the folder on the server that the export process should use. When exporting live data you must export the entire Access object (you cannot select individual records). The Live Data option also does not allow you to apply a transform during the export.

Schema Export Options

The options shown on the Schema tab (see Figure 29-9) control the way the schema file for the object is exported. Advanced schema options are presented in two sections: Export Schema and Export Location.

The Export Schema section has two check boxes. By selecting the Export Schema check box you indicate that you want to export the object's schema as an XSD file. This selection is the same as choosing the Schema of the data (XSD) option in the first Export XML dialog box (see Figure 29-2). The second check box allows you to specify whether you want to include or ignore primary key and index information in the XSD schema file.

The Export Location section has two option buttons that allow you to specify whether you want the schema information to be embedded in the exported XML data document or stored in a separate schema file. You can enter the filename in the provided text box and specify the location of the schema file by clicking the Browse button.

Data Scherra FiesenlatiDn

E Include prims* fcey and ¡rde* Information E::pcr: .ocatioT

O Errfced schema In exported XML dato docupert ® OeatB separate schema document Icustpmers.xsd

Data Scherra FiesenlatiDn

E Include prims* fcey and ¡rde* Information E::pcr: .ocatioT

O Errfced schema In exported XML dato docupert ® OeatB separate schema document Icustpmers.xsd

Figure 29-9: Use the Schema tab in the Export XML dialog box to set advanced schema options.

Taking Your VBA Programming Skills to the Web

Presentation Export Options

The selections on the Presentation tab (see Figure 29-10) specify available options for the XSL files. The Export Presentation (HTML 4.0 Sample XSL) check box allows you to indicate whether you want to export the object's presentation. Choose the Client (HTML) option in the Run from section if you want the presentation to run on the client. Access will create an HTML file with the script necessary to perform the transform. The script will be executed on the client machine. While this selection reduces the load on the server, a client application will need to download a couple of files (HTML document, XML data file, and XSD schema file) to present the data in the browser. If the XSL file is going to be placed on the web server and called from an ASP page, choose the Server (ASP) option. By choosing this option, only the final HTML is downloaded to the client.

Figure 29-10: Use the Presentation tab in the Export XML dialog box to set advanced presentation options.

If the exported presentation includes pictures, you can indicate whether to include them in the output by clicking the appropriate option button in the Include report images section. If you choose to include the images, Access will create separate image files and link them with the HTML file. By default, the image files are stored in the Images folder of the main export folder. To place them in another location, click the Browse button to specify the folder name.

The Export Location section allows you to specify the name and location of the export files. When you export a presentation file, Access creates two files: an XSL file that includes all the XSLT transforms needed to define how the data is presented and a simple HTML file that contains properly formatted data from the exported object and not the raw data with XML tags. The HTML file contains a snapshot of the data as it existed during the export process.

Part V

0 0

Post a comment