Horde_SyncMl_ContentHandler::startElement PHP Method

startElement() public method

Callback public function called by WBXML parser.
public startElement ( $uri, $element, $attrs )
    public function startElement($uri, $element, $attrs)
    {
        $this->_Stack[] = $element;
        // <SyncML>: don't do anyhting yet
        if (count($this->_Stack) == 1) {
            return;
        }
        // header or body?
        if ($this->_Stack[1] == 'SyncHdr') {
            if (count($this->_Stack) == 2) {
                $this->_currentCommand = new Horde_SyncMl_Command_SyncHdr($this->_xmlWriter);
            }
            $this->_currentCommand->startElement($uri, $element, $attrs);
        } else {
            switch (count($this->_Stack)) {
                case 2:
                    // <SyncBody>: do nothing yet
                    break;
                case 3:
                    // new Command:
                    // <SyncML><SyncBody><[Command]>
                    $this->_currentCommand =& Horde_SyncMl_Command::factory($element, $this->_xmlWriter);
                    $this->_currentCommand->startElement($uri, $element, $attrs);
                    break;
                default:
                    // pass on to current command handler:
                    // <SyncML><SyncBody><Command><...>
                    $this->_currentCommand->startElement($uri, $element, $attrs);
                    break;
            }
        }
    }