The Advantages of XML

As we just mentioned, HTML is a fixed language that is used to define how data should be displayed across the Internet. In contrast, XML is a flexible method of providing data storage that can be sent across the Internet. XML uses tags, but they do not have a predefined function. The flexibility lies in the ability of the developer to create any tag that is needed. The following example shows an example of an XML file:


<ProductID>1</ProductID> <ProductName>Chai</ProductName> <SupplierID>1</SupplierID> <CategoryID>1</CategoryID>

<QuantityPerUnit>10 boxes x_20 ba,s</QuantityPerUnit> <UnitPrice>18</UnitPrice> <UnitsInStock>3 9</UnitsInStock> <UnitsOnOrder>0</UnitsOnOrder> <ReorderLevel>10</ReorderLevel> <Discontinued>0</Discontinued> </Products>

In the XML sample, there are record-level and field-level tags. The tag <Products> defines the start of a new record, and each field name has its own tag. All tags also have an ending tag that signifies either the end of the field or the end of the record.

In Access 2000 and 2002, it was possible to export data to XML, but that was the extent of the export. With the enhanced XML support in Access 2003, you can specify a transformation file (.xsl—Extensible Style Language) when you import or export data using XML. This transformation file is used to define how the data should be used. To better understand this concept, review the earlier HTML file and consider how the text is displayed in the browser when it is surrounded by the bold tags, that is, <b> This text would be in Bold</b>. XML is the text and XSL adds value to the text or raw data by providing the formatting and extra instructions.

With Access 2003, a transformation file can be generated during the export, and subsequently applied during an import. When you import XML data, the transformation file will be automatically applied to the data as soon as the data is imported, before a new table is created or before any data is appended to an existing table. So, the user sees only the formatted data. You may also notice XSDfiles. XSD is the XML Schema standard approved by the World Wide Web Consortium (W3C) for describing the type and structure of XML documents.

A second feature that has been incorporated in XML with Access 2003 allows users to drill into data. If desired, related data tables can be automatically generated during an export. They will be recovered during the import, along with their relationships. For added convenience and control, predefined filters or sort orders can also be applied. One easy way to learn about exporting using XML is to right-click a table, click Export on the shortcut menu, and select the file type of XML. Then, click Export. In the Export XML dialog box, click More Options. This will open the Export XML window shown in Figure 3-20. As you can see, it is easy to then apply filters and set several other options.

Figure 3-20

XML is the new standard for data transfers, and like HTML, it will be used for years to come. Learning to harness the flexibility and usefulness can be a tremendous benefit to your clients. They will be able to import data from a variety of sources and share data that will be consistently formatted. And if they want to, they can even allow the viewer to drill down for more details. The Access online help files and the

MSDN Web site provide additional information and detailed instructions on how to work with XML and how to create XSL style sheets. Another way of extending Access's reach is through integration with SharePoint Services.

Was this article helpful?

0 0

Post a comment