XML Examples
Ready-to-use XML examples for developers. From RSS feeds to SOAP requests.
About XML
XML (eXtensible Markup Language) is a powerful markup language for encoding documents and data. While JSON has become popular for web APIs, XML remains essential for enterprise systems, configuration files, document formats, and legacy integrations.
These examples showcase common XML patterns including RSS feeds, SOAP web services, Android layouts, Maven configurations, and SVG graphics.
Common XML Use Cases
๐ฐ RSS/Atom Feeds
News feeds and blog syndication use XML-based RSS and Atom formats.
๐ SOAP Services
Enterprise web services use SOAP with XML for requests and responses.
๐ฑ Android UI
Android app layouts and resources are defined in XML files.
Simple XML Document
Basic XML structure with elements
<?xml version="1.0" encoding="UTF-8"?>
<person>
<name>John Doe</name>
<email>[email protected]</email>
<age>30</age>
<active>true</active>
</person>RSS Feed
Standard RSS 2.0 feed format
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Tech News</title>
<link>https://example.com</link>
<description>Latest technology news</description>
<item>
<title>New Framework Released</title>
<link>https://example.com/news/1</link>
<description>A revolutionary new framework...</description>
<pubDate>Tue, 14 Jan 2026 10:00:00 GMT</pubDate>
</item>
<item>
<title>AI Breakthrough</title>
<link>https://example.com/news/2</link>
<description>Scientists announce major AI advancement...</description>
<pubDate>Mon, 13 Jan 2026 15:30:00 GMT</pubDate>
</item>
</channel>
</rss>SOAP Request
SOAP web service request envelope
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:api="http://example.com/api">
<soap:Header>
<api:Authentication>
<api:Token>abc123xyz</api:Token>
</api:Authentication>
</soap:Header>
<soap:Body>
<api:GetUserRequest>
<api:UserId>12345</api:UserId>
</api:GetUserRequest>
</soap:Body>
</soap:Envelope>Android Layout
Android UI layout XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World"
android:textSize="24sp" />
<Button
android:id="@+id/submitButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>Maven POM
Maven project configuration
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-app</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>SVG Graphics
Scalable Vector Graphics
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
width="200" height="200" viewBox="0 0 200 200">
<circle cx="100" cy="100" r="80"
fill="#3b82f6" stroke="#1d4ed8" stroke-width="4"/>
<text x="100" y="110"
text-anchor="middle"
fill="white"
font-size="24"
font-family="Arial">SVG</text>
</svg>