JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce_XmlElement.h File Reference
This graph shows which files directly or indirectly include this file:

Classes

class  juce::XmlElement
 Used to build a tree of elements representing an XML document. More...
 
struct  juce::XmlElement::XmlAttributeNode
 

Namespaces

 juce
 

Macros

#define forEachXmlChildElement(parentXmlElement, childElementVariableName)
 A handy macro to make it easy to iterate all the child elements in an XmlElement. More...
 
#define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName)
 A macro that makes it easy to iterate all the child elements of an XmlElement which have a specified tag. More...
 

Macro Definition Documentation

◆ forEachXmlChildElement

#define forEachXmlChildElement (   parentXmlElement,
  childElementVariableName 
)
Value:
\
for (auto* childElementVariableName = (parentXmlElement).getFirstChildElement(); \
childElementVariableName != nullptr; \
childElementVariableName = childElementVariableName->getNextElement())

A handy macro to make it easy to iterate all the child elements in an XmlElement.

The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element.

E.g.

XmlElement* myParentXml = createSomeKindOfXmlDocument();
forEachXmlChildElement (*myParentXml, child)
{
if (child->hasTagName ("FOO"))
doSomethingWithXmlElement (child);
}
See also
forEachXmlChildElementWithTagName

◆ forEachXmlChildElementWithTagName

#define forEachXmlChildElementWithTagName (   parentXmlElement,
  childElementVariableName,
  requiredTagName 
)
Value:
\
for (auto* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \
childElementVariableName != nullptr; \
childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName))

A macro that makes it easy to iterate all the child elements of an XmlElement which have a specified tag.

This does the same job as the forEachXmlChildElement macro, but only for those elements that have a particular tag name.

The parentXmlElement should be a reference to the parent XML, and the childElementVariableName will be the name of a pointer to each child element. The requiredTagName is the tag name to match.

E.g.

XmlElement* myParentXml = createSomeKindOfXmlDocument();
forEachXmlChildElementWithTagName (*myParentXml, child, "MYTAG")
{
// the child object is now guaranteed to be a <MYTAG> element..
doSomethingWithMYTAGElement (child);
}
See also
forEachXmlChildElement