Exporting Through XML Maps

Once you have created lists containing XML data, you can export that data to a new XML file from Excel two ways:

  • By saving the workbook using the XML Data file type

  • By clicking the Export XML toolbar button or selecting Export from the Data menu’s XML submenu

In either case, you can only export data using one XML map at a time. If a workbook contains more than one XML map, you are prompted to choose the map to use (Figure 3-13).

Exporting XML uses only one XML map at a time

Figure 3-13. Exporting XML uses only one XML map at a time

How it works

When Excel exports a list as XML, it uses the schema stored in the workbook to generate XML that matches the XML source file that the list was created from. However, Excel omits the following items:

  • Schema definitions

  • Processing instructions

  • XML nodes not included in the list

For example, if you create a list from SimpleOrder.xml containing only names and totals, only those elements are saved when you export the list as XML:

     <Orders>
         <Order>
             <BillTo>
                 <Address>
                     <Name>Joe Magnus</Name>
                 </Address>
             </BillTo>
             <Total>
                 <Due>572.4</Due>
             </Total>
         </Order>
         <Order>...</Order
     </Orders>

In the preceding XML, the original address and order information is omitted because it wasn’t included in the list. From Excel’s point of view, the data doesn’t exist if it doesn’t reside on a worksheet somewhere.

What this means

The limitations that come with XML maps imply a set of ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.