HandsOn Examining the Contents of an XML Data File

1. Open Windows Explorer and switch to the Learn_XML folder. Figure 29-3 displays the contents of the Learn_XML folder after exporting the Shippers table to XML in Hands-On 29-1.

Figure 29-3: After exporting the Shippers table to XML with all three check boxes selected in the Export XML dialog box (see Figure 29-2), Access creates four files. The fifth file (shown first in this screen shot) is the ReportML file. If you didn't make changes in the registry as mentioned at the beginning of this section, your Learn_XML directory listing will not contain the Shippers_report file.

Figure 29-3: After exporting the Shippers table to XML with all three check boxes selected in the Export XML dialog box (see Figure 29-2), Access creates four files. The fifth file (shown first in this screen shot) is the ReportML file. If you didn't make changes in the registry as mentioned at the beginning of this section, your Learn_XML directory listing will not contain the Shippers_report file.

Note: To have the file extensions displayed, choose Tools | Folder Options, click the View tab, and clear the check box next to Hide extensions for known file types.

2. Highlight the Shippers XML document (Shippers.xml) and choose Open With from the File menu. Select Internet Explorer. Access displays the Shippers data in XML format as shown in Figure 29-4.

Taking Your VBA Programming Skills to the Web

H C:\Leam_XML\ShTppers.xml - Microsoft Internet Explorer

File Edit View Favorites Toob bdç>

Address [jg?| CflLegn_X1ML\Shippers,Mri_v Q Go e

Links version='1. G " encüdlng='UTF-3" î> - cdataroot Kmlris;od=num:scheinas"micro5oft-com:officedata" i "I h 111 :: / / .'M1. ^ J : i I ] :' I ] / ,[ i: 11 / X^l^ (I It ' (: h instance" >:s : noNarnespaca£chernaLocation="Shippcr5.>isd" generated= '2 004-10 -17T22 ; 12:5 3" >

< Com p-gnyN a me > 5p u edy E press e/com p ariyN a me > <Phona>(S03) 55S-9831</Phorie:>

< Com p anyN a me >Un ¡red p a ckag e</c Q mpan y Nam e> <Phona>(503) 555-3199</PhdnB>

</shippers>

<CGmpanyName>Federal y It i p pmC D m p d ri y1 N a trip> <Phone>(S03) 555-9931-î/Phorieï </Shippers> </datareot:>

_j My Computer

Figure 29-4: The tree-like structure of the XML document.

When you open an XML file in Internet Explorer, you can see the hierarchical layout of an XML document very clearly. The plus/minus (+ / -) signs make it possible to display the document as a collapsible tree.

The first line in the XML file is a processing instruction. Processing instructions begin with <? and end with ?>. The XML document begins with a processing instruction that contains an XML declaration:

<?xml version="L0" encoding="UTF-8" ?>

The version attribute (version="1.0") tells the XML processor that the document conforms to version 1.0 of the XML specification. The encoding attribute (encoding-'UTF-8") is used to indicate character sets to web browsers. By default, XML documents use the UTF-8 encoding of Unicode.

0 0

Post a comment