Viewing the XML Source File in Internet Explorer

To become more familiar with the structure of the XML document, let's open it now in the browser.

The following exercise demonstrates how to use Internet Explorer to view the content of XML files.

1. Open the Units.xml file in Internet Explorer by typing the following instruction in the Immediate window:

Shell "Explorer.exe Units.xml"

Explorer opens with the specified file (Figure 17-7).

When you open an XML file in Internet Explorer, you can see the hierarchical layout of an XML document very clearly. IE automatically places a

Tip 17-6: What is a Parser?

If you want to read, update, create, or manipulate any XML document, you will need an XML parser. A parser is a software engine, usually a dynamic-link library (DLL), that can read and extract data from XML. Microsoft Internet Explorer 5 or higher has a built-in XML parser (MSXML.DLL, MSXML2.DLL,

MSXML3.DLL) that can read and detect all non well-formed documents. MSXML has its own object model, known as DOM (Document Object Model), that you can use from VBAto quickly and easily extract information from an XML document.

C. \J K_B 0 0 K5_AL aceLE N_2002\Chdpter£New^Chdptei_T 7\U niti. Kinl - Miui...

Fie Edit View Favorites Tocte Help

4-Ber:. - iâ g] I § Search J^Favontes History | ^ MJM

Address |N] C:VJK_BOOKS_ALLNE«ceLEN„2002\ChaptersNew\Chaptef-17\Unils.xml 3 f>Go

Links Customize Links ^Sj Free Holmail Liquid Music Network Welcome to Liqud Audio

<?jtml versions" 1.0" ?> - <Workbook xmlns=*urn:schem3s-microsoft-

com:office:spreadsheet" xmlns:o=*urn:schemas-microsoft-co m: office ¡office" xmlns:x=aurri:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-rnîcro5oft-ca m : off ice : s p rea dsh e et "

xmlns : html='"http ://w ww. w3.org/TR/REC-htm 140"> + <DocurnentProperties xmfn£="urn:schemas-mtcrosoft-

com :offîce :office*> + «DfficeDocumentSettings xmlns="urn:schemas-microsoft-

com roffice :office"> + <ExcelWorkbook xmlrts="urn ¡schemas-microsoft-

- <Worksheet ss:Name="Units"> + cTable se; ExpandedColurnnCount=fc5"

ss: ExpandedRawCount="16" x: FullColümns="l" x:Fg|fRows="l*> + <Workshee top t ioris xml ns=" urn ¡schema s-micros oft-

co m : off ice : e x ce I" > </Worksheet> + <Worksheet ss;Narrte="Sheet2"> + <Worksheet ss:Name="Sheet3"> </Workbook>

Hill My Computer

Figure 17-7:

Raw (unformatted) XML file opened in Internet Explorer plus/minus (+ / -) sign, so it is possible to expand and collapse your XML data in the browser. Earlier in this chapter, you learned that XML documents must be well-formed. To verify that the document is well-formed, it's a good idea to open it in the browser. Figure 17-8 shows how the browser displays the document with the same error that was presented earlier (see Figure 17-5).

Figure 17-8:

A quick way to check whether an XML document is well-formed is by opening it in a browser, such as Internet Explorer

Figure 17-8:

A quick way to check whether an XML document is well-formed is by opening it in a browser, such as Internet Explorer

0 0

Post a comment