XML Examples: Simple, Practical and Beginner Friendly
XML examples are one of the fastest ways to understand how XML works. Below are simple XML examples covering books, APIs, feeds, configuration files and nested structures.
- XML uses opening and closing tags.
- XML stores structured data.
- XML documents usually contain nested elements.
- XML is commonly used in APIs, feeds and enterprise systems.
Simple XML example
Here is one of the simplest XML examples:
<person>
<name>Jane Smith</name>
<age>45</age>
</person>
The XML document contains:
- A root element called
person - Nested child elements
- Structured readable data
Book XML example
XML is commonly used to represent books and catalog data.
<book>
<title>How to clean Floors</title>
<author>Jane Smith</author>
<year>1922</year>
</book>
Nested XML example
XML often contains nested structures with parent and child elements.
<company>
<employee>
<name>Jane Smith</name>
<role>Senior Floor Cleaner</role>
</employee>
</company>
This structure creates a clear hierarchy inside the XML document.
XML attributes example
XML elements can contain attributes.
<book id="101">
<title>XML Fundamentals</title>
</book>
The attribute in this example is:
id="101"
XML API example
Older APIs and enterprise systems often return XML responses.
<response>
<status>success</status>
<message>Data retrieved</message>
</response>
RSS feed XML example
RSS feeds are written in XML.
<rss>
<channel>
<title>CheeseBridge News</title>
</channel>
</rss>
XML configuration file example
XML is commonly used for software configuration files.
<settings>
<theme>dark</theme>
<language>en</language>
</settings>
Common XML rules
- Every opening tag must have a closing tag.
- XML is case-sensitive.
- Elements must be nested correctly.
- XML documents should contain one root element.
Invalid XML example
This XML example is invalid:
<name>Jane</Name>
XML is case-sensitive, so <name> and </Name> do not match.
Format or view XML online
Use CheeseBridge XML tools to format, validate and inspect XML directly in your browser.
Open XML Formatter Open XML ViewerTrusted XML references
For official and technical references, see:
Frequently asked questions
What is XML mainly used for?
XML is mainly used for structured data, feeds, APIs, enterprise integrations and configuration files.
Why is XML still used?
XML supports schemas, namespaces and document-style structures that many enterprise systems still rely on.
Can XML contain nested elements?
Yes. Nested structures are one of the core features of XML.