Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
OPML(3)		      User Contributed Perl Documentation	       OPML(3)

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

       # Create	an OPML	file

	use XML::OPML;

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

		    title => 'mySubscription',
		    dateCreated	=> 'Mon, 16 Feb	2004 11:35:00 GMT',
		    dateModified => 'Sat, 05 Mar 2004 09:02:00 GMT',
		    ownerName => 'michael szul',
		    ownerEmail => '',
		    expansionState => '',
		    vertScrollState => '',
		    windowTop => '',
		    windowLeft => '',
		    windowBottom => '',
		    windowRight	=> '',

			text =>	'Warren	Ellis Speaks Clever',
			description => 'Warren Ellis\' Personal	Weblog',
			title => 'Warren Ellis Speaks Clever',
			type =>	'rss',
			version	=> 'RSS',
			htmlUrl	=> ' ',
			xmlUrl => ' ',

			text =>	'raelity bytes',
			descriptions =>	'The raelity bytes weblog.',
			title => 'raelity bytes',
			type =>	'rss',
			version	=> 'RSS',
			htmlUrl	=> ' ',
			xmlUrl => ' ',

       # Create	embedded outlines

			    opmlvalue => 'embed',
			    outline_one	=> {
					     text => 'The first	embedded outline',
					     description => 'The description for the first embedded outline',
			    outline_two	=> {
					     text => 'The second embedded outline',
					     description => 'The description for the second embedded outline',
			    outline_three => {
					       opmlvalue => 'embed',
					       em_outline_one => {
								   text	=> 'I'm	too lazy to come up with real examples',
					       em_outline_two => {
								   text	=> 'so you get generic text',

       # Create	an embedded outline with attributes in the encasing <outline>

			    opmlvalue => 'embed',
			    description	=> 'now	we can have attributes in this tag',
			    title => 'attributes',
			    outline_with_atts => {
						   text	=> 'Eat	Your Wheaties',
						   description => 'Cereal is the breakfast of champion programmers',

       # Save it as a string.


       # Save it to a file.


       # Update	your OPML file.

	use XML::OPML;

	my $opml = new XML::OPML;

       # Parse the file.


       # Or optionally from a variable.

	my $content = $opml->as_string();

       # Update	it appending to	the end	of the outline

			   text	=> 'Neil Gaiman\'s Journal',
			   description =>'Neil Gaiman\'s Journal',
			   title => 'Neil Gaiman\'s Journal',
			   type	=> 'rss',
			   version => 'RSS',
			   htmlUrl => ' ',
			   xmlUrl => '	',

       # Update	it inserting the outline into a	specific group (note the group

			      group => 'occult',
			      text => '',
			      description => 'the dark night of	the soul',
			      title => '',
			      type => 'rss',
			      version => 'RSS',
			      htmlUrl => ' ',
			      xmlUrl =>	' ',

       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 an	Internet blogger reads.	RSS Feed Readers such as AmphetaDesk ( ) use	*.opml files to	store your
       subscription information	for easy access.

       This is purely experimental at this point and has a few limitations.
       This module may now support attributes in the <outline> element of an
       embedded	hierarchy, but these are limited to the	following attributes:
       date_added, date_downloaded, description, email,	filename, htmlurl,
       keywords, text, title, type, version, and xmlurl. Additionally, the
       following alternate spellings are also supported: dateAdded,
       dateDownloaded, htmlUrl,	and xmlUrl.

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

       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 will create all the OPML	tags for the <head> subset.
	   For more information	on these tags, please see the OPML
	   documentation at	.

       add_outline(opmlvalue =>	'$value', %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 shown in the example are the ones
	   most	commonly used by RSS Feed Readers, blogrolls, and
	   subscriptions. The opmlvalue	element	is optional. Only use this
	   with	the value 'embed' if you wish to embed another outline within
	   the current outline.	You can	now use	attributes in <outline>	tags
	   that	are used for embedded outlines,	however, you cannot use	any
	   attribute you want. The embedded <outline> tag only supports	the
	   following: date_added, date_downloaded, description,	email,
	   filename, htmlurl, keywords,	text, title, type, version, and
	   xmlurl, as well as the alternate spellings: dateAdded,
	   dateDownloaded, htmlUrl, and	xmlUrl.

       insert_outline(group => '$group', %attributes)
	   This	method works in	the same exact manner as add_outline() except
	   that	this will insert the outline element into the specified	group.
	   The $group variable must be the text	presented in the "text"
	   attribute of	the outline that you wish to insert this one into. For
	   example, if you have	an outline element with	the text attribute of
	   "occult" that contains four outline subelements of occult web
	   sites, your group parameter would be	"occult."

	   Returns a string containing the OPML	document.

	   Saves the OPML document to $file

	   Uses	XML::Parser and	XML::SimpleObject to parse the value of	the
	   string or file that is passed to it.	This method prepares your OPML
	   file	for a possible update. Embedded	outlines are supported.

       Source code is available	at the development site	at . Any contributions or improvements are
       greatly appreciated. You	may also want to visit
       to see a	whole lot of perl coding at work.

	michael	szul <>

       copyright (c) 2004 michael szul <>

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

	michael	szul <>
	matt cashner <>
	ricardo	signes <>
	gergely	nagy <>

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

perl v5.32.1			  2004-03-25			       OPML(3)


Want to link to this manual page? Use this URL:

home | help