A lax Web news feed parser
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

153 lines
4.6 KiB

Minimal feed:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
Minimal feed without channel 1:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<item/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
Minimal feed without channel 2:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<image/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
Feed language 1: # demonstrate walking up the DOM
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/" xml:lang="fr">
<channel xml:lang=" "/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
lang: fr
Feed language 2:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/" xml:lang=" ">
<channel xml:lang="fr"/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
lang: fr
Canonical URL: # this is not a feature of RSS 0.90
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/" >
<channel rdf:about="http://example.com/"/>
</rdf:RDF>
output:
format: rdf
version: '0.90'
Feed link:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel>
<link/>
<link>http://[example.net]/</link>
<link>http://example.com/</link>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
link: 'http://example.com/'
Feed title 1:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel>
<title> Loose text</title>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
title:
loose: 'Loose text'
Feed title 2:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel>
<title xml:base="https://example.com/"> Loose text</title>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
title:
loose: 'Loose text'
htmlBase: 'https://example.com/'
Feed summary:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel>
<description>Loose text</description>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
summary:
loose: 'Loose text'
Feed channel image:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel>
<image>
<url>http://example.com/</url>
</image>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
image: 'http://example.com/'
Feed root image:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<channel/>
<image>
<url>http://example.com/</url>
</image>
</rdf:RDF>
output:
format: rdf
version: '0.90'
image: 'http://example.com/'
Feed channel and root images:
input: >
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://channel.netscape.com/rdf/simple/0.9/">
<image>
<url>http://example.net/</url>
</image>
<channel>
<image>
<url>http://example.com/</url>
</image>
</channel>
</rdf:RDF>
output:
format: rdf
version: '0.90'
image: 'http://example.com/'