Share this Page URL

Chapter 16. Working with XML Data in Acc... > Importing an XML Document into Acces... - Pg. 573

Working with XML Data in Access Import an XML document with an XSD 1. 573 2. 3. Delete the existing Table1 by right-clicking on the table and clicking Delete on the shortcut menu. Click the Yes button when Access prompts you to verify that you want to delete the table. If the file doesn't already exist, open the sample file folder (by default, C:\ Microsoft Press \AccessInsideTrack\Chap16), and, copy the file ImportExample1.xsd to the same location as the .xml file ImportExample1.xml you created earlier. Modify the ImportExample1.xml file to include a reference to the XSD by opening the file in Notepad and adding the following property to the dataroot element: xsi:noNamespaceSchemaLocation="ImportExample.xsd" Your dataroot element should now look like this: <dataroot xmlns:xsi="" xsi:noNamespaceSchemaLocation="ImportExample.xsd"> 4. 5. 6. 7. 8. Be sure to save the file. On the File menu, click Get External Data, Import. In the Import dialog box, select XML in the Files Of Type drop-down list. Navigate to the folder where you saved ImportExample1.xml, and select that file. Click the Import button, and then click OK. Open the newly created table ImportExample1 in Design view. The table is imported in much the same way it was in the preceding import example. However, you now should notice significant differences in the field properties as shown in the following illustration. When Access imported the XML document, it set the Number field as the primary field and made it a Number data type.