name
getAttribute ( )
/*
Tis example loads an xml file, loads the attributes
of the rootnode and prints out their values.
*/

import proxml.*;

XMLInOut xmlIO;

void setup(){
  size(400,400);
  
  xmlIO = new XMLInOut(this);
  xmlIO.loadElement("my-xml-file.xml");
}

void xmlEvent(XMLElement element){
  String[] attributes = element.getAttributes();
  for(int i = 0; i < attributes.length; i++){
    println(attributes[i]+":"+
      element.getAttribute(attributes[i]));
  }
}

void draw(){
}
description
Use getAttribute() to get the value of an attribute as a string. If your are sure, the value is an int or a float value you can also use getIntAttribute() or getFloatAttribute() to get the numeric value without a cast.
syntax
getAttribute(key);
parameters
key
String, the name of the attribute you want the value of
returns
String, the value to the given attribute
usage
Web & Application
related