XML::Generator::RSS10::gcl - Support for the UK Government Category List (gcl) specfication


XML-Generator-RSS10-gcl documentation Contained in the XML-Generator-RSS10-gcl distribution.

Index


Code Index:

NAME

Top

XML::Generator::RSS10::gcl - Support for the UK Government Category List (gcl) specfication

SYNOPSIS

Top

    use XML::Generator::RSS10;

    my $rss = XML::Generator::RSS10->new( Handler => $sax_handler, modules => [ qw(dc egms gcl lgcl) ] );

    $rss->item(
                title => '2004 Council By-Election Results',
                link  => 'http://www.example.gov.uk/news/elections.html',
                description => 'Results for the 2004 Council by-elections',
                dc => {
                   date    => '2004-05-01',
                   creator => 'J. Random Reporter, Example Borough Council, j.r.reporter@example.gov.uk',
                },
                egms => {
                   SubjectCategory => [
                                         ['GCL','Local government'],
                                         ['LGCL','Elections'],
                                         ['LGCL','News announcements']
                                      ]
                }
              );

    $rss->channel(
                   title => 'Example Borough Council News',
                   link  => 'http://www.example.gov.uk/news/',
                   description => 'News releases from Example Borough Council',
                   dc => {
                      date       => '2004-05-01',
                      creator    => 'J. Random Administrator, Example Borough Council, j.r.administrator@example.gov.uk',
                      publisher  => 'Example Borough Council',
                      rights     => 'Copyright (c) Example Borough Council',
                      language   => 'en',
                      coverage   => 'Example, County, UK'
                   },
                   egms => {
                      SubjectCategory => [
                                            ['GCL','Local government'],
                                            ['LGCL','News announcements']
                                         ]
                   }
                 );

DESCRIPTION

Top

This module extends Dave Rolsky's XML::Generator::RSS10 to provide support categories taken from the UK Government Category List (gcl), a controlled vocabulary for use in the UK e-Government Metadata Standard (egms).

The module is intended for use only with XML::Generator::RSS10::egms. Please see the documentation accompanying that module for further information.

CHANGES

Top

Version 0.02: Minor change to the way the XML local-name is created for tags in the GCL namespace, to account for category names with punctuation marks.

Version 0.01: Initial release.

SEE ALSO

Top

XML::Generator::RSS10, XML::Generator::RSS10::egms.

AUTHOR

Top

Andrew Green, <andrew@article7.co.uk>.

Sponsored by Woking Borough Council, http://www.woking.gov.uk/.

LICENSE

Top

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


XML-Generator-RSS10-gcl documentation Contained in the XML-Generator-RSS10-gcl distribution.

## XML::Generator::RSS10::gcl
## An extension to Dave Rolsky's XML::Generator::RSS10 to handle categories in the UK Government Category List
## To be used in conjunction with XML::Generator::RSS10::egms
## Written by Andrew Green, Article Seven, http://www.article7.co.uk/
## Sponsored by Woking Borough Council, http://www.woking.gov.uk/
## Last updated: Wednesday, 8 September 2004

package XML::Generator::RSS10::gcl;

$VERSION = '0.01';

use strict;
use Carp;

use base 'XML::Generator::RSS10::Module';

1;

####

sub NamespaceURI {

   'http://www.esd.org.uk/standards/gcl/2.00/gcl-schema#'

}

####

sub category {

   my ($self,$rss,$category_value) = @_;
   
   my $camelcategory = $self->_camelcase($category_value);
   
   $rss->_start_element('gcl',$camelcategory);
   $rss->_newline_if_pretty;
   $rss->_element_with_data('rdf','value',$category_value);
   $rss->_newline_if_pretty;
   $rss->_end_element('gcl',$camelcategory);
   $rss->_newline_if_pretty;
   
}

####

sub _camelcase {

   my ($self,$cat) = @_;
   $cat =~ s/\s*(\w+)\s*/\u\L$1/g;
   $cat =~ s/[^A-Za-z]//g;
   return $cat;

}

####

__END__