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

Class: XML_Feed_Parser_RSS11

Source Location: /XML_Feed_Parser-1.0.5/XML/Feed/Parser/RSS11.php

Class Overview

XML_Feed_Parser_Type
   |
   --XML_Feed_Parser_RSS11

This class handles RSS1.1 feeds. RSS1.1 is documented at: http://inamidst.com/rss1.1/


Author(s):

Version:

  • Release: @package_version@

Variables

Methods


Child classes:

XML_Feed_Parser_RSS11Element
RSS1 Element class for XML_Feed_Parser

Inherited Variables

Inherited Methods

Class: XML_Feed_Parser_Type

XML_Feed_Parser_Type::addBase()
Determine whether we need to apply our xml:base rules
XML_Feed_Parser_Type::combineBases()
Utility function to help us resolve xml:base values
XML_Feed_Parser_Type::count()
Count occurrences of an element
XML_Feed_Parser_Type::getCategory()
Apply various rules to retrieve category data.
XML_Feed_Parser_Type::getContent()
Get content from RSS feeds (atom has its own implementation)
XML_Feed_Parser_Type::getDate()
Return a date in seconds since epoch.
XML_Feed_Parser_Type::getEntryByOffset()
Get an entry by its position in the feed, starting from zero
XML_Feed_Parser_Type::getSanitizer()
XML_Feed_Parser_Type::getSchemaDir()
Get directory holding RNG schemas. Method is based on that found in Contact_AddressBook.
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::processEntitiesForNodeValue()
Convert HTML entities based on the current character set.
XML_Feed_Parser_Type::processXHTMLAttributes()
Part of our xml:base processing code
XML_Feed_Parser_Type::relaxNGValidate()
XML_Feed_Parser_Type::setSanitizer()
XML_Feed_Parser_Type::traverseNode()
Part of our xml:base processing code
XML_Feed_Parser_Type::__call()
Proxy to allow use of element names as method names
XML_Feed_Parser_Type::__get()
Proxy to allow use of element names as attribute names
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 34]
This class handles RSS1.1 feeds. RSS1.1 is documented at: http://inamidst.com/rss1.1/
  • Author: James Stewart <james@jystewart.net>
  • Version: Release: @package_version@
  • Todo: Support for RDF:List
  • Todo: Ensure xml:lang is accessible to users


[ Top ]


Class Variables

$compatMap = array(
        'title' => array('title'),'link'=>array('link'),'subtitle'=>array('description'),'author'=>array('creator'),'updated'=>array('date'))

[line 96]

Here we map some elements to their atom equivalents. This is going to be quite tricky to pull off effectively (and some users' methods may vary) but is worth trying. The key is the atom version, the value is RSS2.
  • Access: protected

Type:   array


[ Top ]

$itemClass =  'XML_Feed_Parser_RSS1Element'

[line 58]

The class used to represent individual items
  • Access: protected

Type:   string


[ Top ]

$itemElement =  'item'

[line 64]

The element containing entries
  • Access: protected

Type:   string


[ Top ]

$map = array(
        'title' => array('Text'),'link'=>array('Text'),'description'=>array('Text'),'image'=>array('Image'),'updatePeriod'=>array('Text'),'updateFrequency'=>array('Text'),'updateBase'=>array('Date'),'rights'=>array('Text'),# dc:rights
'description'=>array('Text'),# dc:description
'creator'=>array('Text'),# dc:creator
'publisher'=>array('Text'),# dc:publisher
'contributor'=>array('Text'),# dc:contributor
'date'=>array('Date')# dc:contributor
)

[line 74]

Here we map those elements we're not going to handle individually

to the constructs they are. The optional second parameter in the array tells the parser whether to 'fall back' (not apt. at the feed level) or fail if the element is missing. If the parameter is not set, the function will simply return false and leave it to the client to decide what to do.

  • Access: protected

Type:   array


[ Top ]

$namespaces = array(
        'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
        'rss' => 'http://purl.org/net/rss1.1#',
        'dc' => 'http://purl.org/rss/1.0/modules/dc/',
        'content' => 'http://purl.org/rss/1.0/modules/content/',
        'sy' => 'http://web.resource.org/rss/1.0/modules/syndication/')

[line 108]

We will be working with multiple namespaces and it is useful to

keep them together. We will retain support for some common RSS1.0 modules

  • Access: protected

Type:   array


[ Top ]

$relax =  'rss11.rng'

[line 40]

The URI of the RelaxNG schema used to (optionally) validate the feed
  • Access: protected

Type:   string


[ Top ]

$version =  'RSS 1.0'

[line 52]

The feed type we are parsing
  • Access: public

Type:   string


[ Top ]

$xpath =

[line 46]

We're likely to use XPath, so let's keep it global
  • Access: protected

Type:   DOMXPath


[ Top ]



Method Detail

__construct (Constructor)   [line 121]

XML_Feed_Parser_RSS11 __construct( DOMDocument $model, [bool $strict = false], DOMDocument $xml)

Our constructor does nothing more than its parent.

Overridden in child classes as:

XML_Feed_Parser_RSS11Element::__construct()
Store useful information for later.

Parameters:

DOMDocument   $xml   —  A DOM object representing the feed
bool   $strict   —  (optional) $string Whether or not to validate this feed
DOMDocument   $model   — 

[ Top ]

getAuthor   [line 243]

array|false getAuthor( )

Attempts to discern authorship

Dublin Core provides the dc:creator, dc:contributor, and dc:publisher elements for defining authorship in RSS1. We will try each of those in turn in order to simulate the atom author element and will return it as text.


[ Top ]

getEntryById   [line 151]

XML_Feed_Parser_RSS1Element getEntryById( string $id)

Attempts to identify an element by ID given by the rdf:about attribute

This is not really something that will work with RSS1.1 as it does not have clear restrictions on the global uniqueness of IDs. We will employ the _very_ hit and miss method of selecting entries based on the rdf:about attribute. Please note that this is even more hit and miss with RSS1.1 than with RSS1.0 since RSS1.1 does not require the rdf:about attribute for items.


Parameters:

string   $id   —  any valid ID.

[ Top ]

getImage   [line 170]

array|false getImage( )

Get details of the image associated with the feed.
  • Return: an array simply containing the child elements
  • Access: protected

[ Top ]

getLink   [line 263]

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

Retrieve a link

In RSS1 a link is a text element but in order to ensure that we resolve URLs properly we have a special function for them.


Parameters:

   $offset   — 
   $attribute   — 
   $params   — 

[ Top ]

getTextInput   [line 204]

array|false getTextInput( )

The textinput element is little used, but in the interests of completeness we will support it.
  • Access: protected

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.