private function doNext()
 {
     if ($this->m_tagType == self::END_DOCUMENT) {
         return self::END_DOCUMENT;
     }
     $this->m_tagType = ReadUtil::readInt($this->m_stream) & 0xff;
     /*other 3 bytes?*/
     /*some source length*/
     ReadUtil::readInt($this->m_stream);
     $this->m_tagSourceLine = ReadUtil::readInt($this->m_stream);
     /*0xFFFFFFFF*/
     ReadUtil::readInt($this->m_stream);
     $this->m_tagName = -1;
     $this->m_tagAttributes = null;
     switch ($this->m_tagType) {
         case self::START_DOCUMENT:
             /*namespace?*/
             ReadUtil::readInt($this->m_stream);
             /*name?*/
             ReadUtil::readInt($this->m_stream);
             break;
         case self::START_TAG:
             /*0xFFFFFFFF*/
             ReadUtil::readInt($this->m_stream);
             $this->m_tagName = ReadUtil::readInt($this->m_stream);
             /*flags?*/
             ReadUtil::readInt($this->m_stream);
             $attributeCount = ReadUtil::readInt($this->m_stream);
             /*?*/
             ReadUtil::readInt($this->m_stream);
             $this->m_tagAttributes = array();
             for ($i = 0; $i != $attributeCount; ++$i) {
                 $attribute = new TagAttribute();
                 $attribute->namespace = ReadUtil::readInt($this->m_stream);
                 $attribute->name = ReadUtil::readInt($this->m_stream);
                 $attribute->valueString = ReadUtil::readInt($this->m_stream);
                 $attribute->valueType = ReadUtil::readInt($this->m_stream) >> 24;
                 /*other 3 bytes?*/
                 $attribute->value = ReadUtil::readInt($this->m_stream);
                 $this->m_tagAttributes[$i] = $attribute;
             }
             break;
         case self::END_TAG:
             /*0xFFFFFFFF*/
             ReadUtil::readInt($this->m_stream);
             $this->m_tagName = ReadUtil::readInt($this->m_stream);
             break;
         case self::TEXT:
             $this->m_tagName = ReadUtil::readInt($this->m_stream);
             /*?*/
             ReadUtil::readInt($this->m_stream);
             /*?*/
             ReadUtil::readInt($this->m_stream);
             break;
         case self::END_DOCUMENT:
             /*namespace?*/
             ReadUtil::readInt($this->m_stream);
             /*name?*/
             ReadUtil::readInt($this->m_stream);
             break;
         default:
             throw new Exception("Invalid tag type (" . $this->m_tagType . ").");
     }
     return $this->m_tagType;
 }