General and Web Programming Fundamentals
  • Introduction
  • Program creation and design
    • Program design
      • Algorithms
      • Pseudocode
    • Programming conventions
    • Writing programs
      • Source code editors
      • Integrated Development Environments
      • Code repositories/Version control
      • Compilers/Interpreters
  • Programming Fundamentals
    • Operators
      • Arithmetic
      • Logical
      • Assignment
    • Constants and Variables
    • Datatypes
      • Primitive Datatypes
        • Character
        • Integer
        • Boolean
        • Floating point
        • Nothing (Null)
      • Composite Datatypes
        • Arrays
        • Strings
        • Classes
        • Structs
      • Literals
    • Data structures
      • Lists
      • Queues
      • Stacks
      • Map/dictionary
      • Trees
      • Graphs
    • Control structures
      • Selection (Conditional)
        • If/Else
        • Ternary
        • Switch
      • Iteration (Loops)
        • For loops
        • While loops
        • Do-While loops
        • For-Each loops
    • Functions
      • Parameters and arguments
      • Lambda expressions
      • Higher Order Functions
    • Space and Time
    • Scope
    • Standard libraries
  • Programming Paradigms
    • Procedural (Imperative) Programming
    • Object-oriented programming
    • Functional Programming
    • Declarative Programming
    • Event Driven programming
  • Programming Languages
    • Short history of programming
    • Low-level programming languages
    • High-level programming languages
  • Web Development
    • What is the web?
      • Web browsers (clients)
      • Webservers (serving web pages)
      • W3C
    • Markup languages
      • HTML
        • HTML Tags
      • Cascading Style Sheets (CSS)
        • CSS Properties
      • XML
      • Markdown
    • Scripting Languages
      • JavaScript
      • TypeScript
    • JSON
    • JavaScript Frameworks
  • Acknowledgements
    • About the author(s)
  • License
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Web Development
  2. Markup languages

XML

XML: An Overview

XML, which stands for Extensible Markup Language, is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The World Wide Web Consortium (W3C) standardized XML in 1998, and it has since become a cornerstone in the world of digital data.

History of XML

The history of XML dates back to the 1980s with the development of SGML (Standard Generalized Markup Language), which was a standard for defining the structure of documents. XML was developed as a simplified subset of SGML, aimed at making it easier to create and manage web documents. The primary goal was to enable generic SGML to be served, received, and processed on the web in the way that is now possible with HTML.

Primary Use of XML

XML's primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet. It is widely used in the encoding of documents and serialization of data. In web development, XML is used to create sitemaps, RSS feeds, and even in web services such as SOAP. Moreover, it serves as a base in more specialized markup languages like XHTML.

Syntax of XML

XML syntax is both straightforward and strict, which ensures that the structure of the data is maintained. Key points include:

  • Tags: Elements are enclosed in angled brackets, with a start tag, an end tag, and the content in between. For example: <greeting>Hello, World!</greeting>.

  • Attributes: Elements can have attributes, providing additional information. Attributes are included in the start tag: <note importance="high">Keep this in mind.</note>.

  • Tree Structure: An XML document forms a tree structure that begins at the "root" and branches to the "leaves".

  • Case Sensitivity: XML tags are case-sensitive. For instance, <Title> and <title> are considered different elements.

  • Well-Formedness: For an XML document to be considered "well-formed", it must follow specific syntax rules, such as properly nested and closed tags.

Example of a W3C Compliant XML Document

Below is an example of a simple, well-formed XML document that adheres to W3C standards:

<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>User</to>
  <from>Sender</from>
  <heading>Reminder</heading>
  <body>Don't forget to check the XML documentation!</body>
</note>

This XML document includes a declaration that specifies the XML version and encoding, followed by a root element <note> that contains four child elements. Each child element has a start tag, content, and an end tag, which demonstrates the basic structure and syntax of XML as required by the W3C.

PreviousCSS PropertiesNextMarkdown

Last updated 1 year ago

Was this helpful?