Skip to content.
|Networking government in New Zealand.
 

RSS implementation

The news import files should be formatted as RDF 1.0, with a single channel. The file must be encoded as UTF-8.

All of the RSS core schema elements along with the 3 modules (defined above) and the NZGLS extensions (see below) can be used within an RSS file. They may be used as required (and within the limits of the standard).

The following sample RDF blocks should be used as a guide only. Please note that the RDF blocks given below are examples and may contain information that is fictional or only partially complete.

3.1 Header

Each RDF document should start as follows:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/"
  xmlns:nzgls="http://www.nzgls.govt.nz/standard/"
  xmlns:dc="http://purl.org/rss/1.0/modules/dc/"
  xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
>

You may not need all of the xmlns includes. If this is the case, simply leave out those includes that are not required (the top three are always required).

3.2 Channel

A channel should follow the header. Please note that the URL specified in the rdf:about attribute should be unique within an RSS file. This URL is commonly the place where the RSS file can be found (it may also be the home page of the content being described).

<channel rdf:about="http://www.ssc.govt.nz/xml/news.rdf">
  <title>State Services Commission News</title>
  <link>http://www.ssc.govt.nz/news/</link>
  <description>The State Services Commission News</description>

  <dc:creator>news@ssc.govt.nz</dc:creator>
  <dc:language>en-nz</dc:language>
  <dc:publisher>State Services Commission</dc:publisher>

  <syn:updatePeriod>daily</sy:updatePeriod>
  <syn:updateFrequency>2</sy:updateFrequency>

The channel must contain a title that describes the source of this news. The link element must also be present and must point to a place where a textual version of this news can be found. This is typically a URL that points to a HTML page. The optional description can be used to describe this channel. In the example above the description contains the name of the news source.

The Dublin Core elements (dc) allow the creator to add specific information about the channel. The examples above show the use of the creator, language and the publisher elements. These elements are optional but are highly recommended.

The Syndication elements (syn) allow the feed to hint to the aggregator how often the content should be fetched. In this example, the feed has hinted that it should be fetched twice daily. The aggregator may ignore this information because this it is considered to be a hint only. These elements are optional but are highly recommended.

The channel must contain a list of links of the news items that are present in the file. This is represented using an RDF sequence of links to the actual news items. There should be a link at this point for every news item that will appear in the file (after the closing channel element).

  <items>
    <rdf:Seq>
      <rdf:li rdf:resource="http://www.ssc.govt.nz/disability-mentoring-day" />
      <rdf:li rdf:resource="http://www.ssc.govt.nz/appt-ce-natlib-oct02" />
      ...
      ...
    </rdf:Seq>
  </items>
</channel>

3.3 Items

The actual news content should be formatted as follows: Each item must include atitle,link, nzgls:date.valid, nzgls:identifier andnzgls:type.agency at the minimum. Further fields can be added from NZGLS, dc or content as required (within the limitations of the specification).

Please note that the content of the description field should consist of pure text and should not contain any HTML or XML mark-up, or CDATA clauses.

<item rdf:about="http://www.ssc.govt.nz/disability-mentoring-day">
  <title>Applications invited for Disability Mentoring Day</title>
  <link>http://www.ssc.govt.nz/disability-mentoring-day</link>
  <description>The State Services Commission, through its Mainstream Employment Programme, is 
pleased to host the first New Zealand Disability Mentoring Day: Career Development for the 21
Century. Disability Mentoring Day will be celebrated in Wellington on Tuesday 12 November 2002.
Applications are now invited from people with disabilities from departments and other State sector 
organisations to be mentors for the day, and from tertiary students with disabilities who would like
to take part as mentees.</description>
  <nzgls:date.valid>start=2002-10-07; end=2002-11-12T19:00:00+12:00</nzgls:date.valid>
  <nzgls:identifier>20021007-0015-SSC</nzgls:identifier>
  <nzgls:type.agency>State Services Commission</nzgls:type.agency>
</item>
<item rdf:about="http://www.ssc.govt.nz/appt-ce-natlib-oct02">
  <title>Appointment of National Librarian announced</title>
  <link>http://www.ssc.govt.nz/appt-ce-natlib-oct02</link>
  <description>The State Services Commissioner, Michael Wintringham, announced today the appointment 
of Penny Carnaby as Chief Executive of National Library of New Zealand and National
Librarian...</description>
  <nzgls:date.valid>2002-10-09</nzgls:date.valid>
  <nzgls:identifier>20021009-0016-SSC</nzgls:identifier>
  <nzgls:type.agency>State Services Commission</nzgls:type.agency>
  <nzgls:type.document>News</nzgls:type.document>
</item>

3.4 The end

Finally, the RDF closing statement should mark the end of the document:

</rdf:RDF>

[ Previous | Next ]