christoph_retti

updated

18 years ago

0

5350

January 8th, 2009 10:00

tag attributes

Hi, I have a question regarding tag attributes: if I want to give out all attributes of a tag (which are name/value pairs) I would expect to

use code like this:

        for(String key : tag.getAttributes()) {

          String value = tag.getStringAttribute(key);  

          // do something

        }



but instead only the following works

      String [] atts = tag.getAttributes();     

     

      booleanisNameValueArray = (atts.length/ 2 == tag.getNumAttributes());

     

      if(isNameValueArray) {

        for(inti=0; i < atts.length/ 2; i+=2) {

          String key = atts;

          String value = atts[i+1];

          // do something        

        }

      } else{

        for(String key : tag.getAttributes()) {

          String value = tag.getStringAttribute(key);  

          // do something

        }

      }

Is this a bug in the SDK ort is this behaviour wanted?
P.S. The same also is with clip attributes, see
      String [] atts = clip.getDescriptionAttributes();
     
      boolean isNameValueArray = (atts.length / 2 == clip.getNumDescriptionAttributes());
     
      if (isNameValueArray) {
        for (int i=0; i < atts.length / 2; i+=2) {
          String key = atts;
          String value = atts[i+1];         
        }
      } else {
        for (String key : atts) {
          String value = clip.getDescriptionAttribute(key);
        }
      }