Source for file OCSP_XMLARRAY.phpclass
Documentation is available at OCSP_XMLARRAY.phpclass
* openCSP class file OCSP_XMLARRAY.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: OCSP_XMLARRAY.phpclass,v 1.1 2008/03/23 11:33:54 pitlinz Exp $
// ---------------------------------------------------------
// ---------------------------------------------------------
require_once __OCSP_PHPINCPATH__ .
"common" .
_OCSP_DIRSEP_ .
"OCSP_OBJ.phpclass";
* openCSP class OCSP_XMLARRAY
* @project Open CSP-Management
* taken form: Class for store arrays in XML files.
* @author Augusto Cesar Castoldi <castoldi@inf.ufsc.br>
* @see http://www.phpclasses.org/browse/file/5240.html
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: OCSP_XMLARRAY.phpclass,v 1.1 2008/03/23 11:33:54 pitlinz Exp $
/*** class constants --------------------------------------------- */
* @constant string CLASS_SRC_FILE
const CLASS_SRC_FILE = __FILE__
;
/*** class variables --------------------------------------------- */
/*** compostion --------------------------------------------------- */
/*** attributes -------------------------------------------------- */
/*** static functions---------------------------------------------- */
* Save the $array into the XML $xmlPath
* @param array $array array of strings
* @param string $xmlPath complete path of the xml file. Ex.: /home/user/test/XmlArrayTest.xml
public static function saveXML($array, $xmlPath)
$obj_xml =
new DOMDocument("1.0");
$elements =
$obj_xml->createElement("array");
$elementsNode =
$obj_xml->appendChild($elements);
for ($i =
0; $i <
count($array); $i++
)
$element =
$obj_xml->createElement("element");
$element->set_content($array[$i]);
$elementsNode->appendChild($element);
$obj_xml->save($xmlPath);
* Reads the $xmlPath file and returns an array.
* @param string $xmlPath complete path of the xml file. Ex.: /home/user/test/XmlArrayTest.xml
public static function getArray($xmlPath)
$obj_xml =
new DOMDocument("1.0");
$obj_xml->load($xmlPath);
Documentation generated on Thu, 08 Jan 2009 17:47:34 +0100 by phpDocumentor 1.4.0a2