The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::OPML - creates and updates OPML (Outline Processor Markup Language) files

SYNOPSIS

# Create an OPML file use XML::OPML;

my $opml = new XML::OPML(version => "1.1");

$opml->head( title => 'mySubscription', dateCreated => 'Mon, 16 Feb 2004 11:35:00 GMT', dateModified => 'Mon, 16 Feb 2004 11:35:00 GMT', ownerName => 'michael szul', ownerEmail => 'michael@madghoul.com', expansionState => '', vertScrollState => '', windowTop => '', windowLeft => '', windowBottom => '', windowRight => '', );

$opml->add_outline( text => 'madghoul.com | the dark night of the soul', description => 'Looking for something strange? Religion, philosophy, and occult science intermingle to form an amalgamation ripe for the counterculture - madghoul.com, keep your nightmares in order with the one site that keeps you up to date on the dark night of the soul.', title => 'madghoul.com | the dark night of the soul', type => 'rss', version => 'RSS', htmlUrl => 'http://www.madghoul.com/ghoul/InsaneRapture/lunacy.mhtml', xmlUrl => 'http://www.madghoul.com/cgi-bin/fearsome/fallout/index.rss10', );

$opml->add_outline( text => 'raelity bytes', descriptions => 'The raelity bytes weblog.', title => 'raelity bytes', type => 'rss', version => 'RSS', htmlUrl => 'http://www.raelity.org', xmlUrl => 'http://www.raelity.org/index.rss10', );

# Save it as a string. $opml->as_string();

# Save it to a file. $opml->save('mySubscriptions.opml');

# Update the OPML file. use XML::OPML;

my $opml = new XML::OPML;

# Update a file. $opml->parsefile('mySubscriptions.opml');

# Update a string ($content is assumed to be an XML formated string). $opml->parse($content);

$opml->add_outline( text => 'Neil Gaiman\'s Journal', description =>'Neil Gaiman\'s Journal', title => 'Neil Gaiman\'s Journal', type => 'rss', version => 'RSS', htmlUrl => 'http://www.neilgaiman.com/journal/journal.asp', xmlUrl => 'http://www.neilgaiman.com/journal/blogger_rss.xml', );

DESCRIPTION

This experimental module is designed to allow for easy creation and manipulation of OPML files. OPML files are most commonly used for the sharing of blogrolls or subscriptions - an outlined list of what other blogs and Internet blogger reads. RSS Feed Readers such as AmphetaDesk (http://www.disobey.com/amphetadesk) use *.opml files to store your subscription information for easy access.

This is purely experimental at this point and has a few bugs and limitations. Most notably: the update feature seems to be wiping out previous outline items and only including the new ones.

Additionally, this module currently does not support embedded outlines (i.e., outline tags inside of outline tags). This is currently under development.

Rather than reinventing the wheel, this module was modified from the XML::RSS module, so functionality works in a similar way.

METHODS

new XML::OPML(version => '1.1')

This is the constructor. It returns a reference to an XML::OPML object. This will always be version 1.1 for now, so don't worry about it.

head(title => '$title', dateCreated => '$cdate', dateModified => '$mdate',ownerName => '$name', ownerEmail => '$email', expansionState => '$es', vertScrollState => '$vs', windowTop => '$wt', windowLeft => '$wl', windowBottom => '$wb',windowRight => '$wr',)

This method with create all the OPML tags for the <head> subset. For more information on these tags, please see the OPML documentation at http://www.opml.org.

add_item(%attributes)

This method adds the <outline> elements to the OPML document(see the example above). There are no statement requirements for the attributes in this tag. The ones show in the example are the ones most commonly used by RSS Feed Readers, blogrolls, and subscriptions.

as_string

Returns a string containing the OPML document.

save($file)

Saves the OPML document to $file

parse($content)

Uses XML::Parser to parse the value of the string that is passed to it.

parsefile($file)

Uses XML::Parser to parse the contents of $file.

SOURCE AVAILABILITY

Source code is available at the development site at http://opml.madghoul.com. Any contributions or improvements are greatly appreciated.

AUTHOR

michael szul <michael@madghoul.com> Send development inquiries to <opml-dev@madghoul.com>

COPYRIGHT

copyright (c) 2004 michael szul <michael@madghoul.com>

XML::OPML is free software. It may be redistributed and/or modified under the same terms as Perl.

CREDITS

michael szul <michael@madghoul.com>

SEE ALSO

perl(1), XML::Parser(3), XML::RSS(3).