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

Class: XML_Feed_Parser

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

Class Overview


This is the core of the XML_Feed_Parser package. It identifies feed types and abstracts access to them. It is an iterator, allowing for easy access to the entire feed.


Author(s):

Version:

  • Release: @package_version@

Variables

Methods


Child classes:

XML_Feed_Parser2
This is the core of the XML_Feed_Parser package. It identifies feed types and abstracts access to them. It is an iterator, allowing for easy access to the entire feed.

Inherited Variables

Inherited Methods


Class Details

[line 46]
This is the core of the XML_Feed_Parser package. It identifies feed types and abstracts access to them. It is an iterator, allowing for easy access to the entire feed.


[ Top ]


Class Variables

$idMappings = array()

[line 64]

A map between entry ID and offset
  • Access: protected

Type:   array


[ Top ]

$model =

[line 58]

To allow for extensions, we make a public reference to the feed model
  • Access: public

Type:   DOMDocument


[ Top ]



Method Detail

__construct (Constructor)   [line 90]

XML_Feed_Parser __construct( string $feed, [bool $strict = false], [bool $suppressWarnings = false], [bool $tidy = false])

Detects feed types and instantiate appropriate objects.

Our constructor takes care of detecting feed types and instantiating appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0 but raise a warning. I do not intend to introduce full support for Atom 0.3 as it has been deprecated, but others are welcome to.

  • Deprecated: XML_Feed_Parser2

Overridden in child classes as:

XML_Feed_Parser2::__construct()
A variant of XML_Feed_Parser which does no work in the constructor.

Parameters:

string   $feed   —  XML serialization of the feed
bool   $strict   —  Whether or not to validate the feed
bool   $suppressWarnings   —  Trigger errors for deprecated feed types?
bool   $tidy   —  Whether or not to try and use the tidy library on input

[ Top ]

current   [line 174]

XML_Feed_Parser_Type current( )

Return XML_Feed_Type object for current element
  • Return: Object

[ Top ]

getEntryById   [line 220]

XML_Feed_Parser_Type|false getEntryById( string $id)

Provides access to entries by ID if one is specified in the source feed.

As well as allowing the items to be iterated over we want to allow users to be able to access a specific entry. This is one of two ways of doing that, the other being by offset. This method can be quite slow if dealing with a large feed that hasn't yet been processed as it instantiates objects for every entry until it finds the one needed.


Parameters:

string   $id   —  Valid ID for the given feed format

[ Top ]

getEntryByOffset   [line 244]

XML_Feed_Parser_Type|false getEntryByOffset( int $offset)

Retrieve entry by numeric offset, starting from zero.

As well as allowing the items to be iterated over we want to allow users to be able to access a specific entry. This is one of two ways of doing that, the other being by ID.


Parameters:

int   $offset   —  The position of the entry within the feed, starting from 0

[ Top ]

initialize   [line 110]

void initialize( string $feed, [bool $strict = false], [bool $suppressWarnings = false], [bool $tidy = false])

Detects feed types and instantiate appropriate objects.

Our constructor takes care of detecting feed types and instantiating appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0 but raise a warning. I do not intend to introduce full support for Atom 0.3 as it has been deprecated, but others are welcome to.

  • Todo: No work in the constructor :(

Parameters:

string   $feed   —  XML serialization of the feed
bool   $strict   —  Whether or not to validate the feed
bool   $suppressWarnings   —  Trigger errors for deprecated feed types?
bool   $tidy   —  Whether or not to try and use the tidy library on input

[ Top ]

key   [line 184]

int key( )

For iteration -- returns the key for the current stage in the array.

[ Top ]

next   [line 157]

void next( )

Provides iteration functionality.

Of course we must be able to iterate... This function simply increases our internal counter.


[ Top ]

rewind   [line 203]

void rewind( )

For iteration -- resets the internal counter to the beginning.

[ Top ]

setFeed   [line 116]

void setFeed( $feed)

  • Access: public

Parameters:

   $feed   — 

[ Top ]

valid   [line 195]

bool valid( )

For iteration -- tells whether we have reached the end.

[ Top ]

version   [line 270]

void version( )

Retrieve version details from feed type class.
  • Author: James Stewart

[ Top ]

__call   [line 130]

void __call( string $call, array $attributes)

Proxy to allow feed element names to be used as method names

For top-level feed elements we will provide access using methods or attributes. This function simply passes on a request to the appropriate feed type object.


Parameters:

string   $call   —  - the method being called
array   $attributes   — 

[ Top ]

__get   [line 146]

void __get( string $val)

Proxy to allow feed element names to be used as attribute names

To allow variable-like access to feed-level data we use this method. It simply passes along to __call() which in turn passes along to the relevant object.


Parameters:

string   $val   —  - the name of the variable required

[ Top ]

__toString   [line 280]

String __toString( )

Returns a string representation of the feed.

[ Top ]


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