Share this Page URL

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

Working with XML Data in Access 574 If you click on the noun field, you'll notice that the it is indexed and that no duplicates are allowed. The XSD provides structure for the XML document, and Access imports the document with that structure. Access XML and the XML Schema Definition So now you have all this data in XML, but apart from Access, you know very little about the data and the fields that contain it. As we mentioned earlier, one of the documents that the Access export produces is an XML Schema Definition, or XSD. This XSD gives some structure to the XML docu- ment and puts constraints on the type of data the fields can contain. You might be asking yourself, "Since Access controlled the structure and made sure the fields con- tained the correct type of data, what use is the XSD now that we have exported the data from the Access table?" The answer to this question depends on how the exported XML document is going to be used. If the document is intended to be a snapshot of only the data in your Access table at a moment in time and be used for presentation purposes only, the XSD might not be all that useful or necessary. However, if you recall that an XML document is essentially a datastore (a table, if you will), that document can be used to store new data in addition to the data that came from the Access table. In a situation in which you're adding data to an XML document, the schema will ensure that the document is well formed and that the data being added to the document is uniform across the entire document. By using an XSD, you can make sure that a user doesn't enter text in a field that you want to ensure is numeric (such as a height or width field). Looking Inside the XSD The Access XSD is a part of the Microsoft Office 2003 namespace and so defines the structure for XML in enough detail that Office 2003 products are able to consume XML fairly cleanly. A name-