rsstrogen
v0.1.2
Published
XML and RSS serialization library for cuties.
Downloads
896
Readme
rsstrogen
A RSS and XML generation library. Built for my blog, usable elsewhere.
examples
A simple XML document:
import { XMLDocumentRoot, XMLRootElement, XMLElement, XMLDeclaration, XMLText } from 'jsr:@memdmp/rsstrogen/xml'; // npm:rsstrogen/xml also works, and so does `rsstrogen/xml` when installed from npm.
const doc = new XMLDocumentRoot().append(
new XMLDeclaration().version().encoding('UTF-8'),
new XMLRootElement('cat')
.setAttribute('colour', 'orange')
.append(
new XMLElement('head').append(new XMLText('1 braincell')),
)
);
console.log(doc.toString());A simple RSS feed:
const doc = new XMLDocumentRoot().append(
new XMLDeclaration().version().encoding(),
new RSSRootElement()
.channel(
new RSSChannelElement(
'Blog Posts',
'Some Description Here',
'https://example.com/blog/'
)
.pubDate(new Date('2001-09-11T08:46:40Z'))
.lastBuildDate(new Date())
.language('en')
.items(
new RSSItemElement(
'Lorem Ipsum',
'Ipsum de Lorem',
'https://example.com/blog/123456-awawa',
)
.author('[email protected] (Max Musterfrau)')
.guid('https://example.com/blog/123456', true)
.pubDate(new Date('2001-09-11T08:46:40Z')),
)
)
);
console.log(doc.toString());