IAM OPML Parser Class 1.0

IAM OPML Parser Class parses an OPML file (provided its URL) and returns an array.

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
Iván (MT-Soft)
ROOT \ Internet \ HTTP (WWW)
IAM OPML Parser Class parses an OPML file (provided its URL) and returns an array.

OPML (Outline Processor Markup Language) is an XML format for outlines. Originally developed by Radio UserLand as a native file format for an outliner application, it has since been adopted for other uses, the most common being to exchange lists of web feeds (RSS) between web feed aggregators. The OPML specification defines an outline as a hierarchical, ordered list of arbitrary elements. The specification is fairly open which makes it suitable for many types of list data.

The XML elements in an OPML document are:

< opml version=”1.0″ > This is the root element. It must contain the version attribute and one head and one body element. Currently, there’s active work in OML 2.0, which is mainly aimed at solving some of v1.o’s shortcomings.

< head > Contains metadata. May include any of these optional elements: title, dateCreated, dateModified, ownerName, ownerEmail, expansionState, vertScrollState, windowTop, windowLeft, windowBottom, windowRight. Each element is a simple text element. dateCreated and dateModified contents conform to the date-time format specified in RFC 822. expansionState contains a comma-separated list of line numbers that should be expanded o and size of the display window. An OPML processor may ignore all the head sub-elements. If the outline is opened inside another outline then the processor must ignore the window elements.

< body > Contains the content of the outline. Must have one or more outline elements.

< outline > Represents a line in the outline. May contain any number of arbitrary attributes. Common attributes include text and type. The outline element may contain any number of outline sub-elements. While there are many tools to create and/or read OPML files, there are few PHP libraries/functions to work with these files.

This PHP class parses an OPML file (provided its URL) and returns an array with all the parsed data. This array contains, for each of the OPML file’s elements the following attributes: link_url, link_name, link_target, link_description, link_rss, created (date of creation), type (link type: RSS, HTML, etc.). The class uses file_get_contents() to retrieve the contents of the OPML file and then the XML extension is used to parse and store the file’s data in an associative array, where each outline element is stored using a different array index. The array has the following structure:

0 : Array:
names => Preface
urls => http://www.php.net/manual/en/preface.php
targets =>
feeds =>
descriptions =>
created => Nov 28 2005 21:05:49 GMT
type => link
1 : Array:
names => I. Getting started
urls =>
targets =>
feeds =>
descriptions =>
created =>
type =>

Last updated on July 23rd, 2007

#XML parser #OMPL parser #IAM parser #IAM #OPML #parser #class

Add your review!