PHP Class SimpleXMLReader

Author: Dmitry Pyatkov(aka dkrnl) ([email protected])
Inheritance: extends XMLReader
显示文件 Open project: dkrnl/simplexmlreader

Public Properties

Property Type Description
$preserveWhiteSpace boolean Do not remove redundant white space.

Protected Properties

Property Type Description
$callback array Callbacks
$currentDepth integer Depth
$nodesCounter array Stack of node position
$nodesParsed array Stack of the parsed nodes
$nodesType array Stack of the node types
$prevDepth integer Previos depth

Public Methods

Method Description
currentXpath ( boolean $nodesCounter = false ) : string Return current xpath node
expandDomDocument ( string $version = "1.0", string $encoding = "UTF-8" ) : DomDocument Expand current node to DomDocument
expandSimpleXml ( string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : SimpleXMLElement Expand current node to SimpleXMLElement
expandString ( string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : SimpleXMLElement Expand current node to string
expandXpath ( string $path, string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : array(SimpleXMLElement) Run XPath query on current node
parse ( ) : void Run parser
read ( ) : boolean Moves cursor to the next node in the document.
registerCallback ( string $xpath, callback $callback, integer $nodeType = XMLREADER::ELEMENT ) : SimpleXMLReader Add node callback
unRegisterCallback ( string $xpath, integer $nodeType = XMLREADER::ELEMENT ) : SimpleXMLReader Remove node callback

Method Details

currentXpath() public method

Return current xpath node
public currentXpath ( boolean $nodesCounter = false ) : string
$nodesCounter boolean
return string

expandDomDocument() public method

Expand current node to DomDocument
public expandDomDocument ( string $version = "1.0", string $encoding = "UTF-8" ) : DomDocument
$version string
$encoding string
return DomDocument

expandSimpleXml() public method

Expand current node to SimpleXMLElement
public expandSimpleXml ( string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : SimpleXMLElement
$version string
$encoding string
$className string
return SimpleXMLElement

expandString() public method

Expand current node to string
public expandString ( string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : SimpleXMLElement
$version string
$encoding string
$className string
return SimpleXMLElement

expandXpath() public method

Run XPath query on current node
public expandXpath ( string $path, string $version = "1.0", string $encoding = "UTF-8", string $className = null ) : array(SimpleXMLElement)
$path string
$version string
$encoding string
$className string
return array(SimpleXMLElement)

parse() public method

Run parser
public parse ( ) : void
return void

read() public method

Moves cursor to the next node in the document.
public read ( ) : boolean
return boolean Returns TRUE on success or FALSE on failure.

registerCallback() public method

Add node callback
public registerCallback ( string $xpath, callback $callback, integer $nodeType = XMLREADER::ELEMENT ) : SimpleXMLReader
$xpath string
$callback callback
$nodeType integer
return SimpleXMLReader

unRegisterCallback() public method

Remove node callback
public unRegisterCallback ( string $xpath, integer $nodeType = XMLREADER::ELEMENT ) : SimpleXMLReader
$xpath string
$nodeType integer
return SimpleXMLReader

Property Details

$callback protected_oe property

Callbacks
protected array $callback
return array

$currentDepth protected_oe property

Depth
protected int $currentDepth
return integer

$nodesCounter protected_oe property

Stack of node position
protected array $nodesCounter
return array

$nodesParsed protected_oe property

Stack of the parsed nodes
protected array $nodesParsed
return array

$nodesType protected_oe property

Stack of the node types
protected array $nodesType
return array

$preserveWhiteSpace public_oe property

Do not remove redundant white space.
public bool $preserveWhiteSpace
return boolean

$prevDepth protected_oe property

Previos depth
protected int $prevDepth
return integer