1 Reply Latest reply on Sep 27, 2006 9:53 AM by ntsiii

    Attribute names

    KostyaS Level 1
      For example I have XML structure:

      var xmlData:XML =
      <data>
      <item at1="val1" two="second" 3="three" />
      </data>


      Can I get all attribute names and I don' t know attributes quantity?

      TIA
        • 1. Re: Attribute names
          ntsiii Level 3
          The snippet below takes an xml node(nodeCur), loops over the attributes list and builds an array that contains the attribute name and value for each attribute. It comes from a sample app that allows you to edit an xml file.
          Sorry that the forum will remove the formatting

          var aDPAttributes:Array = new Array();
          var xlAttributes:XMLList = nodeCur.@*;
          var attribute:Attribute;
          for ( var i:int = 0; i < xlAttributes.length(); i++) {
          aDPAttributes.push({name:xlAttributes .name(),value:xlAttributes});
          }
          dgAttributes.dataProvider = aDPAttributes; //set the property sheet dataProvider

          Tracy