A Beginner’s Guide to XML
You’ve probably heard of HTML, but have you heard of XML? Though XML is just as ubiquitous as HTML, it’s not nearly as well known as its counterpart. Robust demand set against a relatively small pool of professionals who can work with XML make it a great choice to study for career advancement.
Even better, XML’s open-ended yet simple structure makes it a much easier language to learn and master than other programming languages, great news for newbies looking to dip their toes into computer programming.
In this article, we’ll take a look at some of the basics of XML. We’ll start by looking at its history, putting the development of XML into context to understand its similarities and differences with HTML. Then, we’ll take a look at a basic example of XML to give you a general idea of how it works. Finally, for those who want to learn more, we’ll give some recommendations for both free and paid options to learn XML online. Let’s get started!
What is XML? History and applications
To understand XML and its role as a computer programming language, we have to go back to the earliest predecessor of what the markup language is today: SGML. SGML, which stands for Standardized Generalized Markup Language, was developed by IBM employees Charles Goldfarb, Ed Mosher, and Ray Lorie in the 1970s. SGML was designed as a meta-markup language, meaning that it was designed to define other markup languages. Its creation made HTML and XML possible.
Markup languages, including HTML and its lesser-known counterpart XML, consist of a set of symbols used to configure the structure, format, and internal logic of a text document. The creation of SGML in the 1970s was what made HTML possible in the late 1980s, a functional markup language that could be used in novel ways to modify the appearance of text documents.
Though HTML represented a fundamental breakthrough in web design, it wasn’t capable of everything. HTML was primarily designed as a tool to modify the appearance of data, not to store and categorize it: this shortcoming was what inspired the development of XML in the 1990s. XML’s uniqueness is clear from its full name, Extensible Markup Language: in contrast to HTML, it is “extensible,” meaning that users define and create their own tags.
Whereas the tags like <strong> for bold-faced type or <p> for paragraph are preset and cannot be modified by the user in HTML, XML users are free to make their own. This difference makes XML much more well suited for storing data. Users choose which pieces of information are relevant for their purposes and create their own elements accordingly.
Example of XML
To see what XML looks like in application, let’s take a look at the following example:
<?xml version="1.0" encoding="UTF-8"?> <book> <name>Amerika</name> <author>Franz Kafka</author> <language>German</language> <pages>327</pages> </book>
We start by opening with the tag <book>. Depending on what information we wish to store, we could have started with any tag we like: <movie>, <event>, <shipment>, any type of data that needs to be stored.
Following this opening element, we proceed by adding new elements that specify different pieces of information. Under <name>, we write the title of the book. Note that the elements above must be closed by repeating its name with a slash, like in <name>Amerika</name>. This is just like how tags are treated in HTML. Please note, however, that while most XML elements must be closed, some of its elements are self-closing, such as the command <br> for a line break.
Then, we use other tags to specify other pieces of information as we see fit: author, language, page number, etc. Again, because XML is an extensible markup language, we can choose different tags depending on which pieces of information we would like to store. At the end, we close out the entire entry with a closing tag containing a slash: </book>.
Keep in mind that an XML file does not perform an action in and of itself; it simply stores information. This is similar to how HTML operates: HTML provides the information or “blueprint” on how a web page should be formatted, but a separate application is needed to interpret that information and turn it into a viewable website.
Although XML files can be written in any text editor, an XML formatter makes things easier. For one, XML formatters detect and correct errors in your code, lightening the load for inexperienced users. Additionally, XML formatters automatically adapt the layout of your code to make it more readable by, for example, adding tabs in specific places.
Though there are a lot of XML formatters out there, we recommend the JSON formatter for beginners. As you type into the input column, it “beautifies” the text and reproduces it with improved readability in the output column. JSON is available directly from your web browser, so there’s no need to download software to use it.
Where to learn XML
XML is a very useful mark-up language, and knowledge of XML could land you a job as an XML editor, XML programmer, JSON developer, and much more. Since it is a comparatively easy programming language, learning XML with free resources can be a sufficiently thorough option for people who have experience with other languages or find XML to be intuitive.
In terms of free resources, it’s hard to beat W3Schools. W3Schools sets a high standard for accessible yet thorough computer programming language instruction. It offers free courses for many computer languages including XML, and user reviews rave about its intuitive interface and easily digestible lessons.
Additionally, Indiana University’s XML: The Essentials is an example of a university course offered for free outside of a major platform, and it covers all the essential topics to get the hang of XML.
While free options may be great for many, paid options can offer improved presentation and extended workforce applications. If that’s what you’re looking for, check out Udemy’s Excel XML, XPath, and XSLT Workflows courses.
A best-selling Udemy course, it covers all the essentials of XML while also going into detail about some of its auxiliary applications, including transferring XML information in and out of Excel, retrieving data from a webpage, and more. For a reasonably priced XML course filled with skills directly applicable in the workplace, Udemy is the way to go.
Although XML is a very user-friendly programming language, its relatively unknown status means that your chance of landing a job is stronger. A simple Indeed search comes up with 12,179 job results related to XML in the United States alone!
It’s clear that if you’re looking for an intuitive programming language with direct benefits to your job search, XML is a great choice.
Matthew is a freelance content writer whose work has previously appeared in well-known language-learning blog Fluent in 3 Months and The Happy Self-Publisher. His creative work has also appeared in Otoliths, CafeLit, and the Eunoia Review. He is currently based in Taipei, Taiwan, where he is studying for a master's degree in Chinese Literature.