MSFT 415.85 -0.4643% AAPL 228.66 0.1665% NVDA 145.315 -1.153% GOOGL 175.65 -1.3867% GOOG 177.07 -1.3977% AMZN 202.88 -0.8455% META 564.135 0.5427% AVGO 162.61 -1.6571% TSLA 342.2799 -1.0752% TSM 186.825 -1.5% LLY 754.385 3.3786% V 307.39 -1.4302% JPM 240.935 -0.8865% UNH 601.41 4.2305% NVO 105.52 2.8159% WMT 87.12 0.6005% LVMUY 121.8 -0.5471% XOM 119.97 1.1296% LVMHF 607.0 -0.9465% MA 512.64 -1.3129%

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.