Format RSS and Atom Feed XML for Readability
Format RSS 2.0 and Atom feed XML documents. Understand feed structure, channel/entry elements, enclosure handling, and how to make syndication feeds human-readable.
Detailed Explanation
Formatting RSS and Atom Feeds
RSS and Atom are XML-based syndication formats used to publish frequently updated content. Raw feed XML is often minified or poorly indented. Formatting makes the feed structure clear and easy to inspect.
RSS 2.0 Structure
<rss version="2.0">
<channel>
<title>DevToolbox Blog</title>
<link>https://www.dev-toolbox.tech/blog</link>
<description>Developer tools and tutorials</description>
<language>en-us</language>
<item>
<title>Understanding XML Namespaces</title>
<link>https://www.dev-toolbox.tech/blog/xml-namespaces</link>
<description>A guide to XML namespace handling...</description>
<pubDate>Mon, 01 Jan 2024 00:00:00 GMT</pubDate>
<guid>https://www.dev-toolbox.tech/blog/xml-namespaces</guid>
</item>
</channel>
</rss>
Atom Feed Structure
<feed xmlns="http://www.w3.org/2005/Atom">
<title>DevToolbox Blog</title>
<link href="https://www.dev-toolbox.tech/blog" />
<updated>2024-01-01T00:00:00Z</updated>
<entry>
<title>Understanding XML Namespaces</title>
<link href="https://www.dev-toolbox.tech/blog/xml-namespaces" />
<id>urn:uuid:1234-5678</id>
<updated>2024-01-01T00:00:00Z</updated>
<summary>A guide to XML namespace handling...</summary>
</entry>
</feed>
Key Differences Between RSS and Atom
| Feature | RSS 2.0 | Atom |
|---|---|---|
| Root element | <rss> |
<feed> |
| Item container | <item> |
<entry> |
| Date format | RFC 822 | ISO 8601 |
| Content | <description> |
<summary> / <content> |
| Namespace | None required | Required (xmlns) |
Media Enclosures
RSS feeds for podcasts use <enclosure> elements to reference audio files:
<enclosure url="https://example.com/ep1.mp3"
length="12345678"
type="audio/mpeg" />
Extended Namespaces
Feeds often include namespace extensions like dc: (Dublin Core), content: (content:encoded for full HTML), itunes: (podcast metadata), and media: (Media RSS). Formatting keeps these namespace-prefixed elements clearly structured.
Use Case
RSS/Atom formatting is essential for developers building or debugging feed readers, content teams auditing their site's RSS output, podcast publishers verifying their feed structure for iTunes/Spotify submission, and SEO professionals checking feed metadata for proper syndication across aggregators.
Try It — XML Formatter
Related Topics
Format and Pretty-Print XML Online
Basic Formatting
Format SOAP XML Messages — Envelope, Header, and Body
XML Types
XML Encoding Declaration — UTF-8, UTF-16, and Character Sets
Validation
XML Namespace Validation — Prefixes, URIs, and Scope
Validation
XML Entity References — Predefined, Numeric, and Custom Entities
Advanced