Skip to content

RDF Feed Reference

RDF (Resource Description Framework) Site Summary is an early XML-based syndication format that uses RDF metadata. Feedsmith provides full parsing capabilities.

Versions0.9, 1.0
NamespacesAtom, Dublin Core, Syndication, Content, Slash, Media RSS, GeoRSS-Simple, Dublin Core Terms, Well-Formed Web

Functions

parseRdfFeed()

Parses RDF feed content and returns a typed RDF object.

typescript
import { parseRdfFeed } from 'feedsmith'

const rdfFeed = parseRdfFeed(xmlContent)
// Returns: object with all fields optional and dates as strings

Parameters

ParameterTypeDescription
contentstringThe RDF XML content to parse

Returns

object - Parsed RDF feed with all fields optional and dates as strings

generateRdfFeed()

NOTE

RDF feed generation is currently work in progress and not yet available.

detectRdfFeed()

Detects if the provided content is an RDF feed.

Parameters

ParameterTypeDescription
contentstringThe content to check

Returns

boolean - true if content appears to be RDF format

Example

typescript
import { detectRdfFeed } from 'feedsmith'

const isRdf = detectRdfFeed(xmlContent)

Types

INFO

TDate represents date fields in the type definitions. When parsing, dates are returned as strings in their original format (see Parsing › Handling Dates for more details). When generating, dates should be provided as JavaScript Date objects.

ts
export type Image = {
  title: string
  link: string
  url?: string
}

export type TextInput = {
  title: string
  description: string
  name: string
  link: string
}

export type Item<TDate extends DateLike> = {
  title: string
  link: string
  description?: string
  atom?: AtomEntry<TDate>
  dc?: DcItemOrFeed<TDate>
  content?: ContentItem
  slash?: SlashItem
  media?: MediaItemOrFeed
  georss?: GeoRssItemOrFeed
  dcterms?: DctermsItemOrFeed<TDate>
  wfw?: WfwItem
}

export type Feed<TDate extends DateLike> = {
  title: string
  link: string
  description: string
  image?: Image
  items?: Array<Item<TDate>>
  textInput?: TextInput
  atom?: AtomFeed<TDate>
  dc?: DcItemOrFeed<TDate>
  sy?: SyFeed<TDate>
  media?: MediaItemOrFeed
  georss?: GeoRssItemOrFeed
  dcterms?: DctermsItemOrFeed<TDate>
}