Class xml_domit_rss_elementindexer
Provides indexing functionality to RSS classes.

isPublic? no
isAbstract? yes

Inheritance tree:


xml_domit_rss_base
|
xml_domit_rss_elementindexer

Known subclasses:

xml_domit_rss_collection, xml_domit_rss_base_document, xml_domit_rss_simpleelement, xml_domit_rss_channel, xml_domit_rss_item, xml_domit_rss_category, xml_domit_rss_image, xml_domit_rss_textinput, xml_domit_rss_cloud, xml_domit_rss_enclosure, xml_domit_rss_guid, xml_domit_rss_sourcexml_domit_rss_channel_lite, xml_domit_rss_item_lite

Source file: xml_domit_rss_shared.php




Constructor



Public Constants



Private Constants



Public Fields



Private Fields
DOMIT_RSS_indexer
A name-based index to RSS elements.

Type: Array

DOMIT_RSS_numericalIndexer
A numerical index to RSS elements.

Type: Array




Public Methods
isCollection
Indicates whether the requested element is actually a collection of elements of the same type.

Signature: isCollection($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

boolean - True if the requested element is actually a collection of elements of the same type.

Example:

Indicates whether the requested element is actually a collection of elements of the same type.

$collection = $channelElement->isCollection('dc:creator');

isNode
Indicates whether the requested element is a single DOMIT! node.

Signature: isNode($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

boolean - True if the requested element is a single DOMIT! node.

Example:

Indicates whether the requested element is a single DOMIT! node.

$isnode = $channelElement->isNode('dc:creator');

isCustomRSSElement
Indicates whether the requested element is a single DOMIT! node (alias for isNode).

Signature: isCustomRSSElement($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

boolean - True if the requested element is a single DOMIT! node.

Example:

Indicates whether the requested element is a single DOMIT! node.

$isCustomRSSElement = $channelElement->isCustomRSSElement('dc:creator');

getElementList
Gets a named list of existing elements.

Signature: getElementList()

Returns:

Array - A named list of existing elements

Example:

Gets a list of elements contained in the current RSS document.

$rssdoc->getElementList();

hasElement
Indicates whether a particular element exists as a child of the current element.

Signature: hasElement($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

boolean - True if an element with the specified name exists.

Example:

Indicates whether an element named "title" exists in the RSS document.

$doesElementExist = $rssdoc->hasElement('title');

getElementText
Gets the text of the specified element.

Signature: getElementText($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

String - The element text, or an empty string.

Example:

Gets the text of the child element named 'dc:creator'.

$elementText = $someElement->getElementText('dc:creator');

getElementTextAt
Gets the text of the element at the specified index.

Signature: getElementTextAt($index)

Parameters:

int index - The index of the requested element.

Returns:

String - The element text, or an empty string.

Example:

Gets the text of the third child element.

$elementText = $someElement->getElementTextAt(2);

getElement
Gets a reference to a child element with the specified name.

Signature: &getElement($elementName)

Parameters:

String elementName - The name of the requested element.

Returns:

Object - A reference to a child element with the specified name.

Example:

Gets a reference to the width subelement of an image element.

$widthElement =& $imageElement->getElement('width');

getElementAt
Gets a reference to a child element at the specified index.

Signature: &getElementAt($index)

Parameters:

int index - The index of the requested element.

Returns:

Object - A reference to a child element at the specified index.

Example:

Gets a reference to the third child element.

$thirdElement =& $imageElement->getElementAt(2);




Private Methods
_init
Performs initialization of an RSS element.

Signature: _init()

addIndexedElement
Adds a custom element (one not defined by the RSS specs, e..g., dc:creator) to the indexer.

Signature: addIndexedElement(&$node)

Parameters:

String node - A DOMIT! node representing the custom element.

_getElementText
Gets the text of the specified element.

Signature: _getElementText($index, &$myArray)

Parameters:

String index - The name or numerical index of the requested element.

array myArray - The indexing array from which to extract the reference.

Returns:

String - The element text, or an empty string.

indexNumerically
Populates an integer-based index for elements if one isn't already present.

Signature: indexNumerically()


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.