bjori Sun Aug 19 12:09:55 2007 UTC
Modified files:
/phd build.php
Log:
- No need to call ->isChunk, ->getAttributes() multiple times
- Pass basic element properties as the 4th parameter to the callback
functions
http://cvs.php.net/viewvc.cgi/phd/build.php?r1=1.22&r2=1.23&diff_format=u
Index: phd/build.php
diff -u phd/build.php:1.22 phd/build.php:1.23
--- phd/build.php:1.22 Fri Aug 17 09:16:07 2007
+++ phd/build.php Sun Aug 19 12:09:55 2007
@@ -1,5 +1,5 @@
<?php
-/* $Id: build.php,v 1.22 2007/08/17 09:16:07 bjori Exp $ */
+/* $Id: build.php,v 1.23 2007/08/19 12:09:55 bjori Exp $ */
function err($no, $str, $file, $line) {
global $notify;
@@ -103,7 +103,15 @@
case XMLReader::ELEMENT:
case XMLReader::END_ELEMENT:
$nodename = $reader->name;
- $open = $nodetype == XMLReader::ELEMENT;
+ $open = $nodetype == XMLReader::ELEMENT;
+ $isChunk = $reader->isChunk;
+ $attrs = $reader->getAttributes();
+ $props = array(
+ "empty" => $reader->isEmptyElement,
+ /* These two are not used at the moment */
+ "lang" => $reader->xmlLang,
+ "ns" => $reader->namespaceURI,
+ );
$skip = array();
foreach($elementmaps as $theme => $map) {
@@ -116,15 +124,15 @@
if (strncmp($tag, "format_", 7)) {
$retval = $themes[$theme]->transformFromMap($open,
$tag, $nodename);
if ($retval !== false) {
- $themes[$theme]->appendData($retval,
$reader->isChunk);
+ $themes[$theme]->appendData($retval, $isChunk);
$skip[] = $theme;
}
continue;
}
$funcname = $tag;
- $retval = $themes[$theme]->{$funcname}($open,
$nodename, $reader->getAttributes());
+ $retval = $themes[$theme]->{$funcname}($open,
$nodename, $attrs, $props);
if ($retval !== false) {
- $themes[$theme]->appendData($retval,
$reader->isChunk);
+ $themes[$theme]->appendData($retval, $isChunk);
$skip[] = $theme;
}
continue;
@@ -143,17 +151,17 @@
$retval = $format->transformFromMap($open, $tag,
$nodename);
foreach($themes as $name => $theme) {
if (!in_array($name, $skip)) {
- $theme->appendData($retval, $reader->isChunk);
+ $theme->appendData($retval, $isChunk);
}
}
break;
}
$funcname = $tag;
}
- $retval = $format->{$funcname}($open, $nodename,
$reader->getAttributes());
+ $retval = $format->{$funcname}($open, $nodename, $attrs,
$props);
foreach($themes as $name => $theme) {
if (!in_array($name, $skip)) {
- $theme->appendData($retval, $reader->isChunk);
+ $theme->appendData($retval, $isChunk);
}
}
}