Horde_SyncMl_Command::startElement PHP Method

startElement() public method

Start element handler for the XML parser, delegated from Horde_SyncMl_ContentHandler::startElement().
public startElement ( string $uri, string $element, array $attrs )
$uri string The namespace URI of the element.
$element string The element tag name.
$attrs array A hash with the element's attributes.
    public function startElement($uri, $element, $attrs)
    {
        $this->_stack[] = $element;
    }

Usage Example

Example #1
0
 /**
  * Callback public function called by WBXML parser.
  */
 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;
         }
     }
 }
All Usage Examples Of Horde_SyncMl_Command::startElement