Characteristic and use of XML

XML (eXtensible Markup Language) stores and carries data in self-describing tags you invent yourself, and unlike HTML (which is about displaying content) XML is about structuring data, which is why it is platform-independent and used for Android layouts, config files, and data exchange.

8 min read · 10 cards · 2 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

You have already read XML all unit

Every layout and the manifest in FestConnect Mobile were XML. But XML is bigger than Android: it is a general way to store and move data. Now imagine sending one fest registration from the app to a college server. You need a format both sides understand, that clearly labels each piece: name, event, year.

That is XML's real job. It looks like HTML (angle-bracket tags), but its purpose is different, and that difference is the heart of this lesson.

Theory

Labelled jars, not a printed poster

HTML is a printed poster: it decides how things look, headings big, paragraphs below. XML is a set of labelled jars: each jar is marked 'name', 'event', 'year', holding a value, saying nothing about appearance. You would not read a poster to a database, and you would not hang jars on a wall. Different tools for display versus data.

Theory

What makes XML, XML

XML (eXtensible Markup Language) structures data in tags:

  • Extensible: you invent your own tag names (<event>), unlike HTML's fixed set (<p>, <h1>).
  • Self-describing: the tag names describe the data inside.
  • Text-based and platform-independent: any system, any language can read it.
  • Separates data from presentation: it carries data; it does not display it.

Uses: data exchange between systems, configuration files, and in Android, layouts, the manifest, and string resources.

Practical

A FestConnect registration as XML

<registration>
  <name>Aditi Shah</name>
  <year>2</year>
  <event>Robotics</event>
  <paid>false</paid>
</registration>

<!-- Note: <name>, <year>, <event> are tags WE invented.
     XML does not display this; it just structures the data
     so any program can read each labelled value. -->

This example runs in Gri-Learn on the web, where you can edit it and see the output.

At a glance

XML vs HTML

AspectXMLHTML
Purposestructure datadisplay content
Tagsyou invent thema fixed set
Rulesstrict (well-formed)forgiving
Renders?no, data onlyyes, in a browser

Think first

Why 'self-describing' matters

A server receives the XML above with no manual attached. How does it know that 'Robotics' is the event and '2' is the year? Explain what 'self-describing' buys you.

Show the answer

Because each value is wrapped in a tag that names it: <event>Robotics</event>, <year>2</year>. The data carries its own labels, so the receiving program reads the tag to know what each value means, without a separate legend. That is 'self-describing'. Compare a bare CSV line Aditi,2,Robotics, which needs an external note saying which column is which. XML's labels travel with the data.

Quiz

Which statement best captures the difference between XML and HTML?

  1. XML structures data with custom tags; HTML displays content with predefined tags
  2. XML and HTML are the same language with different file names
  3. HTML lets you invent any tag; XML has a fixed tag set
  4. XML renders web pages in the browser like HTML does
Show the answer

XML structures data with custom tags; HTML displays content with predefined tags

XML is for structuring data using tags you define, while HTML is for displaying content using a fixed, predefined tag set (A). They are related (both markup) but not the same language (B). It is XML, not HTML, that lets you invent tags (C is backwards). And XML does not render a page by itself, it just holds data (D). Data vs display, custom vs fixed, is the exam answer.

Watch out

XML concept traps

1. 'XML displays data': no. XML stores/structures data; something else (a program, a stylesheet) decides any display. HTML is the one that renders.

2. 'XML has built-in tags': it does not. You define your own; that is what 'extensible' means.

3. Treating XML as loosely as HTML: XML is strict. Browsers forgive sloppy HTML, but XML must be well-formed (every tag closed, one root), which the next lessons cover.

Theory

Next: the rules that make it valid

XML's power comes with strict rules. The next lesson covers XML syntax, the declaration line, tags, and elements, and what 'well-formed' means: close every tag, quote every attribute, nest properly. Because Android refuses to build a layout with even one malformed tag, this is practical, not just theory.

Summary

Key takeaways

  • XML (eXtensible Markup Language) structures and carries data using self-describing tags you invent.
  • HTML displays content with a fixed tag set; XML structures data and does not render anything itself.
  • XML is text-based, platform-independent, and separates data from presentation.
  • Self-describing means each value carries its own label (tag), so any program can read it without a legend.
  • Uses: data exchange, config files, and Android layouts/manifest/string resources.
  • Memory hook: labelled jars (XML data) vs a printed poster (HTML display).

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from XML (Extensible Markup Language)

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Characteristic and use of XML · Mobile Application Development - 1 (option B) · Gri-Learn