Class CacheableSAXParser

Description

Extends base SAX parser by adding cache control

Using CacheableSAXParser, you can define your event handlers and parse the XML string normally. Besides, the content parsed from the XML string can be cached, so that parsing won't execute again until the original XML source is newer than the cached values.

Located in /core/xml/CacheableSAXParser.class.php (line 46)

PHP2Go
   |
   --AbstractSAXParser
      |
      --CacheableSAXParser
Variable Summary
Method Summary
array getCacheData ()
void loadCacheData (mixed $data)
bool parse (string $xmlContent, [int $srcType = T_BYFILE])
void setCacheDir (string $dir)
void setCacheGroup (string $group)
void setCacheLifeTime (int $lifeTime)
void setUseFileMTime (bool $setting)
Variables
array $cacheOptions = array() (line 54)

Cache options

  • access: private

Inherited Variables

Inherited from AbstractSAXParser

AbstractSAXParser::$namespaceAware
AbstractSAXParser::$parserOptions
AbstractSAXParser::$preserveWhitespace
AbstractSAXParser::$srcEncoding
Methods
Constructor CacheableSAXParser (line 61)

Class constructor

CacheableSAXParser CacheableSAXParser ()
getCacheData (line 131)

Must be implemented by child classes

Should be used to return all information read from XML that should be cached.

This method is executed only when the XML string was parsed successfully.

  • abstract:
array getCacheData ()
loadCacheData (line 116)

Must be implemented by child classes

This method should be used to restore to the object data read from the cache storage layer.

  • abstract:
void loadCacheData (mixed $data)
  • mixed $data: Data loaded from cache
parse (line 147)

Overrides parent class implementation by adding cache control

Ask cache manager if it contains a cached copy of the XML source. If cache is valid and not stale, data is restored from the cache layer. Otherwise, XML is parsed and saved in the cache for further use.

bool parse (string $xmlContent, [int $srcType = T_BYFILE])
  • string $xmlContent: XML contents or file path
  • int $srcType: Source type (T_BYFILE or T_BYVAR)

Redefinition of:
AbstractSAXParser::parse()
Parses XML content
setCacheDir (line 73)

Set cache directory

void setCacheDir (string $dir)
  • string $dir: Directory path
setCacheGroup (line 82)

Set cache group

void setCacheGroup (string $group)
  • string $group: Group ID
setCacheLifeTime (line 91)

Set lifetime for the cached data

void setCacheLifeTime (int $lifeTime)
  • int $lifeTime: Lifetime, in seconds
setUseFileMTime (line 101)

Enable/disable cache control based on the original XML source's timestamp

void setUseFileMTime (bool $setting)
  • bool $setting: Flag value

Inherited Methods

Inherited From AbstractSAXParser

AbstractSAXParser::AbstractSAXParser()
AbstractSAXParser::characterData()
AbstractSAXParser::endElement()
AbstractSAXParser::endNamespace()
AbstractSAXParser::externalEntityRef()
AbstractSAXParser::notationDecl()
AbstractSAXParser::parse()
AbstractSAXParser::processingInstruction()
AbstractSAXParser::setNamespaceAwareness()
AbstractSAXParser::setParserOption()
AbstractSAXParser::setPreserveWhitespace()
AbstractSAXParser::setSourceEncoding()
AbstractSAXParser::setTargetEncoding()
AbstractSAXParser::startElement()
AbstractSAXParser::startElementNS()
AbstractSAXParser::startNamespace()
AbstractSAXParser::unparsedEntityDecl()

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:20:38 -0300 by phpDocumentor 1.3.2