Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
Class | XMLElement |
||||||
---|---|---|---|---|---|---|---|
Name | getFloatAttribute() |
||||||
Examples | // The following short XML file called "sites.xml" is parsed // in the code below. It must be in the project's "data" directory // <?xml version="1.0"? > // <websites> // <site id="0" rank="3.14">Processing</site> // <site id="1" rank="6.28">Processing Mobile</site> // </websites> XMLElement xml; void setup() { size(200, 200); xml = new XMLElement(this, "sites.xml"); int numSites = xml.getChildCount(); for (int i = 0; i < numSites; i++) { XMLElement kid = xml.getChild(i); int id = kid.getIntAttribute("id"); float url = kid.getFloatAttribute("rank"); String site = kid.getContent(); println(id + " : " + url + " : " + site); } } |
||||||
Description | Returns a float attribute of the element. If the default parameter is used and the attribute doesn't exist, the default value is returned. When using the version of the method without the default parameter, if the attribute doesn't exist, the value 0 is returned. | ||||||
Syntax | xml.getFloatAttribute(name) xml.getFloatAttribute(name, default) |
||||||
Parameters |
|
||||||
Returns | float | ||||||
Usage | Web & Application |