Update using prefixes

Hello!

I have been trying to modify data using “TAMINO PHP API”. I defined two prefixes: “w” and “o”. Unfortunately, when I tried to execute method “xquery”, I got the following error:

Tamino Error 6354: Namespace prefix undefined (Namespace prefix: w)

----------------------------------------
$xql = "update replace input()/w:doc[o:data/o:Id="$id"] with ".
“<w:doc xmlns:o=prefix1 xmlns:w=prefix2”> ".
“<o:data>”.
“<o:Id>$id</o:Id>”.
“<o:surname>$surname</o:surname>”.
“<o:name>$name</o:name>”.
“</o:data>”.
“</w:doc>”;

if (!($tamino->xquery($xql)))
thfPrintError($tamino);
else
{
echo “OK”;
}
----------------------------------------

How can I fix it?

In advance, thanks a lot!


regards,
Dariusz

Hello Dariusz,

this is actually not a problem of the PHP API
but rather a problem of an incorrect XQuery
update statement. You use the w and o prefixes
in the replace statement before you defined
them. Place the following two lines at the
beginning of your XQuery statement, and then
it should work:

declare namespace w="prefix2" 
declare namespace o="prefix1" 



regards,
Heiko