note 51239 deleted from function.xml-parse-into-struct by betz
| From: | betz@php.net | Date: | Fri, 25 Mar 2005 11:47:20 +0000 |
| Subject: | note 51239 deleted from function.xml-parse-into-struct by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86949@lists.php.net to get a copy of this message | ||
Note Submitter: ritvars[dot]alksnis[ad]komin[dot]lv
----
class XML_easy_parser_v1
{
var $XML;
var $encoding;
var $error;
var $_structure;
var $_indexes;
// ------------------------------------------------
function XML_easy_parser_v1($encoding="iso-8859-1"){
$this->encoding = $encoding;
}
// ------------------------------------------------
function load_XML(){
$this->XML = $XML;
}
// ------------------------------------------------
function XMLtoArray ($XML=false) {
if ((bool)$XML) $this->XML = $XML;
// parseejam pashu XML tekstu uzz struktuuru
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $XML, $this->_structure, $this->_indexes );
xml_parser_free($xml_parser);
my_print_r($this->_structure);
// parseejam struktuuras massiivu
$this->_xml_run($XML_array=NULL);
my_print_r($XML_array);
return $XML_array;
}
// ------------------------------------------------
function _xml_run(&$content){
$content = NULL;
reset($this->_structure);
array_unshift($this->_structure,"");
array_push($this->_structure,"");
$this->_xml_runner( $content );
array_shift($this->_structure);
array_pop($this->_structure);
reset($this->_structure);
return true;
}
[See next ...] -------->>>>