Create the XML Data File

Create the XML Data File


In this task, you create an XML data file in a text editor that is used later in this exercise.

To create the XML data file

  1. Start the text editor such as Notepad.
  2. Paste or type the following XML into the editor.
    <?xml version='1.0'?>
    <BookInfo>
    <Book>
    <ISBN>989-0-487-04641-2</ISBN>
    <Title>My World</Title>
    <Author>Nancy Davolio</Author>
    <Quantity>121</Quantity>
    </Book>
    <Book>
    <ISBN>981-0-776-05541-0</ISBN>
    <Title>Get Connected</Title>
    <Author>Janet Leverling</Author>
    <Quantity>435</Quantity>
    </Book>
    <Book>
    <ISBN>999-1-543-02345-2</ISBN>
    <Title>Honesty</Title>
    <Author>Robert Fuller</Author>
    <Quantity>315</Quantity>
    </Book>
    </BookInfo>
  3. Save the document as C:\BookData.xml.
  4. Close the text editor.                                                                                                                      
  5. Import the Schema and XML Data into Excel


    In this task, you import the schema created in the previous section into Excel to create an XML map and then import an XML data file.

    To create the Xml Map and then import the XML data file into Excel

    1. On the Developer tab, in the XML group, click Source to open the XML Source task pane.
    2. On the task pane, click Xml Maps.
    3. In the Xml Maps dialog box, click Add, navigate to the file BookInfo.xsd, click Open, and then click OK.
    4. In the XML Source task pane, drag the BookInfo node to cell A1. This action creates a table in the worksheet as shown in Figure 1. You can format the table as necessary.
      Figure 1. Table created from the Xml Map

      Table created from the Xml Map
    5. Next, import the XML data file. On the Developer tab, click Import.
    6. In the Import XML dialog box, navigate to the XML data file and then click Import. The data is mapped into the formatted table as shown in Figure 2.
      Figure 2. XML data is imported into the table

      XML data is imported into the table

Post a Comment

Previous Post Next Post