Re: [PHP-DEV] XML_Parser and php

2002-11-20 Thread Pierre-Alain Joye
On 20 Nov 2002 09:54:59 +0100
Robin Ericsson <[EMAIL PROTECTED]> wrote:

Can you forward your mail on peardev mailing and/or post a bug report on
bugs.php.net (PEAR related).

tia

pa

-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] XML_Parser and php

2002-11-20 Thread Robin Ericsson
Is there any known problems with php 4.2.3 and the latest pear
xml_parser?

I have a class that extends XML_Parser, and I have several problems.

One problem is that variables is emptied without notice, and another
problem that is that memory seems to be overwridden.

I've attached my local functions, and this is the like that causes the
problem:

$this->aCurrentProduct["category"] .= $data."/";

The right category should be:
DATORKOMPONENTER/MINNEN/VIKING COMPONENTS/

but I see things like this:
DATORKOMPON/ENTER/MINNEN/VIKING COMPONENTS/
DATORKOMPONENTER/MINNE/N/VIKING COMPONENTS/
DATORKOMPONE/NTER/MINNEN/VIKING COMPONENTS/
DATORKOMPONENTER/M/INNEN/VIKING COMPONENTS/
DATOR/KOMPONENTER/MINNEN/VIKING COMPONENTS/
DATORKOMPONENTER/MINNEN/VIKIN/G COMPONENTS/
DATORKOMPONEN/TER/MINNEN/VIKING COMPONENTS/
DATORKOMPONENT/ER/MINNEN/VIKING COMPONENTS/
DATO/RKOMPONENTER/MINNEN/VIKING COMPONENTS/
DATORKOMPONENTE/R/MINNEN/VIKING COMPONENTS/
DATORKOM/PONENTER/MINNEN/VIKING COMPONENTS/

-- 
Robin Ericsson <[EMAIL PROTECTED]>

function cDataHandler($xp, $data)
{
switch($this->sCurrentNode)
{
case "PARTNUMBER":  $use = "anr";   
break;
case "DESCRIPTION": $use = "name";  
break;
case "PRICEWITHTAX":$use = "price"; 
break;
case "MANUFACTURER":$use = "manufacturer";  
break;
case "MANUF_PARTNUMBER":$use = "manufacturer.anr";  
break;
case "PRODUCTURL":  $use = "product.url";   
break;
}

if ($use != "")
{
$this->aCurrentProduct[$use] = $data;
}

if (stristr($this->sCurrentNode, "PRODUCTGROUP_") && $data != "")
{
$this->aCurrentProduct["category"] .= $data."/";
}
}

function StartHandler($xp, $elem, &$attribs)
{
$this->sCurrentNode = $elem;
}

function EndHandler($xp, $elem)
{
global $tempProducts;

if ($elem == "ITEMADD")
{
$this->aCurrentProduct["category"] = 
$this->translateCategory($this->aCurrentProduct["category"]);
$tempProducts[] = $this->aCurrentProduct;
$this->aCurrentProduct = array();
}

$this->sCurrentNode = "";
}


-- 
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php