/**
* Callback public function called by WBXML parser.
*/
public function endElement($uri, $element)
{
// </SyncML>: everything done already by end of SyncBody
if (count($this->_Stack) == 1) {
return;
}
// header or body?
if ($this->_Stack[1] == 'SyncHdr') {
switch (count($this->_Stack)) {
case 2:
// </SyncHdr> end of header
$this->handleHeader($this->_currentCommand);
if ($this->debug) {
var_dump($this->_currentCommand);
}
unset($this->_currentCommand);
break;
default:
// pass on to command handler:
$this->_currentCommand->endElement($uri, $element);
break;
}
} else {
switch (count($this->_Stack)) {
case 2:
// </SyncBody> end of SyncBody. Finish everything:
$this->handleEnd();
break;
case 3:
// </[Command]></SyncBody></SyncML>
// Command finished. Complete parsing and pass on to Handler
$this->_currentCommand->endElement($uri, $element);
$this->handleCommand($this->_currentCommand);
if ($this->debug) {
var_dump($this->_currentCommand);
}
unset($this->_currentCommand);
break;
default:
// </...></[Command]></SyncBody></SyncML>
// pass on to command handler:
$this->_currentCommand->endElement($uri, $element);
break;
}
}
if (isset($this->_chars)) {
unset($this->_chars);
}
array_pop($this->_Stack);
}