XML Examples

Ready-to-use XML examples for developers. From RSS feeds to SOAP requests.

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>

More Examples