RSS Validation
2025-01-16 RSS XML XML::LibXML XSD SchemaMy wife was trying to setup RSS for her web - poplety.cz. In case you don’t know, the RSS stands for RDF Site Summary or Really Simple Syndication. It is basically XML-based format that provides overview of recent changes on your web-site.
There is many tools to work with the format. I am using feedly to follow updates on my favorite pages. This is how it shows last updates on this web:
There is a specification for the format. Unfortunately there is no official XML schema to easily validate the files. Googling a bit, I found some schemas of varying quality. After some testing, I selected this one, quite detailed version that also include checking of included emails and dates.
I covered checking a XML file against a schema in one of previous posts, the code is rather simple utilization of XML::LibXML library in for perl:
use XML::LibXML;
use Try::Tiny;
my $filename = shift;
my $dom = XML::LibXML->load_xml( location => $filename);
my $schema = XML::LibXML::Schema->new(location => 'rss-2_0_1-rev9.xsd');
try {
$schema->validate($dom)
}
catch {
die "There is a problem with the configuration: $_";
};
print "The $filename is valid\n";
Using this tool, I was able to quickly find problems with her file - there was one mismatched tag and one invalid date format.