MSFT 407.94 -0.5921% AAPL 222.43 -0.2153% NVDA 138.22 2.0827% GOOGL 169.4305 -1.0856% GOOG 171.0674 -0.9167% AMZN 195.98 -0.9852% META 564.0961 -0.6646% AVGO 169.905 0.5831% TSLA 244.5901 -1.7632% TSM 191.71 -0.6427% LLY 806.5752 -0.7524% V 291.56 0.282% JPM 220.93 -0.9016% UNH 558.04 -0.0645% NVO 110.06 -1.6795% WMT 82.67 0.584% LVMUY 131.93 0.1746% XOM 118.34 2.9491% LVMHF 661.0 0.1697% MA 506.915 -0.2293%

XML (Extensible Markup Language)

Updated on August 29, 2023

What is XML (Extensible Markup Language)?

XML (Extensible Markup Language) is a text-based markup language. It is derived from SGML or Standard Generalized Markup Language. XML tags, unlike HTML tags, detect the data and are used for storing and managing data.          

What are the characteristics of XML?

  • XML is extensible. It means that there is a possibility that you can build your self-descriptive tags/languages that fits your application.
  • XML allows the user to store data irrespective of the way it is presented. This is one of the advantages XML has over HTML.
  • World Wide Web Consortium developed XML and is available as an open standard.
  • XML is used to store & transport data.
  • XML tags are self-descriptive.
  • The markup language is used to carry data. In HTML, we display data in a presentable way. Through XML, we can carry this data from one application to another.
  • XML tags are self-defined.
  • The language is platform and language independent. It means that whatever application you use like Java or through an oracle, there would be no impact on the XML page.
  • Facilitates easy communication between two platforms.

What are the Advantages of XML?

  • Separate data from HTML (HyperText Markup Language)
  • Simplifies data sharing
  • Increases data availability
  • XML simplifies platform change. For example, if you have a data on SQL server and want to import to oracle server, then it can be made possible through XML.

An Example to explain XML

A simple code to represent the above hierarchical structure in XML:

//*{mandatory line to start xml and is called declaration}//*

<?xml version= ”1.0” encoding = “ ISO-8859-1” ?>  

<college>

<class 1>

<name> ABC</name>

<roll> 01 </roll>

</class 1>

<class 2>

<name> DEF </name>

<roll> 02 </roll>

</college>

In this code, we have created our own tags like <college> <class> <name> and <roll>.  As highlighted in the diagram as well, there is a root element, and while writing an XML code, it is mandatory to have a root element.

It should be noted that the tags used in the code are case sensitive. Hence, the opening and closing tags should be in the same case (upper or lower). Also, XML is dynamic in nature.

How to Import an XML file into Excel?

One can import XML files in an Excel workbook to make them more readable for humans. The BI tool, Power Query makes it easy to import an XML file and transform it as per the user’s requirements.

Suppose you save the XML file mentioned above on your system as student.xml. To import the file, follow the steps mentioned below:

  1. Open excel and go to Data tab in the ribbon
  2. Click get data
  3. Select from the file
  4. Select From XML
  5. A window will open. Go to the folder where the file is saved and then click the button “Import”.
  6. In the next step, you would see that a navigator window open, and we can see a preview of data from the XML file in a table format.

What is an XML map?

XML maps are ways by which MS Excel (Excel) represents XML schemas within a workbook.  Excel uses maps using binding data from the XML file to cells and ranges on the worksheet. Through XML maps it is possible to export data from excel to XML. If there exists an XML map on the worksheet, the user can import data into map ant time.

XML schemas describe the elements used in the XML document and can be used by the programmers to verify each item in the document. It defines an element, attributes, and data types. Through XML map, XML schema gets copied to the workbook to create map instead of referencing the schema as an external file.

Using XML Maps, you can add and delete maps.

Once the XML file and schema are imported in the Excel file, the user can add further details and make desired changes. The edited file can again be exported to XML.

Where we develop XML code?

To create and modify XML code quickly and effortlessly, we can use Microsoft XML Notepad. With this tool, the structure of the XML data is shown graphically in a tree structure. The interface presents two panes:

  • One for the structure.
  • One for the values.

The user can add comments, attributes, elements, attributes, and text to the XML document by creating the tree structure in the left pane and entering values in corresponding text boxes.

Applications that support XML import and export:

  • RDBMS tools including IBM DB2 (pureXML), Microsoft SQL Server, Oracle Database and PostgreSQL.
  • Machine learning tools such as R Studio, and Python.