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.6alpha/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@

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.
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
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 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::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.
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 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 ]


Class Variables

$compatMap = array()

[line 60]

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

Our specific element map
  • Access: protected

Type:   array
Overrides:   Array


[ Top ]

$parent =

[line 39]

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

to use a 'fallback' rule

  • Access: protected



[ Top ]

$xmlBase =

[line 51]

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

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 85]

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

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

string|false getContent( $method, [ $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

Parameters:

   $method   — 
   $arguments   — 

[ Top ]

getEnclosure   [line 209]

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

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:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.