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.
Esempio n. 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;
         }
     }
 }
Esempio n. 2
0
File: Put.php Progetto: horde/horde
 /**
  * Start element handler for the XML parser, delegated from
  * Horde_SyncMl_ContentHandler::startElement().
  *
  * @param string $uri      The namespace URI of the element.
  * @param string $element  The element tag name.
  * @param array $attrs     A hash with the element's attributes.
  */
 public function startElement($uri, $element, $attrs)
 {
     parent::startElement($uri, $element, $attrs);
     switch (count($this->_stack)) {
         case 1:
             $this->_devinf = new Horde_SyncMl_DeviceInfo();
             break;
         case 5:
             if ($element == 'DataStore') {
                 $this->_currentDS = new Horde_SyncMl_DataStore();
             }
             break;
     }
 }
Esempio n. 3
0
File: Sync.php Progetto: horde/horde
 /**
  * Start element handler for the XML parser, delegated from
  * Horde_SyncMl_ContentHandler::startElement().
  *
  * @param string $uri      The namespace URI of the element.
  * @param string $element  The element tag name.
  * @param array $attrs     A hash with the element's attributes.
  */
 public function startElement($uri, $element, $attrs)
 {
     parent::startElement($uri, $element, $attrs);
     $state = $GLOBALS['backend']->state;
     switch (count($this->_stack)) {
         case 2:
             if ($element == 'Replace' || $element == 'Add' || $element == 'Delete') {
                 $this->_contentType = 'text/plain';
                 $this->_elementType = $element;
                 $this->_itemSize = null;
             }
             break;
         case 3:
             if ($element == 'Item') {
                 if (isset($state->curSyncItem)) {
                     // Copy from state in case of <MoreData>.
                     $this->_curItem = $state->curSyncItem;
                     // Set CmdID to the current CmdId, not the initial one
                     // from the first message.
                     $this->_curItem->cmdID = $this->_itemCmdID;
                 } else {
                     $this->_curItem = new Horde_SyncMl_SyncElement($state->getSync($this->_targetURI), $this->_elementType, $this->_itemCmdID, $this->_itemSize);
                 }
                 $this->_itemMoreData = false;
             }
     }
 }