a port of the Processing Visualization Language
Class XMLElement
Name

getChild()

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" url="processing.org">Processing</site>
//   <site id="1" url="mobile.processing.org">Processing Mobile</site>
// </websites>

XMLElement xml;

void setup() {
  size(200, 200);
  xml = new XMLElement(this, "sites.xml");
  XMLElement kid = xml.getChild(0);
  String site = kid.getContent();
  println(site);    
}

void setup() {
  // Download RSS feed of news stories from yahoo.com
  String url = "http://rss.news.yahoo.com/rss/topstories";
  XMLElement rss = new XMLElement(this, url);
  // Get the  element from inside 
  XMLElement desc = rss.getChild("channel/description");
  println(desc.getContent());
}
Description Returns the child XMLElement as specified by the index parameter. The value of the index parameter must be less than the total number of children to avoid going out of the array storing the child elements. When the

path

parameter is specified, then it will return all children that match that path. The path is a series of elements and sub-elements, separated by slashes.
Syntax
xml.getChild(index)

xml.getChild(path)
Parameters
xml any variable of type XMLElement
index int: the element
path String: path to a particular element
Returns XMLElement
Usage Web & Application
Related XMLElement_getChildCount()
XMLElement_getChildren()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub