demo · v152 · deprecation
OPML importer
OPML is the classic XML format every RSS reader speaks for moving subscriptions around. It's the kind of thing people used to render with XSLT directly in the browser. Here it is in 50 lines of modern JS: drop your OPML file, get a structured outline tree, exportable as JSON or back as cleaned-up OPML.
drop an .opml file here — or click to select
categories
0
feeds
0
duplicates
0
missing xmlUrl
0
Outline
Drop an OPML file or paste XML…
What it shows
- OPML is XML. XSLT could render it in-browser; nothing else could.
- Modern parsing uses
DOMParser+ an<outline>recursion — five lines. - Validation spots feeds missing
xmlUrl, duplicate URLs, and broken category nesting — things XSLT couldn't elegantly express. - Export rebuilds the OPML or emits JSON — the JS path generalises in a way the XSL one couldn't.
function parseOpml(xml) {
const doc = new DOMParser().parseFromString(xml, "application/xml");
function walk(node) {
return [...node.querySelectorAll(":scope > outline")].map(el => ({
title: el.getAttribute("title") || el.getAttribute("text"),
xmlUrl: el.getAttribute("xmlUrl"),
htmlUrl: el.getAttribute("htmlUrl"),
type: el.getAttribute("type"),
children: walk(el),
}));
}
return walk(doc.querySelector("body"));
}