XML — RSS
What is RSS?
RSS (Really Simple Syndication) is an XML-based format for sharing content.
RSS Feed Structure
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>My Blog</title>
<link>https://example.com</link>
<description>A blog about technology</description>
<item>
<title>First Post</title>
<link>https://example.com/post1</link>
<description>This is my first post</description>
<pubDate>Mon, 01 Jan 2025 12:00:00 GMT</pubDate>
</item>
<item>
<title>Second Post</title>
<link>https://example.com/post2</link>
<description>This is my second post</description>
<pubDate>Tue, 02 Jan 2025 12:00:00 GMT</pubDate>
</item>
</channel>
</rss>
RSS Elements
| Element | Description |
|---|---|
| channel | Feed container |
| title | Feed/channel title |
| link | URL to website |
| description | Feed description |
| item | Individual entry |
| pubDate | Publication date |
Parsing RSS
fetch("feed.xml")
.then(res => res.text())
.then(str => new DOMParser().parseFromString(str, "text/xml"))
.then(xml => {
xml.querySelectorAll("item").forEach(item => {
console.log(item.querySelector("title").textContent);
});
});
Atom vs RSS
| Feature | RSS | Atom |
|---|---|---|
| Version | 2.0 | 1.0 |
| Namespace | No | Yes |
| Content | Description only | Full content |
| Feed ID | No | Required |
Mini Practice
- Create an RSS feed
- Add multiple items
- Parse an RSS feed
- Display feed content in HTML
Up Next
Continue with SOAP — Simple Object Access Protocol.
Related Topics
Frequently Asked Questions about RSS
What is RSS in XML?
RSS is a fundamental concept in XML. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn RSS?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn RSS.
Why is RSS important in XML?
RSS is essential for XML development. Understanding this concept will help you write better code and solve real-world problems more effectively.