Today, Friday April 14, Mary Gillen discusses how to export Microsoft Access information as XML for use in a databinding application. NOTE: You must use the Internet Explorer browser to test and use this application.
Last week we chatted about how to create a searchable employee contact information app on your Web site using HTML, Javascript, XML file and Microsoft's Internet Explorer browser.

What if you have information already saved in a Microsoft Access database? How do you export it as XML? Here are the steps you can take to export information from any Access database to an XML file so it can be used in a databinding application.
1) Let's say you have a Microsoft Access database named company_staff. Inside the database is a table called employees. Click here to download a copy of this sample database. NOTE: This is a Microsoft Access 2003 file.
2) If we look at the employees table in Design View, this is how the information is structured:

3) To export this information as an XML file, click once on the employees table name to select it, then choose File > Export from the Access word menu.

4) In the Export Table As dialog box, select XML as the Save As Type

5) Enter the file name company_staff.xml in the File name box, and click the Export button.

6) In the Export XML dialog box, select only the option for XML data (we will talk about XSD and XSL in future posts) and click the OK button.

7) Open the company_staff.xml file in Notepad or SimpleText. HINT: Microsoft Access will export the XML to the same location where your Access database is stored on your computer. If you are using Notepad, be sure the "Files of type" dropdown menu at the bottom of the Open dialog box is set to "All Files" so Notepad will show the company_staff.xml file for you to select.
8) On line 1 of the code, edit the XML prolog element that looks like this:

to this

9) On line 2, edit the root element that looks like this:

to this

10) On line 51, edit the </dataroot> element from this

to this

11) Save the file
Congratulations. You have just generated an XML file from information in your existing Access database. You can now use it with the application discussed on April 7.
Next week I will show you, step-by-step, how to use databinding for the output of recordsets of information.
Have a good weekend. See you Monday.
Contact Mary | About Mary