note 79630 added to ref.xml
| From: | aquariusrick at osu1 dot php dot net | Date: | Thu, 06 Dec 2007 04:43:38 +0000 |
| Subject: | note 79630 added to ref.xml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132872@lists.php.net to get a copy of this message | ||
Here's another attempt at a very simple script that parses XML into a structure:
<?php
#Usage:
//$xml_parser = new xml();
//$xml_parser->parse($xml);
//$dom = $xml_parser->dom;
class xml {
var $parser;
var $pointer;
var $dom;
function xml() {
$this->pointer =& $this->dom;
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($this->parser, "tag_open", "tag_close");
xml_set_character_data_handler($this->parser, "cdata");
}
function parse($data) {
xml_parse($this->parser, $data);
}
function tag_open($parser, $tag, $attributes) {
$this->pointer[$tag] = Array(
'_parent' => &$this->pointer,
'_content' => null,
'_attributes' => $attributes,
);
$this->pointer =& $this->pointer[$tag];
}
function cdata($parser, $cdata) {
$this->pointer['_content'] .= $cdata;
}
function tag_close($parser, $tag) {
$this->pointer =& $this->pointer['_parent'];
unset($this->pointer[$tag]['_parent']);
}
} // end xml class
?>
----
Server IP: 208.69.120.35
Probable Submitter: 67.161.44.115
----
Manual Page -- http://www.php.net/manual/en/ref.xml.php
Edit -- https://master.php.net/note/edit/79630
Del: integrated -- https://master.php.net/note/delete/79630/integrated
Del: useless -- https://master.php.net/note/delete/79630/useless
Del: bad code -- https://master.php.net/note/delete/79630/bad+code
Del: spam -- https://master.php.net/note/delete/79630/spam
Del: non-english -- https://master.php.net/note/delete/79630/non-english
Del: in docs -- https://master.php.net/note/delete/79630/in+docs
Del: other reasons-- https://master.php.net/note/delete/79630
Reject -- https://master.php.net/note/reject/79630
Search -- https://master.php.net/manage/user-notes.php