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

Class: XML_Feed_Parser_Atom

Source Location: /XML_Feed_Parser-0.2.8alpha/Parser/Atom.php

Class Overview

XML_Feed_Parser_Type
   |
   --XML_Feed_Parser_Atom

This is the class that determines how we manage Atom 1.0 feeds


Author(s):

Version:

  • Release: @package_version@

Methods


Child classes:

XML_Feed_Parser_AtomElement
This class provides support for atom entries. It will usually be called by XML_Feed_Parser_Atom with which it shares many methods.

Inherited Variables

Inherited Methods

Class: XML_Feed_Parser_Type

XML_Feed_Parser_Type::addBase()
Gets us the xml:base data and then processes that with regard to our current link.
XML_Feed_Parser_Type::combineBases()
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.
XML_Feed_Parser_Type::count()
This function will tell us how many times the element $type appears at this level of the feed.
XML_Feed_Parser_Type::getCategory()
There is no single way of declaring a category in RSS1/1.1 as there is in RSS2
XML_Feed_Parser_Type::getDate()
Get a date construct. We use PHP's strtotime to return it as a unix datetime
XML_Feed_Parser_Type::getEntryByOffset()
Pretty fundamental!
XML_Feed_Parser_Type::getText()
Get a text construct.
XML_Feed_Parser_Type::hasKey()
Checks if this element has a particular child element.
XML_Feed_Parser_Type::processXHTMLAttributes()
We need a couple of methods to access XHTML content stored in feeds.
XML_Feed_Parser_Type::traverseNode()
We need a couple of methods to access XHTML content stored in feeds.

Class Details

[line 36]
This is the class that determines how we manage Atom 1.0 feeds

How we deal with constructs: date - return as unix datetime for use with the 'date' function unless specified otherwise text - return as is. optional parameter will give access to attributes person - defaults to name, but parameter based access



[ Top ]


Method Detail

getCategory   [line 263]

string getCategory( string $method, array $arguments)

A feed or entry can have any number of categories. A category can have the attributes term, scheme and label.
  • Todo: offer other attributes

Overrides XML_Feed_Parser_Type::getCategory() (There is no single way of declaring a category in RSS1/1.1 as there is in RSS2)

Parameters:

string   $method     The name of the text construct we want
array   $arguments     An array which we hope gives a 'param'

[ Top ]

getEntryById   [line 141]

XML_Feed_Parser_AtomElement getEntryById( string $id)

This function uses XPath to get the entry based on its ID. Ideally we would also use XPath to find the offset of that node and therefore cache it, but the necessary XPath support isn't coming until at least PHP5.1.

Once it is available, I will try to implement support for it for those users on a capable platform.

  • Todo: Test with PHP5.1 and add conditional support

Parameters:

string   $id     any valid Atom ID.

[ Top ]

getLink   [line 288]

string getLink( [int $offset = 0], [string $attribute = 'href'], [array $params = false])

This element must be present at least once with rel="feed". This element may be present any number of further times so long as there is no clash. If no 'rel' is present and we're asked for one, we follow the example of the Universal Feed Parser and presume 'alternate'.
  • Return: the value of the attribute

Parameters:

int   $offset     the position of the link within the container
string   $attribute     the attribute name required
array   $params     an array of attributes to search by

[ Top ]

getPerson   [line 164]

string|false getPerson( string $method, array $arguments)

Get a person construct. We default to the 'name' element but allow access to any of the elements.

Parameters:

string   $method     The name of the person construct we want
array   $arguments     An array which we hope gives a 'param'

[ Top ]

getText   [line 196]

string getText( string $method, array $arguments)

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.
  • Todo: Clarify overlap with getContent()

Overrides XML_Feed_Parser_Type::getText() (Get a text construct.)

Parameters:

string   $method     The name of the text construct we want
array   $arguments     An array which we hope gives a 'param'

[ Top ]


Documentation generated on Mon, 26 Dec 2005 13:00:14 -0500 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.