summaryrefslogtreecommitdiff
path: root/scripts/ext_skel_ng/xml_stream_callback_parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ext_skel_ng/xml_stream_callback_parser.php')
-rw-r--r--scripts/ext_skel_ng/xml_stream_callback_parser.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/ext_skel_ng/xml_stream_callback_parser.php b/scripts/ext_skel_ng/xml_stream_callback_parser.php
new file mode 100644
index 0000000000..50f1a1c5be
--- /dev/null
+++ b/scripts/ext_skel_ng/xml_stream_callback_parser.php
@@ -0,0 +1,35 @@
+<?php
+ class xml_stream_callback_parser extends xml_stream_parser {
+ function xml_stream_callback_parser ($stream) {
+ $this->cdata = "";
+ $this->tags = array();
+ $this->attrs = array();
+
+ parent::xml_stream_parser($stream);
+ }
+
+ function cdata($parser, $cdata) {
+ $this->cdata .= $cdata;
+ }
+
+ function tag_open($parser, $tag, $attributes) {
+ array_push($this->tags, $tag);
+ array_push($this->attrs, $attributes);
+ }
+
+ function tag_close($parser, $tag) {
+ $attributes = array_pop($this->attrs);
+
+ for ($tags = $this->tags; count($tags); array_shift($tags)) {
+ $method = "handle_".join("_", $tags);
+ if(method_exists($this, $method)) {
+ $this->$method($attributes);
+ break;
+ }
+ }
+
+ $this->cdata = "";
+ array_pop($this->tags);
+ }
+ }
+?> \ No newline at end of file