Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Tuesday, September 13, 2022

To write a program to import and export XML documents using Microsoft Accesss and Microsoft excel.

 

First Write the XML Program and save with .xml extention


<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
    
<name>Belgian Waffles</name>
    
<price>$5.95</price>
    
<description>
   Two of our famous Belgian Waffles with plenty of real maple syrup
   
</description>
    
<calories>650</calories>
</food>
<food>
    
<name>Strawberry Belgian Waffles</name>
    
<price>$7.95</price>
    
<description>
    Light Belgian waffles covered with strawberries and whipped cream
    
</description>
    
<calories>900</calories>
</food>
<food>
    
<name>Berry-Berry Belgian Waffles</name>
    
<price>$8.95</price>
    
<description>
    Belgian waffles covered with assorted fresh berries and whipped cream
    
</description>
    
<calories>900</calories>
</food>
<food>
    
<name>French Toast</name>
    
<price>$4.50</price>
    
<description>
    Thick slices made from our homemade sourdough bread
    
</description>
    
<calories>600</calories>
</food>
<food>
    
<name>Homestyle Breakfast</name>
    
<price>$6.95</price>
    
<description>
    Two eggs, bacon or sausage, toast, and our ever-popular hash browns
    
</description>
    
<calories>950</calories>
</food>
</breakfast_menu>


After then follow the following Steps.

For Excel:

1. Open the Excel file where you want to get the data from the XML file

2. Click the Data tab

3. In the ‘Get & Transform’ data group, click on the ‘Get Data’ option

4.Go to the ‘From file’ option

5.Click on ‘From XML

6. In the input data dialog box that opens up, locate the XML file that you want to import and select it.

7. Click Import. This will import the XML file into power query and open the Navigator dialog box

8. Select the data from the XML file that you want to import.


For access :

1. If necessary, open the XML or XSD file in Notepad that you want to import, and verify its data.
2. Open the desired database and, on the External Data tab, in the Import group, click XML File.
3. In the Get External Data - XML File dialog box, click Browse to locate the XML or XSD file.
4. In the File Open dialog box, navigate to the folder that contains the XML or XSD file you want to import, select the desired XML or XSD file, and click Open.
5. Select the file type All Files so that XML or XSD files will be displayed.
6. In the Get External Data - XML File dialog box, click OK.
7. If the file type is XML, in the Import XML dialog box, in the Import Options section, select the desired option and click OK.
8. If the file type is XSD, in the Import XML dialog box, click OK.
9. In the Get External Data - XML File dialog box, click Close.
10. If necessary, open the imported table and verify its structure.

No comments:

Post a Comment