Javascript required
Skip to content Skip to sidebar Skip to footer

How to Open an Xml Document in Excel

This tutorial explains what are XML files, how to create them, and how to open the XML file with a browser like Chrome, text editor like MS Word, Excel, and XML Explorer:

XML is an acronym for Extensible Markup Language. In this tutorial, we will understand what an XML file is and how to open a file in .xml format. We will also briefly understand how to create one.

Let us begin by understanding what it is.

How to open XML File

What You Will Learn:

  • What Is An XML File
  • How To Open XML File
    • With A Browser Like Chrome
    • With A Text Editor
    • With Excel
    • With XML Explorer
  • Open XML File On Mac
  • Open XML File Online
  • How To Create An XML File
    • With Notepad
    • With Eclipse
    • Frequently Asked Questions
  • Conclusion
    • Recommended Reading

What Is An XML File

As mentioned above, XML stands for eXtensible Markup Language. This language is similar to HTML. But what do we mean by Markup Language? A markup language is actually a computer language that uses tags to define text.

The tags are used to format the text while displaying the text is not pre-defined. This means that the tags used to write an XML file are defined by the writer of the file. In other words, an XML file is actually a text-based document that is given a .xml extension. So when you see a file with .xml file extension, you can know that it is an XML file.

Below is a code snippet from an XML file. We have saved this file as MySampleXML.xml

<?xml version="1.0" encoding="UTF-8"?>       <colour-list> 	<colour1> Red </colour1> 	<colour2> Blue </colour2> <colour3> Green </colour3>       </colour-list>        

In the next section, we shall see how to open files written in .xml format.

How To Open XML File

This question might come to your mind if you have never tried opening an XML file. You need not worry as it is very simple and there are several options available to do so.

The various ways to open the .xml file are as follows:

With A Browser Like Chrome

Using a web browser to open an XML file is a good choice. This is because browsers by default provide a tree structure that lets you expand/collapse different sections of the file as per need.

Follow the steps below to open a file in XML format using a web browser:

#1) Open File Explorer and browse to the XML file that needs to be opened. In the below image, we have browsed to the location containing our XML MySampleXML.

XMLviabrowser

#2) Right-click over the file and select Open With to choose a web browser to open the XML file. The Web browser may or may not appear in the list of options.

In case, it is not available on the list, select Choose another app as shown below:

Choose app to open

#3) Now, from the displayed lists, click on More Apps.

Click on More Apps

#4) Some more options are displayed in the list. Now scroll down and select the browser in which you wish to open the file. You can select any browser like Chrome or Internet Explorer from the list as shown below.  Select Internet Explorer and then click OK.

select any browser

#5) The file opens in Internet Explorer as shown below.

xml file

With A Text Editor

XML files can also be opened using a simple Text Editor like Notepad or Word. Follow the steps mentioned below to open an XML file using Notepad.

#1) Open Windows Explorer and browse to the location where the XML file is located. We have browsed to the location of our XML file MySampleXML as seen below.

XMLviaEditor

#2) Now right-click over the file and select Open With to choose Notepad or Microsoft Office Word from the list of options available to open the XML file. We are selecting Notepad here.

Select Open With to choose Notepad

#3) The XML file opens up in Notepad as shown below.

xml file in notepad

With Excel

You might be wondering how to open an XML file in Excel. It might surprise you to know that this is possible. However, it must be noted that this option is suitable as long as you do not have too many nested tags in your XML file.

Below we shall take a quick look at the steps for opening an XML file in Excel:

  1. Open MS-Excel and click File->Open.
  2. Browse to the location that has the XML file and click Open to open the file.
  3. A pop up with 3 options is displayed. Select As an XML table radio button.
  4. This opens and displays the XML file as an Excel table. The tags used in the XML file are actually used to convert it to an Excel table for display. This can at times cause issues during the display when there are too many nested tags.

With XML Explorer

There are quite a few XML file readers available to open and view XML files. We shall take a look at how you can open an XML file using XML Explorer. XML Explorer is an XML viewer that can handle large XML files which, as we saw above, can be difficult to open using Excel.

Tool Name: XML Explorer

xmlexplorer

Follow the steps below to use open XML files using XML Explorer

  • Download and install XML Explorer
  • Now Open XMLExplorer and select File -> Open.
  • Browse to the file location and open the XML file.

Price: N/A

Website: XML Explorer

Open XML File On Mac

Just as we described above the steps to open XML file using a text editor like notepad or Microsoft Word, similarly in Mac, one can use TextEdit to open the XML file.

Open XML File Online

If we wish to open an XML file using an online tool, then we do have such options available too. One such online XML editor is XmlGrid.net

Online Editor Name: XmlGrid.net

Home Page: XmlGrid

xmlgrid

Follow the steps below to open XML files online:

#1) Open URL XmlGrid

#2) Copy-Paste the code in the area indicated as shown below. In our case, we shall copy the code snippet that we created at the beginning of the article.

Copy-Paste the code

#3) Now click Submit to view the XML file.

xmlgrid submit file

Price: N/A

Website: XmlGrid

How To Create An XML File

In the above sections, we have seen how XML files can be opened in different ways. However, if we wish to create an XML file, then we should know the syntax rules. Below you can get a basic understanding of the XML syntax rules.

#1) XML uses tags that are not predefined or standard, which means that they are created by the person who is writing the XML file.

#2) Usually, the first tag begins by specifying the XML version and the encoding being used.

This is a standard tag and is called the XML Prolog and looks like below:

<?xml version="1.0" encoding="UTF-8"?>

#3) Encoding is needed by the browser to open the documents properly.

#4) The Prolog is not mandatory but should appear as the first tag if used.

#5) Every tag used should always have a closing tag, for example,

<Library> </Library>

#6) The tags are case sensitive. So we treat the two tags below as different tags.

<Library> and <library>

#7) Within the prolog tag are the elements which further have sub-elements within them.

#8) The structure is generally as below:

<root tag> <child tag> <sub child tag> </sub child tag> </child tag> </root tag>        

#9) As seen above, each of the tags should be nested in proper order.

Thus we have seen the basic rules for creating an XML file. Once you keep them in mind, you can use a text editor to create XML files. Let us see two such options available:

With Notepad

To create an XML file in notepad, follow the steps as mentioned below:

  1. Open Notepad on your computer.
  2. Keeping the above rules in mind create the XML file.
  3. Now save the file with a .xml extension.

With Eclipse

Eclipse, which is an IDE (Integrated Development Environment) can create XML files.

Follow the steps below to create an XML file in Eclipse:

  1. Open Eclipse on your computer.
  2. Use File -> New -> XML File. However, if you do not get the XML File option, then choose Other to locate XML File.
  3. When Select a Wizard dialog box opens, search for XML File and click Finish.
  4. Now a New XML File Wizard opens up.
  5. In this Wizard select a parent folder location for the XML file you want to create
  6. Enter the name of the XML file and click Finish.
  7. The file gets created within the parent folder

Frequently Asked Questions

Q #1) What is an XML file used for?

Answer: XML file stands for eXtensible Markup Language. It is mainly used to store and transport data in a structured manner. An XML file generally has text written with tags, similar to HTML.

Q #2) What is the difference between HTML and XML?

Answer: Although there are several differences between HTML and XML, however one major difference is that XML is mainly used for data transportation in a structured manner, whereas, HTML is used for designing web pages in an application which aids in the formatted display of the content.

Q #3) Is XML still used?

Answer: Yes, it is still in use today because it is of great use in sending and receiving data in a structured manner. Wherever an application involves sending/receiving data, we can use this language.

Q #4) Can Excel open XML files?

Answer: Yes, Excel can open files in XML format. Open MS-Excel and click File->Open. Now browse to the location that has the XML file and click Open to open the file. Select As an XML table radio button and you have the XML file open.

Q #5) What program opens XML files?

Answer: Various options are available to open XML files. XML files can be opened in a browser like IE or Chrome, with any text editor like Notepad or MS-Word. Even Excel can be used to open XML files. We also have Online editors to open XML files.

Conclusion

Hope this article has been helpful in improving your knowledge on the XML file format. In this article, we learned about what .xml file format is.

We also discussed how we can open files that are in XML format. We also saw how to open the XML file in Chrome and how to open the .xml file in Word or Notepad. We learned about the basics of XML tags and lastly, we briefly looked at how to create an XML file.

Also read =>> What is Google Chrome Software Reporter Tool

How to Open an Xml Document in Excel

Source: https://www.softwaretestinghelp.com/how-to-open-xml-file/