XMLElement





XMLElement \ Language (API) \ Processing 1.0






























Language (A-Z) \ Libraries \ Tools \ Environment






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.

Name XMLElement 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"); int numSites = xml.getChildCount(); for (int i = 0; i < numSites; i++) { XMLElement kid = xml.getChild(i); int id = kid.getIntAttribute("id"); String url = kid.getStringAttribute("url"); String site = kid.getContent(); println(id + " : " + url + " : " + site); } } Description XMLElement is a representation of an XML object. The object is able to parse XML code. The methods described here are the most basic. More are documented in the Developer's Reference. The encoding parameter inside XML files is ignored, only UTF-8 (or plain ASCII) are parsed properly. Methods getChildCount() Returns the number of children for the element. getChild() Returns a single child. getChildren() Returns all of the children as an XMLElement array. getContent() Returns the content of an element getIntAttribute() Returns an integer attribute of the element. getFloatAttribute() Returns a float attribute of the element. getStringAttribute() Returns a String attribute of the element. getName() Returns the name of the element. Constructor XML(parent, file) Parameters parent PApplet: typically use "this" file String: name of the XML file to load Usage Web & Application

Updated on June 14, 2010 12:05:29pm EDT












Processing was initiated by Ben Fry and Casey Reas. It is developed by a small team of volunteers.


© Info \

Site hosted by Media Temple!









Wyszukiwarka

Podobne podstrony:
XMLElement getChildren
XMLElement getContent
XMLElement getChildCount
XMLElement getIntAttribute
XMLElement getChild
XMLElement getName
XMLElement getStringAttribute
XMLElement getFloatAttribute
XMLElement getChildren
XMLElement getChildCount
XMLElement getIntAttribute
XMLElement
XMLElement getContent
XMLElement getChild
XMLElement getName

więcej podobnych podstron