This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

XML

Name

getIntContent()

Examples
// The following short XML file called "positions.xml" is parsed
// in the code below. It must be in the project's "data" folder.
//
// <?xml version="1.0"?>
// <positions>
//   <position id="0">128</position>
//   <position id="1">256</position>
//   <position id="2">512</position>
// </positions>

XML xml;

void setup() {
  xml = loadXML("positions.xml");
  XML firstChild = xml.getChild("position");
  println(firstChild.getIntContent());
}

// Sketch prints:
// 128
Description Returns the content of an element as an int. If there is no such content, either null or the provided default value is returned.
Syntax
.getIntContent()
.getIntContent(defaultValue)
Parameters
defaultValue int: the default value of the attribute
Returnsint
RelatedgetContent()
getFloatContent()
Updated on January 21, 2019 10:05:14am EST

Creative Commons License