Class STPHPXmlDoc

STPHPObject
   |
   --STPHPXmlDoc

Classes extended from STPHPXmlDoc:

Located in File: Program_Root/stphpxmldoc.php


The class that represents a XML document


Class Variable Summary
$currentXMLElement
The current element of the tree
Default Value: -><-
$elementsRead
The array of already read elements
Default Value: -><-
$parentXMLElement
The parent XML node of the current node
Default Value: -><-
$parser
An instance of the parser
Default Value: -><-
$root
The root element of the tree
Default Value: -><-
$withCData
TRUE if the current tag has data
Default Value: -><-

Inherited Class Variable Summary
Inherited From Class STPHPObject
Variable Default Value Description
$name -><- The name of the object

Inherited Method Summary
Inherited From Class STPHPObject
Function Description
constructor STPHPObject ( [$name = ] ) Creates the object
dtor ( ) Destructor
errorLog ( $message ) Print an error to the log system
getName ( ) Returns the name of the object

Method Summary
STPHPXmlDoc constructor STPHPXmlDoc ( $name )
Creates the object
void cdata ( $parser, $cdata )
The handler for parsing the data closing for XML
void defaultHandler ( $parser, $data )
The default handler for XML parsing
void deleteElementFromDb ( &$db, $element_id, $tableElements, $tableAttributes, $tableChilds )
Delete a single XML node from the db
void deleteTreeFromDb ( &$db, $tableElements, [$rootTag = ''], [$tableAttributes = ''], [$tableChilds = ''] )
Delete a whole XML tree (an XML document) from the db
void dtor ( )
Destructor
array getArrayElement ( &$element )
Returns a XML element as an array
array getSubTreeAsArray ( &$element )
Returns a portion of the XML tree as an array
array getTreeAsArray ( )
Returns a whole XML tree as an array
void loadElementFromDb ( &$db, $element_id, $tableElements, $tableAttributes, $tableChilds )
Read a single XML node from the db
void readFromDb ( &$db, $tableElements, [$rootTag = ''], [$tableAttributes = ''], [$tableChilds = ''] )
Read a whole XML tree (an XML document) from the db
void readFromFile ( $fileName )
Read a whole XML tree (a XML document) from a file
void readFromString ( $str )
Read a whole XML tree (a XML document) from a string
void saveAttributesToDb ( $db, $owner_id, &$attributes, $tableAttributes )
Save the attributes of a single XML node to the db
void saveChildsToDb ( $db, $tableElements, $element_id, $element, $tableAttributes, $tableChilds )
Save the childs of a single XML node to the db
void saveElementToDb ( $db, $tableElements, $tableAttributes, $tableChilds, [$root = '0'], $element )
Save a single XML node to the db
void saveElementToFile ( &$fp, &$element, $level )
Save a single XML node to a file
void saveToDb ( &$db, $tableElements, [$tableAttributes = ''], [$tableChilds = ''] )
Save the whole XML tree (an XML document) to the db
void saveToFile ( $fileName )
Save the whole XML tree (an XML document) to a file
void tag_close ( $parser, $tag )
The handler for parsing the tag closing for XML
void tag_open ( $parser, $tag, $attributes )
The handler for parsing the tag opening for XML
Variable Detail

$currentXMLElement

Data type: STPHPXmlElement
The current element of the tree


$elementsRead

Data type: array
The array of already read elements


$parentXMLElement

Data type: STPHPXmlElement
The parent XML node of the current node


$parser

Data type: integer
An instance of the parser


$root

Data type: STPHPXmlElement
The root element of the tree


$withCData

Data type: bool
TRUE if the current tag has data



Method Detail

constructor STPHPXmlDoc

STPHPXmlDoc constructor STPHPXmlDoc ( $name )

Creates the object

Function Parameters:
- string $name:
Function Info:
Access - public

cdata

void cdata ( $parser, $cdata )

The handler for parsing the data closing for XML

Function Parameters:
- string $parser: An istance of the parser
- string $cdata: The read data
Function Info:
Access - private

defaultHandler

void defaultHandler ( $parser, $data )

The default handler for XML parsing

Function Parameters:
- string $parser: An istance of the parser
- string $data: The read value
Function Info:
Access - private

deleteElementFromDb

void deleteElementFromDb ( &$db, $element_id, $tableElements, $tableAttributes, $tableChilds )

Delete a single XML node from the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- integer $element_id: The db's id of the node
- string $tableElements: The table that contains the elements
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - private

deleteTreeFromDb

void deleteTreeFromDb ( &$db, $tableElements, [$rootTag = ''], [$tableAttributes = ''], [$tableChilds = ''] )

Delete a whole XML tree (an XML document) from the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- string $tableElements: The table that contains the elements
- string $rootTag: The tag that represents the root of the document
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - public

dtor

void dtor ( )

Overrides: STPHPObject::dtor()

Destructor
Destroys all the resources associated with the object
Function Parameters:
Function Info:
Access - public

getArrayElement

array getArrayElement ( &$element )

Returns a XML element as an array

Function Parameters:
- STPHPXmlElement &$element:
Function Info:
Access - public

getSubTreeAsArray

array getSubTreeAsArray ( &$element )

Returns a portion of the XML tree as an array

Function Parameters:
- STPHPXmlElement &$element:
Function Info:
Access - public

getTreeAsArray

array getTreeAsArray ( )

Returns a whole XML tree as an array

Function Parameters:
Function Info:
Access - public

loadElementFromDb

void loadElementFromDb ( &$db, $element_id, $tableElements, $tableAttributes, $tableChilds )

Read a single XML node from the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- integer $element_id: The db's id of the node
- string $tableElements: The table that contains the elements
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - private

readFromDb

void readFromDb ( &$db, $tableElements, [$rootTag = ''], [$tableAttributes = ''], [$tableChilds = ''] )

Read a whole XML tree (an XML document) from the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- string $tableElements: The table that contains the elements
- string $rootTag: The tag that represents the root of the document
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - public

readFromFile

void readFromFile ( $fileName )

Read a whole XML tree (a XML document) from a file

Function Parameters:
- string $fileName: The name of file
Function Info:
Access - public

readFromString

void readFromString ( $str )

Read a whole XML tree (a XML document) from a string

Function Parameters:
- string $fstr: The string
Function Info:
Access - public

saveAttributesToDb

void saveAttributesToDb ( $db, $owner_id, &$attributes, $tableAttributes )

Save the attributes of a single XML node to the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- integer $owner_id: The db's id of the XML node
- array &$attributes: The attributes to save
- string $tableAttributes: The table that contains the attributes
Function Info:
Access - private

saveChildsToDb

void saveChildsToDb ( $db, $tableElements, $element_id, $element, $tableAttributes, $tableChilds )

Save the childs of a single XML node to the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- string $tableElements: The table that contains the elements
- STPHPXmlElement $element_id: The XML node
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - private

saveElementToDb

void saveElementToDb ( $db, $tableElements, $tableAttributes, $tableChilds, [$root = '0'], $element )

Save a single XML node to the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- integer $element_id: The db's id of the node
- string $tableElements: The table that contains the elements
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
- string $root: The root tag
- STPHPXmlElement $element: The element to save
Function Info:
Access - private

saveElementToFile

void saveElementToFile ( &$fp, &$element, $level )

Save a single XML node to a file

Function Parameters:
- integer $fp: The file pointer
- STPHPXmlElement &$element: The element to save
- integer $level: The element's level
Function Info:
Access - private

saveToDb

void saveToDb ( &$db, $tableElements, [$tableAttributes = ''], [$tableChilds = ''] )

Save the whole XML tree (an XML document) to the db

Function Parameters:
- Object &$db: A db pointer (AdoDb library)
- string $tableElements: The table that contains the elements
- string $rootTag: The tag that represents the root of the document
- string $tableAttributes: The table that contains the attributes
- string $tableChilds: The table that contains the childs
Function Info:
Access - public

saveToFile

void saveToFile ( $fileName )

Save the whole XML tree (an XML document) to a file

Function Parameters:
- string $fileName: The name of file
Function Info:
Access - public

tag_close

void tag_close ( $parser, $tag )

The handler for parsing the tag closing for XML

Function Parameters:
- string $parser: An istance of the parser
- string $tag: The read tag
Function Info:
Access - private

tag_open

void tag_open ( $parser, $tag, $attributes )

The handler for parsing the tag opening for XML

Function Parameters:
- string $parser: An istance of the parser
- string $tag: The read tag
- array $attributes: The tag's attributes
Function Info:
Access - private