143 bool addDefaultHeader =
true;
144 int lineWrapLength = 60;
145 const char* newLineChars =
"\r\n";
161 void writeTo (
OutputStream& output,
const TextFormat& format = {})
const;
166 bool writeTo (
const File& destinationFile,
const TextFormat& format = {})
const;
176 String getNamespace()
const;
179 String getTagNameWithoutNamespace()
const;
341 void removeAllAttributes()
noexcept;
506 void deleteAllChildElements()
noexcept;
555 auto num = getNumChildElements();
560 getChildElementsAsArray (
elems);
562 reorderChildElements (
elems, num);
636 void deleteAllTextElements()
noexcept;
651 struct GetNextElementWithTagName
653 GetNextElementWithTagName() =
default;
654 explicit GetNextElementWithTagName (String n) : name (std::move (n)) {}
655 XmlElement* getNext (
const XmlElement& e)
const {
return e.getNextElementWithTagName (name); }
661 template <
typename Traits>
662 class Iterator :
private Traits
665 using difference_type = ptrdiff_t;
666 using value_type = XmlElement*;
667 using pointer =
const value_type*;
668 using reference = value_type;
669 using iterator_category = std::input_iterator_tag;
671 Iterator() =
default;
673 template <
typename... Args>
674 Iterator (XmlElement* e, Args&&... args)
675 : Traits (std::forward<Args> (args)...), element (e) {}
677 Iterator begin()
const {
return *
this; }
678 Iterator end()
const {
return Iterator{}; }
680 bool operator== (
const Iterator& other)
const {
return element == other.element; }
681 bool operator!= (
const Iterator& other)
const {
return ! operator== (other); }
683 reference operator*()
const {
return element; }
684 pointer operator->()
const {
return &element; }
686 Iterator& operator++()
688 element = Traits::getNext (*element);
692 Iterator operator++ (
int)
700 value_type element =
nullptr;
738 [[deprecated (
"This has been deprecated in favour of the toString method.")]]
739 String createDocument (StringRef dtdToUse,
740 bool allOnOneLine =
false,
741 bool includeXmlHeader =
true,
742 StringRef encodingType =
"UTF-8",
743 int lineWrapLength = 60)
const;
745 [[deprecated (
"This has been deprecated in favour of the writeTo method.")]]
746 void writeToStream (OutputStream& output,
748 bool allOnOneLine =
false,
749 bool includeXmlHeader =
true,
750 StringRef encodingType =
"UTF-8",
751 int lineWrapLength = 60)
const;
753 [[deprecated (
"This has been deprecated in favour of the writeTo method.")]]
754 bool writeToFile (
const File& destinationFile,
756 StringRef encodingType =
"UTF-8",
757 int lineWrapLength = 60)
const;
762 struct XmlAttributeNode
764 XmlAttributeNode (
const XmlAttributeNode&)
noexcept;
765 XmlAttributeNode (
const Identifier&,
const String&)
noexcept;
766 XmlAttributeNode (String::CharPointerType, String::CharPointerType);
768 LinkedListPointer<XmlAttributeNode> nextListItem;
773 XmlAttributeNode& operator= (
const XmlAttributeNode&) =
delete;
776 friend class XmlDocument;
777 friend class LinkedListPointer<XmlAttributeNode>;
778 friend class LinkedListPointer<XmlElement>;
779 friend class LinkedListPointer<XmlElement>::Appender;
780 friend class NamedValueSet;
782 LinkedListPointer<XmlElement> nextListItem, firstChildElement;
783 LinkedListPointer<XmlAttributeNode> attributes;
786 XmlElement (int) noexcept;
787 void copyChildrenAndAttributesFrom (const XmlElement&);
788 void writeElementAsText (OutputStream&, int, int, const char*) const;
789 void getChildElementsAsArray (XmlElement**) const noexcept;
790 void reorderChildElements (XmlElement**, int) noexcept;
791 XmlAttributeNode* getAttribute (StringRef) const noexcept;
796 XmlElement (const wchar_t*) = delete;
798 JUCE_LEAK_DETECTOR (XmlElement)