note 51239 added to function.xml-parse-into-struct
| From: | ritvars | Date: | Thu, 24 Mar 2005 12:35:50 +0000 |
| Subject: | note 51239 added to function.xml-parse-into-struct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86880@lists.php.net to get a copy of this message | ||
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 ...] -------->>>>
----
Manual Page -- http://www.php.net/manual/en/function.xml-parse-into-struct.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51239
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51239&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51239&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51239&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51239&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51239&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51239&report=yes
Search -- http://master.php.net/manage/user-notes.php