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.2.4alpha/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:

  • 0.2.2 22nd September 2005

Variables

Methods


Inherited Variables

Inherited Methods

Class: XML_Feed_Parser_Atom

XML_Feed_Parser_Atom::__construct()
Our constructor does nothing more than its parent.
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.

Class: XML_Feed_Parser_Type

XML_Feed_Parser_Type::addBase()
getBase gets us the xml:base data. We then need to process that with regard to our current link. This function does that and returns the link in as complete a form as possible.
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::getBase()
We will often need to extract the xml:base values that apply to a link. This method iterates through the heirarchy and extracts the relevant attributes, and then combines them.
XML_Feed_Parser_Type::getCategory()
There is no single way of declaring a category in RSS1 or Atom 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::__call()
We are not going to provide methods for every entry type so this function will allow for a lot of mapping. We rely pretty heavily on this to handle our mappings between other feed types and atom.
XML_Feed_Parser_Type::__get()
For many elements variable-style access will be desirable. This function provides for that.
XML_Feed_Parser_Type::__toString()
Return an XML serialization of the feed, should it be required. Most users however, will already have a serialization that they used when instantiating the object.

Class Details

[line 33]
This class provides support for atom entries. It will usually be called by XML_Feed_Parser_Atom with which it shares many methods.
  • Author: James Stewart <james@jystewart.net>
  • Version: 0.2.2 22nd September 2005
  • Todo: Deal with xml:base


[ Top ]


Class Variables

$compatMap = array()

[line 61]

Here we provide a few mappings for those very special circumstances in which it makes sense to map back to the RSS2 spec. Key is RSS2 version value is an array consisting of the equivalent in atom and any attributes needed to make the mapping.
  • Access: protected

Type:   array
Overrides:   Array


[ Top ]

$map = array(
      'author' => array('Person', 'fallback'),'contributor'=>array('Person'),'id'=>array('Text','fail'),'published'=>array('Date'),'updated'=>array('Date','fail'),'title'=>array('Text','fail'),'rights'=>array('Text','fallback'),'summary'=>array('Text'),'content'=>array('Content'),'link'=>array('Link'),'enclosure'=>array('Enclosure'))

[line 67]

Our specific element map
  • Access: protected

Type:   array
Overrides:   Array


[ Top ]

$parent =

[line 40]

This will be a reference to the parent object for when we want

to use a 'fallback' rule

  • Access: protected



[ Top ]

$xmlBase =

[line 52]

xml:base values inherited by the element
  • Access: protected

Type:   string
Overrides:   Array


[ Top ]



Method Detail

__construct (Constructor)   [line 86]

XML_Feed_Parser_AtomElement __construct( DOMElement $element, XML_Feed_Parser_Atom $parent, [ $xmlBase = ''])

Store useful information for later.

Overrides XML_Feed_Parser_Atom::__construct() (Our constructor does nothing more than its parent.)

Parameters:

DOMElement   $element   —  - this item as a DOM element
XML_Feed_Parser_Atom   $parent   —  - the feed of which this is a member
   $xmlBase   — 

[ Top ]

getAuthor   [line 103]

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 139]

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

If there is content we return it, if not and there's a 'src' attribute we return the value of that instead.

  • Todo: Be clearer about content types

[ Top ]

getEnclosure   [line 172]

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 200]

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 Mon, 11 Mar 2019 14:12:48 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.