Sample XML Files - Ready-to-Use XML Examples

Free downloadable XML files for testing, development, and learning

Published: January 2025 • 12 min read

Download free sample XML files for testing, development, and learning. Each file is ready to use with properly formatted XML data structures that follow XML 1.0 specifications.

These sample XML files cover common use cases including configuration files, data exports, SOAP messages, RSS feeds, and complex nested structures. Perfect for testing your XML formatter, XML validator, or any application that processes XML data.

Looking for More Examples? Check out ourXML examples article for detailed explanations or use ourXML file opener to view XML files online.

What is an XML File?

An XML file is a text file with an .xml extension that stores data in Extensible Markup Language format. XML files are:

Self-Descriptive

Tag names describe the data they contain, making XML easy to understand

Platform-Independent

Works across all systems, languages, and platforms without modification

Hierarchical

Nested structure perfect for complex data relationships and trees

Extensible

Define custom tags to match your specific data requirements

Learn more about XML files explained or how to open XML files.

Sample XML Files

1. User Profile XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<user id="12345">
  <personalInfo>
    <firstName>John</firstName>
    <lastName>Doe</lastName>
    <email verified="true">[email protected]</email>
    <phone type="mobile">+1-555-0123</phone>
    <dateOfBirth>1990-05-15</dateOfBirth>
  </personalInfo>
  <address>
    <street>123 Main Street</street>
    <city>San Francisco</city>
    <state>CA</state>
    <zipCode>94102</zipCode>
    <country>USA</country>
  </address>
  <preferences>
    <language>en-US</language>
    <timezone>America/Los_Angeles</timezone>
    <newsletter>true</newsletter>
  </preferences>
  <createdDate>2024-01-15T10:30:00Z</createdDate>
  <status>active</status>
</user>

Use Cases:

  • User registration and profile management systems
  • Customer relationship management (CRM) applications
  • Testing user authentication and profile APIs
  • Data migration and import/export operations

2. Product Catalog XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <product id="P001">
    <name>Laptop Pro 15</name>
    <category>Electronics</category>
    <price currency="USD">1299.99</price>
    <inStock>true</inStock>
    <quantity>45</quantity>
    <specifications>
      <processor>Intel Core i7-13700H</processor>
      <ram>16GB DDR5</ram>
      <storage>512GB NVMe SSD</storage>
      <display>15.6" FHD IPS</display>
      <graphics>NVIDIA RTX 4060</graphics>
    </specifications>
    <images>
      <image type="thumbnail">laptop-thumb.jpg</image>
      <image type="main">laptop-main.jpg</image>
    </images>
    <ratings>
      <average>4.5</average>
      <count>127</count>
    </ratings>
  </product>
  <product id="P002">
    <name>Wireless Mouse</name>
    <category>Accessories</category>
    <price currency="USD">29.99</price>
    <inStock>true</inStock>
    <quantity>230</quantity>
    <specifications>
      <connectivity>Bluetooth 5.0</connectivity>
      <battery>2x AA</battery>
      <dpi>1600</dpi>
      <buttons>6</buttons>
    </specifications>
    <images>
      <image type="thumbnail">mouse-thumb.jpg</image>
      <image type="main">mouse-main.jpg</image>
    </images>
    <ratings>
      <average>4.7</average>
      <count>89</count>
    </ratings>
  </product>
</catalog>

Use Cases:

  • E-commerce product management systems
  • Inventory management and tracking
  • Product data feeds and integrations
  • Testing search and filter functionality

3. Application Configuration XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appSettings>
    <setting key="ApplicationName" value="MyWebApp" />
    <setting key="Version" value="2.1.0" />
    <setting key="Environment" value="production" />
    <setting key="DebugMode" value="false" />
  </appSettings>
  
  <database>
    <connection name="primary">
      <server>db.example.com</server>
      <port>5432</port>
      <database>myapp_production</database>
      <username>dbuser</username>
      <maxConnections>100</maxConnections>
      <timeout>30</timeout>
      <ssl>true</ssl>
    </connection>
  </database>
  
  <logging>
    <level>info</level>
    <outputs>
      <output type="file" enabled="true">
        <path>/var/log/myapp/app.log</path>
        <maxSize>10MB</maxSize>
        <maxFiles>5</maxFiles>
      </output>
      <output type="console" enabled="true" />
    </outputs>
  </logging>
  
  <features>
    <feature name="DarkMode" enabled="true" />
    <feature name="Analytics" enabled="true" />
    <feature name="BetaFeatures" enabled="false" />
  </features>
  
  <security>
    <jwt>
      <issuer>https://auth.example.com</issuer>
      <audience>https://api.example.com</audience>
      <expirationMinutes>60</expirationMinutes>
    </jwt>
    <cors>
      <allowedOrigins>
        <origin>https://app.example.com</origin>
        <origin>https://admin.example.com</origin>
      </allowedOrigins>
    </cors>
  </security>
</configuration>

Use Cases:

  • Web application configuration files
  • Server and infrastructure settings
  • Environment-specific configurations
  • Testing configuration parsers

Web Service XML Samples

4. SOAP Web Service Request

XML
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope 
  xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:web="http://www.example.com/webservice">
  <soap:Header>
    <web:Authentication>
      <web:ApiKey>abc123def456ghi789</web:ApiKey>
      <web:Timestamp>2025-01-15T10:30:00Z</web:Timestamp>
    </web:Authentication>
  </soap:Header>
  <soap:Body>
    <web:GetOrderDetails>
      <web:OrderId>ORD-2025-001</web:OrderId>
      <web:IncludeLineItems>true</web:IncludeLineItems>
    </web:GetOrderDetails>
  </soap:Body>
</soap:Envelope>

Use Cases:

  • Enterprise SOAP web service integration
  • Legacy system communication
  • Testing SOAP endpoints and validators
  • B2B transaction processing

5. RSS Feed XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tech News Today</title>
    <link>https://technews.example.com</link>
    <description>Latest technology news and updates</description>
    <language>en-us</language>
    <lastBuildDate>Mon, 15 Jan 2025 10:00:00 GMT</lastBuildDate>
    <atom:link href="https://technews.example.com/rss" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Introduction to XML for Developers</title>
      <link>https://technews.example.com/xml-intro</link>
      <description>Learn XML basics with practical examples and best practices for modern development.</description>
      <author>[email protected] (John Smith)</author>
      <category>Tutorial</category>
      <pubDate>Mon, 15 Jan 2025 09:00:00 GMT</pubDate>
      <guid isPermaLink="true">https://technews.example.com/xml-intro</guid>
    </item>
    
    <item>
      <title>XML vs JSON: Choosing the Right Format</title>
      <link>https://technews.example.com/xml-vs-json</link>
      <description>Compare XML and JSON data formats to choose the best option for your project.</description>
      <author>[email protected] (Sarah Johnson)</author>
      <category>Comparison</category>
      <pubDate>Sun, 14 Jan 2025 15:30:00 GMT</pubDate>
      <guid isPermaLink="true">https://technews.example.com/xml-vs-json</guid>
    </item>
    
    <item>
      <title>Parsing Large XML Files Efficiently</title>
      <link>https://technews.example.com/parsing-xml</link>
      <description>Techniques for handling large XML documents without memory issues.</description>
      <author>[email protected] (Mike Chen)</author>
      <category>Performance</category>
      <pubDate>Sat, 13 Jan 2025 11:00:00 GMT</pubDate>
      <guid isPermaLink="true">https://technews.example.com/parsing-xml</guid>
    </item>
  </channel>
</rss>

Use Cases:

  • Blog and news feed syndication
  • Podcast RSS feeds
  • Content aggregation and distribution
  • Testing RSS readers and parsers

6. XML Sitemap

XML
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://www.example.com/</loc>
    <lastmod>2025-01-15</lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://www.example.com/about</loc>
    <lastmod>2025-01-10</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>https://www.example.com/products</loc>
    <lastmod>2025-01-14</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.9</priority>
  </url>
  <url>
    <loc>https://www.example.com/blog</loc>
    <lastmod>2025-01-15</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.8</priority>
  </url>
  <url>
    <loc>https://www.example.com/contact</loc>
    <lastmod>2025-01-05</lastmod>
    <changefreq>yearly</changefreq>
    <priority>0.5</priority>
  </url>
</urlset>

Use Cases:

  • Search engine optimization (SEO)
  • Google Search Console submission
  • Website structure documentation
  • Testing sitemap generators

How to Use These Sample XML Files

1. Copy XML Content

Copy any of the XML examples above and paste them into a text editor. Save the file with a .xml extension (e.g., user-profile.xml, products.xml).

2. Validate the XML

Use our XML Validator to ensure the XML is well-formed and fix any syntax errors before using it.

3. Format for Readability

Use our XML Formatter to beautify the XML with proper indentation if needed.

4. Test Your Applications

Use these XML files to:

  • Test XML parsers (DOM, SAX, StAX)
  • Mock SOAP and REST API responses
  • Validate XPath and XSLT transformations
  • Practice XML schema validation (XSD)

5. Convert and Transform

Use our tools to convert these files:

Common Use Cases for XML Files

Configuration Management

Store application settings, database connections, and environment variables. Examples: web.xml,app.config, applicationContext.xml

Web Services (SOAP)

Enterprise APIs and legacy systems use SOAP/XML for communication. Common in banking, healthcare, and government systems.

Data Exchange and EDI

B2B transactions, order processing, and electronic data interchange between organizations.

Document Formats

Microsoft Office files (.docx, .xlsx), SVG graphics, Android layouts, and many other document types use XML internally.

Content Syndication

RSS feeds, Atom feeds, sitemaps for search engines, and content distribution networks.

XML File Best Practices

1.
Always Include XML Declaration: Start with <?xml version="1.0" encoding="UTF-8"?>
2.
Validate Before Use: Use an XML validator to check for well-formedness and validity.
3.
Use Descriptive Tag Names: Choose clear, self-documenting element names like <firstName> not <fn>
4.
Proper Indentation: Use consistent indentation (2 or 4 spaces) for readability.
5.
UTF-8 Encoding: Always save XML files with UTF-8 encoding to support international characters.
6.
Consider Schema Validation: Create XSD schemas for critical data to enforce structure and data types.

Related XML Tools

Continue Learning