PHP Class SimpleExcel\Parser\XMLParser

Author: Faisalman
Inheritance: extends BaseParser, implements SimpleExcel\Parser\IParser
Show file Open project: faisalman/simple-excel-php Class Usage Examples

Protected Properties

Property Type Description
$file_extension string Defines valid file extension

Public Methods

Method Description
getCell ( integer $row_num, integer $col_num, integer $val_only = true ) : array Get value of the specified cell
getColumn ( integer $col_num, boolean $val_only = TRUE ) : array Get data of the specified column as an array
getField ( boolean $val_only = TRUE ) : array Get data of all cells as an array
getRow ( integer $row_num, boolean $val_only = TRUE ) : array Get data of the specified row as an array
isColumnExists ( integer $col_num ) : boolean Check whether a specified column exists
isRowExists ( integer $row_num ) : boolean Check whether a specified row exists
loadFile ( string $file_path ) : boolean Load the XML file to be parsed
loadString ( string $str ) : boolean Load the string to be parsed

Private Methods

Method Description
getAttributes ( object $attrs_obj ) : array Extract attributes from SimpleXMLElement object
parseDOM ( SimpleXMLElement $xml ) : boolean Process the loaded file/string

Method Details

getCell() public method

Get value of the specified cell
public getCell ( integer $row_num, integer $col_num, integer $val_only = true ) : array
$row_num integer Row number
$col_num integer Column number
$val_only integer Whether returns only it's value or complete data
return array

getColumn() public method

Get data of the specified column as an array
public getColumn ( integer $col_num, boolean $val_only = TRUE ) : array
$col_num integer Column number
$val_only boolean Returns (value only | complete data) for every cell, default to TRUE
return array

getField() public method

Get data of all cells as an array
public getField ( boolean $val_only = TRUE ) : array
$val_only boolean Returns (value only | complete data) for every cell, default to TRUE
return array

getRow() public method

Get data of the specified row as an array
public getRow ( integer $row_num, boolean $val_only = TRUE ) : array
$row_num integer Row number
$val_only boolean Returns (value only | complete data) for every cell, default to TRUE
return array

isColumnExists() public method

Check whether a specified column exists
public isColumnExists ( integer $col_num ) : boolean
$col_num integer Column number
return boolean

isRowExists() public method

Check whether a specified row exists
public isRowExists ( integer $row_num ) : boolean
$row_num integer Row number
return boolean

loadFile() public method

Load the XML file to be parsed
public loadFile ( string $file_path ) : boolean
$file_path string Path to XML file
return boolean

loadString() public method

Load the string to be parsed
public loadString ( string $str ) : boolean
$str string String with XML format
return boolean

Property Details

$file_extension protected property

Defines valid file extension
protected string $file_extension
return string