Example #1
0
        public override XML_SaxParserComponent startElement(string nodeName, List <XML_Attribute> attributes)
        {
            if (_state == State.eRoot)
            {
                if (nodeName.Equals(XML_Constants.kStageColTag))
                {
                    _state = State.eStages;
                }
            }
            else if (_state == State.eStages)
            {
                if (nodeName.Equals(XML_Constants.kStageTag))
                {
                    //  Only enter stage mode if we encounter the xml tag we search for.
                    string value = findAttribute(attributes, XML_Constants.kNameTag);
                    if (!string.IsNullOrEmpty(value) && value.Equals(_clipName))
                    {
                        _state = State.eStage;
                    }
                }
            }
            else // if ( _state == eStage )
            {
                if (nodeName.Equals(XML_Constants.kSoundTag))
                {
                    XML_Types.XML_SoundSequence seq = new XML_Types.XML_SoundSequence();
                    seq._startFrame = 1.0f;

                    foreach (XML_Attribute attr in attributes)
                    {
                        if (attr._name.Equals(XML_Constants.kNameTag))
                        {
                            seq._name = attr._value;
                        }
                        else if (attr._name.Equals(XML_Constants.kTimeTag))
                        {
                            seq._startFrame = float.Parse(attr._value, CultureInfo.InvariantCulture.NumberFormat);
                        }
                    }

                    if (!string.IsNullOrEmpty(seq._name))
                    {
                        _soundSequences.Add(seq);
                    }
                }
            }

            return(this);
        }
    public override XML_SaxParserComponent startElement( string nodeName, List<XML_Attribute> attributes )
    {
      if ( _state == State.eRoot )
      {
        if ( nodeName.Equals( XML_Constants.kStageColTag ) )
        {
          _state = State.eStages;
        }
      }
      else if ( _state == State.eStages )
      {
        if ( nodeName.Equals( XML_Constants.kStageTag ) )
        {
          //  Only enter stage mode if we encounter the xml tag we search for.
          string value = findAttribute(attributes, XML_Constants.kNameTag);
          if ( !string.IsNullOrEmpty(value) && value.Equals(_clipName) )
          {
            _state = State.eStage;
          }
        }
      }
      else // if ( _state == eStage )
      {
        if ( nodeName.Equals( XML_Constants.kSoundTag ) )
        {
          XML_Types.XML_SoundSequence seq = new XML_Types.XML_SoundSequence();
          seq._startFrame = 1.0f;

          foreach (XML_Attribute attr in attributes)
          {
            if ( attr._name.Equals( XML_Constants.kNameTag ) )
              seq._name = attr._value;
            else if ( attr._name.Equals( XML_Constants.kTimeTag ) )
              seq._startFrame = float.Parse( attr._value, CultureInfo.InvariantCulture.NumberFormat);
          }

          if ( !string.IsNullOrEmpty(seq._name) )
          {
            _soundSequences.Add(seq);
          }
        }
      }

      return this;

    }