XML_Feed_Parser
[ class tree: XML_Feed_Parser ] [ index: XML_Feed_Parser ] [ all elements ]

Class: XML_Feed_Parser_Type

Source Location: /XML_Feed_Parser-0.3.0beta/Parser/Type.php

Class Overview


This abstract class provides some general methods that are likely to be implemented exactly the same way for all feed types.


Author(s):

Version:

  • Release: @package_version@

Methods


Child classes:

XML_Feed_Parser_Atom
This is the class that determines how we manage Atom 1.0 feeds
XML_Feed_Parser_RSS1
This class handles RSS1.0 feeds.
XML_Feed_Parser_RSS2
This class handles RSS2 feeds.
XML_Feed_Parser_RSS09
This class handles RSS0.9 feeds.

Inherited Variables

Inherited Methods


Class Details

[line 33]
This abstract class provides some general methods that are likely to be implemented exactly the same way for all feed types.


[ Top ]


Method Detail

addBase   [line 161]

string addBase( string $link, DOMElement $element)

Gets us the xml:base data and then processes that with regard to our current link.

Parameters:

string   $link     
DOMElement   $element     

[ Top ]

combineBases   [line 127]

void combineBases( string $base, string $link)

We have other methods which will traverse the DOM and work out the different xml:base declarations we need to be aware of. We then need to combine them.

If a declaration starts with a protocol then we restart the string. If it starts with a / then we add on to the domain name. Otherwise we simply tag it on to the end.


Parameters:

string   $base     - the base to add the link to
string   $link     

[ Top ]

count   [line 264]

int count( string $type)

This function will tell us how many times the element $type appears at this level of the feed.

Parameters:

string   $type     the element we want to get a count of

[ Top ]

getCategory   [line 239]

string|array|false getCategory( string $call, array $arguments)

There is no single way of declaring a category in RSS1/1.1 as there is in RSS2

and Atom. Instead the usual approach is to use the dublin core namespace to declare categories. For example delicious use both: <dc:subject>PEAR</dc:subject> and: <taxo:topics><rdf:Bag> <rdf:li resource="http://del.icio.us/tag/PEAR" /></rdf:Bag></taxo:topics> to declare a categorisation of 'PEAR'.

We need to be sensitive to this where possible.


Overridden in child classes as:

XML_Feed_Parser_Atom::getCategory()
A feed or entry can have any number of categories. A category can have the attributes term, scheme and label.
XML_Feed_Parser_RSS2::getCategory()
The category element is a simple text construct which can occur any number of times. We allow access by offset or access to an array of results.

Parameters:

string   $call     for compatibility with our overloading
array   $arguments     - arg 0 is the offset, arg 1 is whether to return as array

[ Top ]

getContent   [line 343]

string|false getContent( )

The official way to include full content in an RSS1 entry is to use the content module's element 'encoded', and RSS2 feeds often duplicate that.

Often, however, the 'description' element is used instead. We will offer that as a fallback. Atom uses its own approach and overrides this method.


Overridden in child classes as:

XML_Feed_Parser_AtomElement::getContent()
This element may or may not be present. It cannot be present more than once. It may have a 'src' attribute, in which case there's no content If not present, then the entry must have link with rel="alternate".

[ Top ]

getDate   [line 199]

int|false getDate( string $method, array $arguments)

Get a date construct. We use PHP's strtotime to return it as a unix datetime
  • Return: datetime

Parameters:

string   $method     The name of the date construct we want
array   $arguments     Included for compatibility with our __call usage

[ Top ]

getEntryByOffset   [line 176]

XML_Feed_Parser_RSS1Element getEntryByOffset( int $offset)

Pretty fundamental!

Parameters:

int   $offset     

[ Top ]

getText   [line 215]

string getText( string $method, [array $arguments = array()])

Get a text construct.

Overridden in child classes as:

XML_Feed_Parser_Atom::getText()
Get a text construct. When calling this method, the two arguments allowed are 'offset' and 'attribute', so $parser->subtitle() would return the content of the element, while $parser->subtitle(false, 'type') would return the value of the type attribute.

Parameters:

string   $method     The name of the text construct we want
array   $arguments     Included for compatibility with our __call usage

[ Top ]

hasKey   [line 376]

bool hasKey( )

Checks if this element has a particular child element.
  • Author: James Stewart
  • Todo: implement

[ Top ]

processXHTMLAttributes   [line 280]

string processXHTMLAttributes( DOMElement $node)

We need a couple of methods to access XHTML content stored in feeds.

This is because we dereference all xml:base references before returning the element. This method handles the attributes.


Parameters:

DOMElement   $node     

[ Top ]

traverseNode   [line 306]

string traverseNode( DOMElement $node)

We need a couple of methods to access XHTML content stored in feeds.

This is because we dereference all xml:base references before returning the element. This method recurs through the tree descending from the node and builds our string


Parameters:

DOMElement   $node     

[ Top ]


Documentation generated on Wed, 11 Jan 2006 16:03:38 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.