RSS 2.0
<enclosure>
The media file attached to an item — the element podcasting is built on, and the one whose length attribute is routinely wrong.
An enclosure is an empty element with three required attributes: url, length in bytes, and MIME type. It is how a podcast episode's audio file is attached to its item, and every podcast client reads it.
length is the file size in bytes, and it is required. Emitting 0, or a stale value from before re-encoding, breaks progress bars and seeking in several clients — a failure that never surfaces as a feed error.
What it contains
Nothing — this element holds a value rather than other elements. Its content is text, and the constraints below are what that text has to be.
Attributes
urlrequiredAbsolute URL of the media file.lengthrequiredSize in bytes. 0 is accepted by feeds and breaks clients.typerequiredMIME type, e.g. audio/mpeg.
What our validator does
We do not check enclosures — the attributes are not read, so a missing length or a zero one passes silently.
We do not catch this one
length="0" says the audio file is empty. Clients that trust it show a zero-length episode and cannot seek within it, and our feed checks do not read enclosure attributes at all — the two documents below produce the same verdict.Broken and fixed
Both documents below are well-formed XML — that is the point of this corpus — and both are run through the validator on every test run. The verdicts here are what it returned, not what we expect it to.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Example</title>
<link>https://example.com/</link>
<description>Notes from the example farm.</description>
<item>
<title>Episode 1</title>
<guid>https://example.com/ep1</guid>
<enclosure url="https://example.com/ep1.mp3" length="0" type="audio/mpeg"/>
</item>
</channel>
</rss><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Example</title>
<link>https://example.com/</link>
<description>Notes from the example farm.</description>
<item>
<title>Episode 1</title>
<guid>https://example.com/ep1</guid>
<enclosure url="https://example.com/ep1.mp3" length="24576000" type="audio/mpeg"/>
</item>
</channel>
</rss>Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.