XML

Data / Composite

Description

Represents an XML element. Load with loadXML() or parseXML(). Access children and attributes by name.

Syntax

XML xml = loadXML("data.xml") XML* child = xml.getChild("element")

Parameters

None

Returns

XML

Methods

getName()Returns the name of the element
getContent()Returns the text content of the element
getAttribute(std::string k)Returns the value of an attribute
getAttributeInt(std::string k)Returns an attribute as int
getAttributeFloat(std::string k)Returns an attribute as float
setAttribute(std::string k, std::string v)Sets an attribute value
setContent(std::string c)Sets the text content
addChild(std::string name)Adds a child element
getChild(int i)Gets child by index
getChild(std::string name)Gets child by tag name
getChildCount()Returns number of children
getChildren(std::string name)Returns all children with given tag name

Related

Under the Hood

Implementation in Processing.h / Processing.cpp:

Loading...