The XML Flattener

It's quite interesting to see how Excel 2002 deals with XML files that have been created outside of Excel but do not use the XML-SS that Microsoft uses to describe spreadsheet data. Let's again assume that you've just received an e-mail with an XML file attachment listing the VBA course schedule for the coming year. The Courses.xml file is shown in Figure 17-11. You don't care how this file was generated. It could have been typed directly in a text editor or outputted from a database using a programming language. Now that you've got the data, you want to view it in Excel. Figure 17-12 displays the Courses.xml file opened in Excel.

With Excel being a spreadsheet application, it looks at your XML file and tries to display it in a familiar spreadsheet format using its built-in

Couises.xml - Notepad

Fte Edt Formât Help

<?xml version="1,0"?> <Courses>

<Ti!l e> B eg in ni ng VBA i n Exce I </T¡tie> *sia rtdate >2/3/2 00 3 «íSla rtdate > <Se ss io ns > 6</S ess i ons > </Course>

<Course ID="VBA2E>T>

<Tille> Interme di aie VBA in Excel</Titie> <Sta rtdate >4/3/2 00 3 <*Sía rtdate > «Se ss ¡o ns » 8</S ess i ons > </Course>

«Tille»Advanced VBA in Excel</Trtle> <Sta rtdate >6/3/2 00 3 <fSia rtdate > <Sessions>12</Sessions> «/Course» </Courses>

zi

□ Micioioft Excel Cowícs.*m( IRcad Only]

UHR

BJ Ete Edit !¿¡ew Inssil Fflimat lóete J¿cta Window

iÍElp

Type a qh&ûh fai heb - _ ? x

: Ane

il Ct * !□ T J U ^ z = EÜ

a % ,

/i t* _ - - A - ;

i D c^ s m 1 m B y x ^ es - -

« E •

îtït üiü^ -<3-

Al T fi /Courses

A I B It

0

E ! F -n

[«■» »'CUUKMMI (..«tiiil..«- («MtMMi tBirtedH» _

3

VBsi Ë>: Ë b zitjjjQDj

b eginni ng VHA ; n Excel

a

VÉ¡A2EX 0 S ÎÏ3I20CI3

Inte-msüiate VBA in Excel

b

VBA3 EX 12; 13

arjiiüüj

AtKianceüVBAiü Excel

b

-il

H H

* ' .LOJtîCi /

J-iJ

f tir

Dim- Ej AiuShw \ □ O 4 0 Lîl E

» - ¿

- ¿,-ËB^I M .

Red.

fr'

This sample XML document is not based on an XML namespace and schema defined by Microsoft (xmlns="urn:schemas-microsoft-com:office:spreadsheet").

0 0

Post a comment