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

Class: XML_Feed_Parser_AtomElement

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

Class Overview

XML_Feed_Parser_Type
   |
   --XML_Feed_Parser_Atom
      |
      --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.


Author(s):

Version:

  • Release: @package_version@

Methods


Inherited Variables

Inherited Methods

Class: XML_Feed_Parser_Atom

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_Atom::getEntryById()
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.
XML_Feed_Parser_Atom::getLink()
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'.
XML_Feed_Parser_Atom::getPerson()
Get a person construct. We default to the 'name' element but allow access to any of the elements.
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.

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::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.
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 32]
This class provides support for atom entries. It will usually be called by XML_Feed_Parser_Atom with which it shares many methods.


[ Top ]


Method Detail

getAuthor   [line 108]

string getAuthor( array $arguments)

author data at the entry level is more complex than at the feed level.

If atom:author is not present for the entry we need to look for it in an atom:source child of the atom:entry. If it's not there either, then we look to the parent for data.


Parameters:

array   $arguments     

[ Top ]

getContent   [line 150]

string|false getContent( mixed $method, [mixed $arguments = array()])

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".

If there is content we return it, if not and there's a 'src' attribute we return the value of that instead. The method can take an 'attribute' argument, in which case we return the value of that attribute if present. eg. $item->content("type") will return the type of the content. It is recommended that all users check the type before getting the content to ensure that their script is capable of handling the type of returned data. (data carried in the content element can be either 'text', 'html', 'xhtml', or any standard MIME type).

  • Todo: Work out overlap with general text construct

Overrides XML_Feed_Parser_Type::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.)
[ Top ]

getEnclosure   [line 219]

array|false getEnclosure( string $method, [array $arguments = array()])

The Atom spec doesn't provide for an enclosure element, but it is generally supported using the link element with rel='enclosure'.

Parameters:

string   $method     - for compatibility with our __call usage
array   $arguments     - for compatibility with our __call usage

[ Top ]

getSource   [line 251]

XML_Feed_Parser_Atom|false getSource( )

Where an atom:entry is taken from another feed then the aggregator

is supposed to include an atom:source element which replicates at least the atom:id, atom:title, and atom:updated metadata from the original feed. Atom:source therefore has a very similar structure to atom:feed and if we find it we will return it as an XML_Feed_Parser_Atom object.


[ Top ]


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