> Got it ? I can't be more clear than that :)
Perfect ;)
How about something like the attached patch instead, that should work with
your other case too (untested!).
> btw, I'm a missing something or is the query executed one
> more time upon
> failure line 180 ? Why ?
That looks like the only place where ->data gets executed to me.
--Wez.
Index: mkindex.php
===================================================================
RCS file: /repository/livedocs/mkindex.php,v
retrieving revision 1.33
diff -u -p -r1.33 mkindex.php
--- mkindex.php 23 May 2004 08:58:01 -0000 1.33
+++ mkindex.php 23 May 2004 12:50:12 -0000
@@ -59,6 +59,7 @@ class DocBookXMLFileParser {
var $last_id = false;
var $cdata = null;
var $data = '';
+ var $id_depth = -1;
function DocBookXMLFileParser($filename, $rel, $parser) {
$this->fileid = $GLOBALS['fileid'];
@@ -89,11 +90,12 @@ class DocBookXMLFileParser {
// if there is an ID attribute, record it
if (isset($attrs['ID'])) {
$this->last_id = $attrs['ID'];
+ $this->id_depth = 1;
}
}
function end_elem($parser, $name) {
- if ($this->last_id !== false) {
+ if ($this->last_id !== false && --$this->id_depth == 0) {
echo "\tAdded ID {$this->last_id}\n";
$this->data .= "INSERT INTO idents VALUES ('" .
strtolower($this->last_id) . "', {$this->fileid}, '" .
sqlite_escape_string(trim($this->cdata)) . "');";
@@ -107,7 +109,7 @@ class DocBookXMLFileParser {
//small hack for '&'
$data = str_replace('||amp||', '&', $data);
- $this->cdata = $data;
+ $this->cdata .= trim($data, "\r\n");
}
}