49 #define forEachXmlChildElement(parentXmlElement, childElementVariableName) \ 51 for (auto* childElementVariableName = (parentXmlElement).getFirstChildElement(); \ 52 childElementVariableName != nullptr; \ 53 childElementVariableName = childElementVariableName->getNextElement()) 78 #define forEachXmlChildElementWithTagName(parentXmlElement, childElementVariableName, requiredTagName) \ 80 for (auto* childElementVariableName = (parentXmlElement).getChildByName (requiredTagName); \ 81 childElementVariableName != nullptr; \ 82 childElementVariableName = childElementVariableName->getNextElementWithTagName (requiredTagName)) 188 bool ignoreOrderOfAttributes)
const noexcept;
209 bool allOnOneLine =
false,
210 bool includeXmlHeader =
true,
212 int lineWrapLength = 60)
const;
231 bool allOnOneLine =
false,
232 bool includeXmlHeader =
true,
234 int lineWrapLength = 60)
const;
255 bool writeToFile (
const File& destinationFile,
258 int lineWrapLength = 60)
const;
268 String getNamespace()
const;
271 String getTagNameWithoutNamespace()
const;
277 bool hasTagName (
StringRef possibleTagName)
const noexcept;
283 bool hasTagNameIgnoringNamespace (
StringRef possibleTagName)
const;
296 int getNumAttributes()
const noexcept;
305 const String& getAttributeName (
int attributeIndex)
const noexcept;
314 const String& getAttributeValue (
int attributeIndex)
const noexcept;
320 bool hasAttribute (
StringRef attributeName)
const noexcept;
325 const String& getStringAttribute (
StringRef attributeName)
const noexcept;
342 bool compareAttribute (
StringRef attributeName,
344 bool ignoreCase =
false)
const noexcept;
356 int getIntAttribute (
StringRef attributeName,
int defaultReturnValue = 0)
const;
368 double getDoubleAttribute (
StringRef attributeName,
double defaultReturnValue = 0.0)
const;
380 bool getBoolAttribute (
StringRef attributeName,
bool defaultReturnValue =
false)
const;
395 void setAttribute (
const Identifier& attributeName,
const String& newValue);
409 void setAttribute (
const Identifier& attributeName,
int newValue);
423 void setAttribute (
const Identifier& attributeName,
double newValue);
430 void removeAttribute (
const Identifier& attributeName) noexcept;
433 void removeAllAttributes() noexcept;
485 int getNumChildElements()
const noexcept;
495 XmlElement* getChildElement (
int index)
const noexcept;
513 StringRef attributeValue)
const noexcept;
529 void addChildElement (
XmlElement* newChildElement) noexcept;
542 void insertChildElement (
XmlElement* newChildElement,
543 int indexToInsertAt) noexcept;
557 void prependChildElement (
XmlElement* newChildElement) noexcept;
582 bool replaceChildElement (
XmlElement* currentChildElement,
591 void removeChildElement (
XmlElement* childToRemove,
592 bool shouldDeleteTheChild) noexcept;
597 void deleteAllChildElements() noexcept;
602 void deleteAllChildElementsWithTagName (
StringRef tagName) noexcept;
605 bool containsChildElement (
const XmlElement* possibleChild)
const noexcept;
642 template <
class ElementComparator>
644 bool retainOrderOfEquivalentItems =
false)
646 auto num = getNumChildElements();
651 getChildElementsAsArray (elems);
652 sortArray (comparator, (
XmlElement**) elems, 0, num - 1, retainOrderOfEquivalentItems);
653 reorderChildElements (elems, num);
665 bool isTextElement()
const noexcept;
683 const String& getText()
const noexcept;
691 void setText (
const String& newText);
706 String getAllSubText()
const;
717 const String& defaultReturnValue)
const;
722 void addTextElement (
const String& text);
727 void deleteAllTextElements() noexcept;
733 static bool isValidXmlName (
StringRef possibleName) noexcept;
737 struct XmlAttributeNode
739 XmlAttributeNode (
const XmlAttributeNode&) noexcept;
748 XmlAttributeNode& operator= (
const XmlAttributeNode&) =
delete;
762 XmlElement (int) noexcept;
763 void copyChildrenAndAttributesFrom (const XmlElement&);
764 void writeElementAsText (OutputStream&, int indentationLevel, int lineWrapLength) const;
765 void getChildElementsAsArray (XmlElement**) const noexcept;
766 void reorderChildElements (XmlElement**, int) noexcept;
767 XmlAttributeNode* getAttribute (StringRef) const noexcept;
772 XmlElement (const wchar_t*) = delete;
774 JUCE_LEAK_DETECTOR (XmlElement)
Parses a text-based XML document and creates an XmlElement object from it.
#define JUCE_API
This macro is added to all JUCE public class declarations.
Represents a string identifier, designed for accessing properties by name.
A simple class for holding temporary references to a string literal or String.
Used to build a tree of elements representing an XML document.
Very simple container class to hold a pointer to some data on the heap.
Holds a set of named var objects.
XmlElement * getNextElement() const noexcept
Returns the next of this element's siblings.
void sortChildElements(ElementComparator &comparator, bool retainOrderOfEquivalentItems=false)
Sorts the child elements using a comparator.
Represents a local file or directory.
The base class for streams that write data to some kind of destination.
XmlElement * getFirstChildElement() const noexcept
Returns the first of this element's sub-elements.
const String & getTagName() const noexcept
Returns this element's tag type name.
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...