4#include <qplatformdefs.h>
6#include "private/qxmlutils_p.h"
16#if QT_CONFIG(regularexpression)
24#include <private/qduplicatetracker_p.h>
25#include <private/qstringiterator_p.h>
83 prefix = qName.
left(
i);
106 if (
name.isEmpty()) {
117 bool firstChar =
true;
118 for (
int i = 0;
i <
name.size(); ++
i) {
144 if (namespaces && !prefix.
isEmpty())
145 return prefix + u
':' +
result;
161 while (
it.hasNext()) {
162 const char32_t c =
it.next(QChar::Null);
164 result.append(QChar::fromUcs4(
c));
190 qsizetype idx = fixedData.indexOf(
"--"_L1);
197 fixedData.remove(idx, 2);
219 qsizetype idx = fixedData.indexOf(
"]]>"_L1);
226 fixedData.remove(idx, 3);
247 qsizetype idx = fixedData.indexOf(
"?>"_L1);
254 fixedData.remove(idx, 2);
280 if (
result.indexOf(u
'\'') != -1 &&
result.indexOf(u
'"') != -1) {
305 if (
result.indexOf(u
'\'') != -1 &&
result.indexOf(u
'"') != -1) {
380 : impl(implementation.impl)
400 other.impl->ref.ref();
413 return impl ==
other.impl;
446 if (feature ==
"XML"_L1) {
447 if (version.
isEmpty() || version ==
"1.0"_L1)
502 dt->name = fixedName;
504 dt->publicId.clear();
505 dt->systemId.clear();
507 dt->publicId = fixedPublicId;
508 dt->systemId = fixedSystemId;
535 return (impl ==
nullptr);
671 if (
p->isElement() &&
p->nodeName() ==
tagname) {
782 : impl(nodeList.impl)
794 other.impl->ref.ref();
807 if (impl ==
other.impl)
809 if (!impl || !
other.impl)
811 return (*impl == *
other.impl);
975 if (
p->nodeName() ==
n)
990 if (newChild == refChild)
994 if (refChild && refChild->parent() !=
this)
1004 if (newChild->isDocumentFragment()) {
1006 if (newChild->first ==
nullptr)
1017 if (!refChild || refChild->prev ==
nullptr) {
1019 first->prev = newChild->last;
1020 newChild->last->next =
first;
1036 newChild->
first =
nullptr;
1037 newChild->
last =
nullptr;
1045 if (newChild->parent())
1046 newChild->parent()->removeChild(newChild);
1048 newChild->setParent(
this);
1052 first->prev = newChild;
1053 newChild->next =
first;
1060 if (refChild->prev ==
nullptr) {
1070 newChild->
next = refChild;
1073 refChild->
prev = newChild;
1085 if (newChild == refChild)
1089 if (refChild && refChild->parent() !=
this)
1099 if (newChild->isDocumentFragment()) {
1101 if (newChild->first ==
nullptr)
1112 if (!refChild || refChild->next ==
nullptr) {
1130 newChild->
first =
nullptr;
1131 newChild->
last =
nullptr;
1136 if (newChild->parent())
1141 newChild->ref.ref();
1143 newChild->setParent(
this);
1156 if (refChild->next ==
nullptr) {
1166 newChild->
prev = refChild;
1169 refChild->
next = newChild;
1176 if (!newChild || !oldChild)
1178 if (oldChild->parent() !=
this)
1180 if (newChild == oldChild)
1190 if (newChild->isDocumentFragment()) {
1192 if (newChild->first ==
nullptr)
1204 oldChild->next->prev = newChild->last;
1206 oldChild->prev->next = newChild->first;
1208 newChild->last->next = oldChild->next;
1209 newChild->first->prev = oldChild->prev;
1211 if (
first == oldChild)
1212 first = newChild->first;
1213 if (
last == oldChild)
1217 oldChild->next =
nullptr;
1218 oldChild->prev =
nullptr;
1224 newChild->first =
nullptr;
1225 newChild->last =
nullptr;
1228 oldChild->ref.deref();
1235 newChild->ref.ref();
1238 if (newChild->parent())
1239 newChild->parent()->removeChild(newChild);
1241 newChild->setParent(
this);
1244 oldChild->next->prev = newChild;
1246 oldChild->prev->next = newChild;
1248 newChild->next = oldChild->next;
1249 newChild->prev = oldChild->prev;
1251 if (
first == oldChild)
1253 if (
last == oldChild)
1257 oldChild->next =
nullptr;
1258 oldChild->prev =
nullptr;
1261 oldChild->ref.deref();
1269 if (oldChild->parent() !=
this)
1279 if (oldChild->next ==
nullptr && oldChild->prev ==
nullptr &&
first != oldChild)
1283 oldChild->next->prev = oldChild->prev;
1285 oldChild->prev->next = oldChild->next;
1287 if (
last == oldChild)
1289 if (
first == oldChild)
1293 oldChild->next =
nullptr;
1294 oldChild->prev =
nullptr;
1297 oldChild->ref.deref();
1311 while (
p && !
p->isDocument()) {
1337 t->appendData(
p->nodeValue());
1381#define IMPL static_cast<QDomNodePrivate *>(impl)
1509 other.impl->ref.ref();
1593 if (!
IMPL->prefix.isEmpty())
1594 return IMPL->prefix + u
':' +
IMPL->name;
1666 return IMPL->nodeType();
1857 return IMPL->namespaceURI;
1886 return IMPL->prefix;
1905 if (!
impl ||
IMPL->prefix.isNull())
1925 if (!
impl ||
IMPL->createdWithDom1Interface)
1967 return QDomNode(
IMPL->insertBefore(newChild.impl, refChild.impl));
1995 return QDomNode(
IMPL->insertAfter(newChild.impl, refChild.impl));
2015 if (!
impl || !newChild.impl || !oldChild.impl)
2017 return QDomNode(
IMPL->replaceChild(newChild.impl, oldChild.impl));
2033 if (oldChild.isNull())
2066 qWarning(
"Calling appendChild() on a null node does nothing.");
2080 return IMPL->first !=
nullptr;
2089 return (
impl ==
nullptr);
2395 if (tagName.
isEmpty() || elt.tagName() == tagName)
2417 if (tagName.
isEmpty() || elt.tagName() == tagName)
2440 if (tagName.
isEmpty() || elt.tagName() == tagName)
2463 if (tagName.
isEmpty() || elt.tagName() == tagName)
2509 , appendToParent(
false)
2527 new_node->setParent(pimpl);
2528 m->setNamedItem(new_node);
2542 if (!
it.value()->ref.deref())
2560 if (!
n->prefix.isNull()) {
2562 if (
n->namespaceURI == nsURI &&
n->name == localName)
2592 if (!
arg->prefix.isNull()) {
2650#define IMPL static_cast<QDomNamedNodeMapPrivate *>(impl)
2702 : impl(namedNodeMap.impl)
2721 other.impl->ref.ref();
2734 return impl ==
other.impl;
2880 return IMPL->length();
2941 if (
p->isNotation())
2986 if (
p &&
p->isEntity())
2988 else if (
p &&
p->isNotation())
2999 if (
p &&
p->isEntity())
3001 else if (
p &&
p->isNotation())
3013 if (oldChild && oldChild->isEntity())
3015 else if (oldChild && oldChild->isNotation())
3020 else if (
p->isNotation())
3032 if (
p &&
p->isEntity())
3034 else if (
p &&
p->isNotation())
3056 s <<
"<!DOCTYPE " <<
name;
3072 it2.value()->save(
s, 0, indent);
3076 it.value()->save(
s, 0, indent);
3090#define IMPL static_cast<QDomDocumentTypePrivate *>(impl)
3153 return IMPL->nodeName();
3186 return IMPL->publicId;
3199 return IMPL->systemId;
3212 return IMPL->internalSubset;
3240 name = u
"#document-fragment"_s;
3339 name = u
"#character-data"_s;
3357 return value.size();
3391#define IMPL static_cast<QDomCharacterDataPrivate *>(impl)
3479 return IMPL->dataLength();
3580 if (removed && !removed->ref.loadRelaxed())
3610 const bool encodeQuotes =
true,
3611 const bool performAVN =
false,
3612 const bool encodeEOLs =
false)
3615 int len = retval.size();
3619 const QChar ati(retval.at(
i));
3622 retval.replace(
i, 1,
"<"_L1);
3625 }
else if (encodeQuotes && (ati == u
'"')) {
3626 retval.replace(
i, 1,
"""_L1);
3629 }
else if (ati == u
'&') {
3630 retval.replace(
i, 1,
"&"_L1);
3633 }
else if (ati == u
'>' &&
i >= 2 && retval[
i - 1] == u
']' && retval[
i - 2] == u
']') {
3634 retval.replace(
i, 1,
">"_L1);
3637 }
else if (performAVN &&
3638 (ati ==
QChar(0xA) ||
3639 ati ==
QChar(0xD) ||
3640 ati ==
QChar(0x9))) {
3642 retval.replace(
i, 1, replacement);
3643 i += replacement.
size();
3644 len += replacement.
size() - 1;
3645 }
else if (encodeEOLs && ati ==
QChar(0xD)) {
3646 retval.replace(
i, 1,
"
"_L1);
3687#define IMPL static_cast<QDomAttrPrivate *>(impl)
3777 return IMPL->specified();
3816 IMPL->m_specified =
true;
3896 n->setNodeValue(newValue);
3914 n->setNodeValue(newValue);
3929 if (
p &&
p->ref.loadRelaxed() == 0)
3958 if (!newAttr->prefix.isNull())
3988 if (
p->isText() ||
p->isCDATASection())
3990 else if (
p->isElement())
4017 nsDecl = u
" xmlns"_s;
4020 nsDecl = u
" xmlns:"_s +
prefix;
4024 s <<
'<' << qName << nsDecl;
4037 struct SavedAttribute {
4044 QVarLengthArray<SavedAttribute, 8> attributesToSave;
4047 QDuplicateTracker<QString> outputtedPrefixes;
4050 bool mayNeedXmlNS =
false;
4052 SavedAttribute attr;
4053 attr.name =
value->name;
4055 if (!
value->namespaceURI.isNull()) {
4056 attr.prefix =
value->prefix;
4057 mayNeedXmlNS =
true;
4060 attributesToSave.push_back(std::move(attr));
4080 && !outputtedPrefixes.hasSeen(
value->prefix)))
4082 SavedAttribute nsAttr;
4084 nsAttr.name =
value->prefix;
4086 attributesToSave.push_back(std::move(nsAttr));
4091 const auto savedAttributeComparator = [](
const SavedAttribute &lhs,
const SavedAttribute &rhs)
4094 return (cmp < 0) || ((cmp == 0) && (lhs.name < rhs.name));
4097 std::sort(attributesToSave.begin(), attributesToSave.end(), savedAttributeComparator);
4100 for (
const auto &attr : attributesToSave) {
4102 if (!attr.prefix.isEmpty())
4103 s << attr.prefix <<
':';
4104 s << attr.name <<
"=\"" << attr.encodedValue <<
'\"';
4110 if (
first->isText())
4122 s <<
"</" << qName <<
'>';
4139#define IMPL static_cast<QDomElementPrivate *>(impl)
4284 return IMPL->attribute(
name, defValue);
4489 IMPL->setAttributeNS(nsURI, qName,
value);
4513 IMPL->setAttributeNS(nsURI, qName,
x);
4525 IMPL->setAttributeNS(nsURI, qName,
x);
4537 IMPL->setAttributeNS(nsURI, qName,
x);
4553 IMPL->removeAttribute(
n->nodeName());
4632 return IMPL->text();
4665 qWarning(
"QDomText::splitText The node has no parent. So I cannot split");
4684 s <<
encodeText(
value, !(that->parent() && that->parent()->isElement()),
false,
true);
4693#define IMPL static_cast<QDomTextPrivate *>(impl)
4783 name = u
"#comment"_s;
4807 if (
value.endsWith(u
'-'))
4893 name = u
"#cdata-section"_s;
4913 s <<
"<![CDATA[" <<
value <<
"]]>";
5021 s <<
"<!NOTATION " <<
name <<
' ';
5038#define IMPL static_cast<QDomNotationPrivate *>(impl)
5180 else if (
d[
i] ==
'"') {
5185 }
else if (
d[
i] ==
'&' &&
i + 1 <
len &&
d[
i+1] ==
'#') {
5204 _name = u
"% "_s + _name.
mid(1);
5209 s <<
"<!ENTITY " << _name <<
' ';
5228#define IMPL static_cast<QDomEntityPrivate *>(impl)
5334 return IMPL->m_notationName;
5366 s <<
'&' <<
name <<
';';
5616 name = u
"#document"_s;
5628 name = u
"#document"_s;
5636 if (dt !=
nullptr) {
5643 name = u
"#document"_s;
5648 impl(
n->impl->clone()),
5667 QDomDocument::ParseOptions options)
5675 const auto error = u
"Failed to set content, XML reader is not initialized"_s;
5682 if (!domParser.parse())
5683 return domParser.result();
5698 while (
p && !
p->isElement())
5826 switch (importedNode->nodeType()) {
5878#if QT_CONFIG(regularexpression)
5881 if (
n &&
n->isProcessingInstruction() &&
n->nodeName() ==
"xml"_L1) {
5888 enc =
match.captured(5);
5889 if (!enc.isEmpty()) {
5892 qWarning() <<
"QDomDocument::save(): Unsupported encoding" << enc <<
"specified.";
5894 s.setEncoding(encoding.value());
5901 if (!doc && !(
n->isProcessingInstruction() &&
n->nodeName() ==
"xml"_L1)) {
5903 type->save(
s, 0, indent);
5906 n->save(
s, 0, indent);
5915 s <<
"<?xml version=\"1.0\" encoding=\""
5924 if (
n->isProcessingInstruction() &&
n->nodeName() ==
"xml"_L1) {
5925 startNode =
n->
next;
5934 startNode->
save(
s, 0, indent);
5935 startNode = startNode->next;
5946#define IMPL static_cast<QDomDocumentPrivate *>(impl)
6087#if QT_DEPRECATED_SINCE(6, 8)
6100 QString *errorMsg,
int *errorLine,
int *errorColumn)
6102 QXmlStreamReader reader(
text);
6103 reader.setNamespaceProcessing(namespaceProcessing);
6104 return setContent(&reader, namespaceProcessing, errorMsg, errorLine, errorColumn);
6160 QString *errorMsg,
int *errorLine,
int *errorColumn)
6163 reader.setNamespaceProcessing(namespaceProcessing);
6164 return setContent(&reader, namespaceProcessing, errorMsg, errorLine, errorColumn);
6167static inline QDomDocument::ParseOptions toParseOptions(
bool namespaceProcessing)
6174 QString *errorMsg,
int *errorLine,
int *errorColumn)
6180 *errorLine =
static_cast<int>(parseResult.
errorLine);
6182 *errorColumn =
static_cast<int>(parseResult.
errorColumn);
6199 QString *errorMsg,
int *errorLine,
int *errorColumn)
6202 unpackParseResult(
result, errorMsg, errorLine, errorColumn);
6219 return setContent(
text,
false, errorMsg, errorLine, errorColumn);
6248 return setContent(dev,
false, errorMsg, errorLine, errorColumn);
6272 QString *errorMsg,
int *errorLine,
int *errorColumn)
6274 ParseResult
result =
setContent(reader, toParseOptions(namespaceProcessing));
6275 unpackParseResult(
result, errorMsg, errorLine, errorColumn);
6401 QXmlStreamReader reader(
data);
6408#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
6410 qWarning(
"QDomDocument called with unopened QIODevice. "
6411 "This will not be supported in future Qt versions.");
6413 const auto error = u
"QDomDocument::setContent: Failed to open device."_s;
6420 QXmlStreamReader reader(
device);
6429 return IMPL->setContent(reader, options);
6711 if (importedNode.isNull())
6715 return QDomNode(
IMPL->importNode(importedNode.impl, deep));
6753 return QDomAttr(
IMPL->createAttributeNS(nsURI, qName));
6781 qWarning(
"elementById() is not implemented and will always return a null node.");
IOBluetoothDevice * device
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
QByteArray & replace(qsizetype index, qsizetype len, const char *s, qsizetype alen)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDomAttrPrivate(QDomDocumentPrivate *, QDomNodePrivate *, const QString &name)
QDomNodePrivate * cloneNode(bool deep=true) override
virtual void save(QTextStream &s, int, int) const override
void setNodeValue(const QString &v) override
QDomAttr()
Constructs an empty attribute.
QDomAttr & operator=(const QDomAttr &other)
Assigns other to this DOM attribute.
QString name() const
Returns the attribute's name.
QString value() const
Returns the value of the attribute or an empty string if the attribute has not been specified.
bool specified() const
Returns true if the attribute has been set by the user with setValue().
QDomElement ownerElement() const
Returns the element node this attribute is attached to or a \l{QDomNode::isNull()}{null node} if this...
void setValue(const QString &value)
Sets the attribute's value to value.
QDomCDATASectionPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &val)
virtual void save(QTextStream &s, int, int) const override
QDomNodePrivate * cloneNode(bool deep=true) override
QDomCDATASection()
Constructs an empty CDATA section.
QDomCDATASection & operator=(const QDomCDATASection &other)
Assigns other to this CDATA section.
QDomNodePrivate * cloneNode(bool deep=true) override
QDomCharacterDataPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &data)
void appendData(const QString &arg)
void insertData(unsigned long offset, const QString &arg)
QString substringData(unsigned long offset, unsigned long count) const
void deleteData(unsigned long offset, unsigned long count)
void replaceData(unsigned long offset, unsigned long count, const QString &arg)
int length() const
Returns the length of the stored string.
QString data() const
Returns the string stored in this object.
QDomCharacterData()
Constructs an empty character data object.
void replaceData(unsigned long offset, unsigned long count, const QString &arg)
Replaces the substring of length count starting at position offset with the string arg.
void deleteData(unsigned long offset, unsigned long count)
Deletes a substring of length count from position offset.
QString substringData(unsigned long offset, unsigned long count)
Returns the substring of length count from position offset.
void setData(const QString &data)
Sets this object's string to data.
QDomCharacterData & operator=(const QDomCharacterData &other)
Assigns other to this character data.
void appendData(const QString &arg)
Appends the string arg to the stored string.
void insertData(unsigned long offset, const QString &arg)
Inserts the string arg into the stored string at position offset.
QDomNode::NodeType nodeType() const
Returns the type of node this object refers to (i.e.
QDomDocumentFragmentPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent=nullptr)
virtual QDomNodePrivate * cloneNode(bool deep=true) override
QDomDocumentFragment & operator=(const QDomDocumentFragment &other)
Assigns other to this DOM document fragment.
QDomDocumentFragment()
Constructs an empty document fragment.
QDomDocument::ParseResult setContent(QXmlStreamReader *reader, QDomDocument::ParseOptions options)
QDomNodePrivate * cloneNode(bool deep=true) override
QDomElementPrivate * createElement(const QString &tagName)
QDomAttrPrivate * createAttribute(const QString &name)
QDomCDATASectionPrivate * createCDATASection(const QString &data)
QDomProcessingInstructionPrivate * createProcessingInstruction(const QString &target, const QString &data)
QDomTextPrivate * createTextNode(const QString &data)
QDomDocumentFragmentPrivate * createDocumentFragment()
void saveDocument(QTextStream &stream, const int indent, QDomNode::EncodingPolicy encUsed) const
QDomAttrPrivate * createAttributeNS(const QString &nsURI, const QString &qName)
QDomNodePrivate * importNode(QDomNodePrivate *importedNode, bool deep)
QDomElementPrivate * documentElement()
QExplicitlySharedDataPointer< QDomImplementationPrivate > impl
QDomEntityReferencePrivate * createEntityReference(const QString &name)
QDomElementPrivate * createElementNS(const QString &nsURI, const QString &qName)
QDomCommentPrivate * createComment(const QString &data)
QDomNodePrivate * insertAfter(QDomNodePrivate *newChild, QDomNodePrivate *refChild) override
QDomDocumentTypePrivate(QDomDocumentPrivate *, QDomNodePrivate *parent=nullptr)
void save(QTextStream &s, int, int) const override
~QDomDocumentTypePrivate()
QDomNodePrivate * removeChild(QDomNodePrivate *oldChild) override
QDomNodePrivate * cloneNode(bool deep=true) override
QDomNodePrivate * appendChild(QDomNodePrivate *newChild) override
QDomNodePrivate * replaceChild(QDomNodePrivate *newChild, QDomNodePrivate *oldChild) override
QDomNodePrivate * insertBefore(QDomNodePrivate *newChild, QDomNodePrivate *refChild) override
QDomNamedNodeMapPrivate * entities
QDomNamedNodeMapPrivate * notations
QString publicId() const
Returns the public identifier of the external DTD subset or an empty string if there is no public ide...
QDomDocumentType & operator=(const QDomDocumentType &other)
Assigns other to this document type.
QDomDocumentType()
Creates an empty QDomDocumentType object.
QDomNamedNodeMap notations() const
Returns a map of all notations described in the DTD.
QString name() const
Returns the name of the document type as specified in the <!DOCTYPE name> tag.
QString internalSubset() const
Returns the internal subset of the document type or an empty string if there is no internal subset.
QString systemId() const
Returns the system identifier of the external DTD subset or an empty string if there is no system ide...
QDomNamedNodeMap entities() const
Returns a map of all entities described in the DTD.
QDomText createTextNode(const QString &data)
Creates a text node for the string value that can be inserted into the document tree,...
QDomDocument & operator=(const QDomDocument &other)
Assigns other to this DOM document.
QDomProcessingInstruction createProcessingInstruction(const QString &target, const QString &data)
Creates a new processing instruction that can be inserted into the document, e.g.
Q_WEAK_OVERLOAD ParseResult setContent(const QByteArray &data, ParseOptions options=ParseOption::Default)
QDomAttr createAttribute(const QString &name)
Creates a new attribute called name that can be inserted into an element, e.g.
QDomNode importNode(const QDomNode &importedNode, bool deep)
Imports the node importedNode from another document to this document.
QDomElement documentElement() const
Returns the root element of the document.
QDomCDATASection createCDATASection(const QString &data)
Creates a new CDATA section for the string value that can be inserted into the document,...
QDomElement createElement(const QString &tagName)
Creates a new element called tagName that can be inserted into the DOM tree, e.g.
QDomDocument()
Constructs an empty document.
~QDomDocument()
Destroys the object and frees its resources.
QByteArray toByteArray(int indent=1) const
Converts the parsed document back to its textual representation and returns a QByteArray containing t...
QString toString(int indent=1) const
Converts the parsed document back to its textual representation.
QDomImplementation implementation() const
Returns a QDomImplementation object.
QDomNodeList elementsByTagName(const QString &tagname) const
Returns a QDomNodeList, that contains all the elements in the document with the name tagname.
QDomNodeList elementsByTagNameNS(const QString &nsURI, const QString &localName)
Returns a QDomNodeList that contains all the elements in the document with the local name localName a...
QDomDocumentFragment createDocumentFragment()
Creates a new document fragment, that can be used to hold parts of the document, e....
QDomAttr createAttributeNS(const QString &nsURI, const QString &qName)
Creates a new attribute with namespace support that can be inserted into an element.
QDomEntityReference createEntityReference(const QString &name)
Creates a new entity reference called name that can be inserted into the document,...
QDomElement elementById(const QString &elementId)
Returns the element whose ID is equal to elementId.
QDomComment createComment(const QString &data)
Creates a new comment for the string value that can be inserted into the document,...
QDomDocumentType doctype() const
Returns the document type of this document.
QDomElement createElementNS(const QString &nsURI, const QString &qName)
Creates a new element with namespace support that can be inserted into the DOM tree.
bool hasAttribute(const QString &name)
QDomElementPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &name)
QString attributeNS(const QString &nsURI, const QString &localName, const QString &defValue) const
QDomNamedNodeMapPrivate * m_attr
QString attribute(const QString &name, const QString &defValue) const
virtual void save(QTextStream &s, int, int) const override
void setAttribute(const QString &name, const QString &value)
void removeAttribute(const QString &name)
QDomAttrPrivate * removeAttributeNode(QDomAttrPrivate *oldAttr)
QDomNodePrivate * cloneNode(bool deep=true) override
bool hasAttributeNS(const QString &nsURI, const QString &localName)
QDomAttrPrivate * attributeNode(const QString &name)
QDomAttrPrivate * setAttributeNodeNS(QDomAttrPrivate *newAttr)
QDomAttrPrivate * setAttributeNode(QDomAttrPrivate *newAttr)
void setAttributeNS(const QString &nsURI, const QString &qName, const QString &newValue)
QDomAttrPrivate * attributeNodeNS(const QString &nsURI, const QString &localName)
void removeAttributeNS(const QString &nsURI, const QString &localName)
Removes the attribute with the local name localName and the namespace URI nsURI from this element.
QDomAttr setAttributeNodeNS(const QDomAttr &newAttr)
Adds the attribute newAttr to this element.
bool hasAttributeNS(const QString &nsURI, const QString &localName) const
Returns true if this element has an attribute with the local name localName and the namespace URI nsU...
void removeAttribute(const QString &name)
Removes the attribute called name name from this element.
bool hasAttribute(const QString &name) const
Returns true if this element has an attribute called name; otherwise returns false.
QDomAttr attributeNode(const QString &name)
Returns the QDomAttr object that corresponds to the attribute called name.
QDomAttr attributeNodeNS(const QString &nsURI, const QString &localName)
Returns the QDomAttr object that corresponds to the attribute with the local name localName and the n...
void setAttribute(const QString &name, const QString &value)
Adds an attribute called name with value value.
QString tagName() const
Returns the tag name of this element.
QDomAttr setAttributeNode(const QDomAttr &newAttr)
Adds the attribute newAttr to this element.
QDomElement & operator=(const QDomElement &other)
Assigns other to this DOM element.
void setAttributeNS(const QString &nsURI, const QString &qName, const QString &value)
Adds an attribute with the qualified name qName and the namespace URI nsURI with the value value.
QDomNamedNodeMap attributes() const
Returns a QDomNamedNodeMap containing all this element's attributes.
QString text() const
Returns the element's text or an empty string.
QDomNodeList elementsByTagNameNS(const QString &nsURI, const QString &localName) const
Returns a QDomNodeList containing all descendants of this element with local name localName and names...
QDomAttr removeAttributeNode(const QDomAttr &oldAttr)
Removes the attribute oldAttr from the element and returns it.
void setTagName(const QString &name)
Sets this element's tag name to name.
QDomElement()
Constructs an empty element.
QString attributeNS(const QString &nsURI, const QString &localName, const QString &defValue=QString()) const
Returns the attribute with the local name localName and the namespace URI nsURI.
QDomNodeList elementsByTagName(const QString &tagname) const
Returns a QDomNodeList containing all descendants of this element named tagname encountered during a ...
QString attribute(const QString &name, const QString &defValue=QString()) const
Returns the attribute called name.
virtual void save(QTextStream &s, int, int) const override
QDomEntityPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &name, const QString &pub, const QString &sys, const QString ¬ation)
QDomNodePrivate * cloneNode(bool deep=true) override
QDomNodePrivate * cloneNode(bool deep=true) override
QDomEntityReferencePrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &name)
virtual void save(QTextStream &s, int, int) const override
QDomEntityReference()
Constructs an empty entity reference.
QDomEntityReference & operator=(const QDomEntityReference &other)
Assigns other to this entity reference.
QString publicId() const
Returns the public identifier associated with this entity.
QDomEntity & operator=(const QDomEntity &other)
Assigns other to this DOM entity.
QString systemId() const
Returns the system identifier associated with this entity.
QString notationName() const
For unparsed entities this function returns the name of the notation for the entity.
QDomEntity()
Constructs an empty entity.
QDomImplementationPrivate()
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
QDomImplementationPrivate * clone()
bool operator!=(const QDomImplementation &other) const
Returns true if other and this DOM implementation object were created from different QDomDocuments; o...
QDomDocument createDocument(const QString &nsURI, const QString &qName, const QDomDocumentType &doctype)
Creates a DOM document with the document type doctype.
QDomImplementation()
Constructs a QDomImplementation object.
QDomDocumentType createDocumentType(const QString &qName, const QString &publicId, const QString &systemId)
Creates a document type node for the name qName.
friend class QDomDocument
QDomImplementation & operator=(const QDomImplementation &other)
Assigns other to this DOM implementation.
InvalidDataPolicy
This enum specifies what should be done when a factory function in QDomDocument is called with invali...
bool isNull()
Returns false if the object was created by QDomDocument::implementation(); otherwise returns true.
bool hasFeature(const QString &feature, const QString &version) const
The function returns true if QDom implements the requested version of a feature; otherwise returns fa...
static void setInvalidDataPolicy(InvalidDataPolicy policy)
bool operator==(const QDomImplementation &other) const
Returns true if other and this DOM implementation object were created from the same QDomDocument; oth...
static InvalidDataPolicy invalidDataPolicy()
~QDomImplementation()
Destroys the object and frees its resources.
bool contains(const QString &name) const
void setAppendToParent(bool b)
QDomNamedNodeMapPrivate * clone(QDomNodePrivate *parent)
QDomNodePrivate * namedItemNS(const QString &nsURI, const QString &localName) const
QDomNodePrivate * item(int index) const
QDomNamedNodeMapPrivate(QDomNodePrivate *)
QDomNodePrivate * setNamedItem(QDomNodePrivate *arg)
QMultiHash< QString, QDomNodePrivate * > map
bool containsNS(const QString &nsURI, const QString &localName) const
QDomNodePrivate * namedItem(const QString &name) const
QDomNodePrivate * removeNamedItem(const QString &name)
~QDomNamedNodeMapPrivate()
QDomNodePrivate * setNamedItemNS(QDomNodePrivate *arg)
QDomNamedNodeMap & operator=(const QDomNamedNodeMap &other)
Assigns other to this named node map.
~QDomNamedNodeMap()
Destroys the object and frees its resources.
QDomNode namedItemNS(const QString &nsURI, const QString &localName) const
Returns the node associated with the local name localName and the namespace URI nsURI.
QDomNode removeNamedItem(const QString &name)
Removes the node called name from the map.
QDomNamedNodeMap()
Constructs an empty named node map.
bool operator==(const QDomNamedNodeMap &other) const
Returns true if other and this named node map are equal; otherwise returns false.
QDomNode removeNamedItemNS(const QString &nsURI, const QString &localName)
Removes the node with the local name localName and the namespace URI nsURI from the map.
QDomNode namedItem(const QString &name) const
Returns the node called name.
QDomNode setNamedItem(const QDomNode &newNode)
Inserts the node newNode into the named node map.
int length() const
Returns the number of nodes in the map.
bool contains(const QString &name) const
Returns true if the map contains a node called name; otherwise returns false.
QDomNode setNamedItemNS(const QDomNode &newNode)
Inserts the node newNode in the map.
QDomNode item(int index) const
Retrieves the node at position index.
bool operator!=(const QDomNamedNodeMap &other) const
Returns true if other and this named node map are not equal; otherwise returns false.
QList< QDomNodePrivate * > list
bool operator==(const QDomNodeListPrivate &) const
QDomNodePrivate * node_impl
QDomNodePrivate * item(int index)
QDomNodeListPrivate(QDomNodePrivate *)
bool maybeCreateList() const
bool operator!=(const QDomNodeListPrivate &) const
bool operator!=(const QDomNodeList &other) const
Returns true the node list other and this node list are not equal; otherwise returns false.
QDomNode item(int index) const
Returns the node at position index.
QDomNodeList & operator=(const QDomNodeList &other)
Assigns other to this node list.
int length() const
Returns the number of nodes in the list.
~QDomNodeList()
Destroys the object and frees its resources.
QDomNodeList()
Creates an empty node list.
bool operator==(const QDomNodeList &other) const
Returns true if the node list other and this node list are equal; otherwise returns false.
QDomDocumentPrivate * ownerDocument()
void setOwnerDocument(QDomDocumentPrivate *doc)
bool isDocumentFragment() const
virtual void setNodeValue(const QString &v)
QString nodeValue() const
virtual QDomNodePrivate * insertAfter(QDomNodePrivate *newChild, QDomNodePrivate *refChild)
virtual ~QDomNodePrivate()
QDomNodePrivate(QDomDocumentPrivate *, QDomNodePrivate *parent=nullptr)
QDomNodePrivate * ownerNode
bool isCDATASection() const
bool isEntityReference() const
virtual QDomNodePrivate * appendChild(QDomNodePrivate *newChild)
virtual void save(QTextStream &, int, int) const
QDomNodePrivate * namedItem(const QString &name)
void setParent(QDomNodePrivate *p)
virtual QDomNodePrivate * removeChild(QDomNodePrivate *oldChild)
void setLocation(int lineNumber, int columnNumber)
bool createdWithDom1Interface
QDomNodePrivate * parent() const
bool isDocumentType() const
virtual QDomNodePrivate * replaceChild(QDomNodePrivate *newChild, QDomNodePrivate *oldChild)
virtual QDomNodePrivate * cloneNode(bool deep=true)
bool isCharacterData() const
bool isProcessingInstruction() const
virtual QDomNodePrivate * insertBefore(QDomNodePrivate *newChild, QDomNodePrivate *refChild)
QString nodeName() const
Returns the name of the node.
void setNodeValue(const QString &value)
Sets the node's value to value.
bool isCharacterData() const
Returns true if the node is a character data node; otherwise returns false.
void save(QTextStream &, int, EncodingPolicy=QDomNode::EncodingFromDocument) const
Writes the XML representation of the node and all its children to the stream stream.
QDomDocument toDocument() const
Converts a QDomNode into a QDomDocument.
QDomEntityReference toEntityReference() const
Converts a QDomNode into a QDomEntityReference.
QDomNode()
Constructs a \l{isNull()}{null} node.
friend class QDomDocumentType
QDomNode replaceChild(const QDomNode &newChild, const QDomNode &oldChild)
Replaces oldChild with newChild.
QDomNode parentNode() const
Returns the parent node.
QDomNodeList childNodes() const
Returns a list of all direct child nodes.
QDomDocumentType toDocumentType() const
Converts a QDomNode into a QDomDocumentType.
bool operator==(const QDomNode &other) const
Returns true if other and this DOM node are equal; otherwise returns false.
friend class QDomNodeList
friend class QDomDocument
bool operator!=(const QDomNode &other) const
Returns true if other and this DOM node are not equal; otherwise returns false.
QString prefix() const
Returns the namespace prefix of the node or an empty string if the node has no namespace prefix.
QDomElement lastChildElement(const QString &tagName=QString(), const QString &namespaceURI=QString()) const
Returns the last child element with tag name tagName and namespace URI namespaceURI.
bool hasChildNodes() const
Returns true if the node has one or more children; otherwise returns false.
QDomEntity toEntity() const
Converts a QDomNode into a QDomEntity.
QDomNode insertAfter(const QDomNode &newChild, const QDomNode &refChild)
Inserts the node newChild after the child node refChild.
QDomElement nextSiblingElement(const QString &taName=QString(), const QString &namespaceURI=QString()) const
Returns the next sibling element with tag name tagName and namespace URI namespaceURI.
QDomDocumentFragment toDocumentFragment() const
Converts a QDomNode into a QDomDocumentFragment.
QDomAttr toAttr() const
Converts a QDomNode into a QDomAttr.
friend class QDomNamedNodeMap
QDomNode lastChild() const
Returns the last child of the node.
bool isAttr() const
Returns true if the node is an attribute; otherwise returns false.
bool isProcessingInstruction() const
Returns true if the node is a processing instruction; otherwise returns false.
QDomCDATASection toCDATASection() const
Converts a QDomNode into a QDomCDATASection.
QDomCharacterData toCharacterData() const
Converts a QDomNode into a QDomCharacterData.
void clear()
Converts the node into a null node; if it was not a null node before, its type and contents are delet...
QDomNode firstChild() const
Returns the first child of the node.
QDomNotation toNotation() const
Converts a QDomNode into a QDomNotation.
QDomElement toElement() const
Converts a QDomNode into a QDomElement.
bool isEntity() const
Returns true if the node is an entity; otherwise returns false.
QDomNode & operator=(const QDomNode &other)
Assigns a copy of other to this DOM node.
QDomNode nextSibling() const
Returns the next sibling in the document tree.
QString namespaceURI() const
Returns the namespace URI of this node or an empty string if the node has no namespace URI.
QDomDocument ownerDocument() const
Returns the document to which this node belongs.
bool isEntityReference() const
Returns true if the node is an entity reference; otherwise returns false.
QDomNode namedItem(const QString &name) const
Returns the first direct child node for which nodeName() equals name.
QDomNode cloneNode(bool deep=true) const
Creates a deep (not shallow) copy of the QDomNode.
bool isText() const
Returns true if the node is a text node; otherwise returns false.
bool isNotation() const
Returns true if the node is a notation; otherwise returns false.
void setPrefix(const QString &pre)
If the node has a namespace prefix, this function changes the namespace prefix of the node to pre.
bool isNull() const
Returns true if this node is null (i.e.
QDomProcessingInstruction toProcessingInstruction() const
Converts a QDomNode into a QDomProcessingInstruction.
void normalize()
Calling normalize() on an element converts all its children into a standard form.
QString localName() const
If the node uses namespaces, this function returns the local name of the node; otherwise it returns a...
QTextStream & operator<<(QTextStream &str, const QDomNode &node)
Writes the XML representation of the node node and all its children to the stream str.
QDomText toText() const
Converts a QDomNode into a QDomText.
bool isComment() const
Returns true if the node is a comment; otherwise returns false.
bool isDocumentFragment() const
Returns true if the node is a document fragment; otherwise returns false.
QDomNamedNodeMap attributes() const
Returns a named node map of all attributes.
bool hasAttributes() const
Returns true if the node has attributes; otherwise returns false.
QDomElement previousSiblingElement(const QString &tagName=QString(), const QString &namespaceURI=QString()) const
Returns the previous sibling element with tag name tagName and namespace URI namespaceURI.
bool isElement() const
Returns true if the node is an element; otherwise returns false.
bool isCDATASection() const
Returns true if the node is a CDATA section; otherwise returns false.
NodeType
This enum defines the type of the node: \value ElementNode \value AttributeNode \value TextNode \valu...
@ ProcessingInstructionNode
bool isSupported(const QString &feature, const QString &version) const
Returns true if the DOM implementation implements the feature feature and this feature is supported b...
QDomNode insertBefore(const QDomNode &newChild, const QDomNode &refChild)
Inserts the node newChild before the child node refChild.
QString nodeValue() const
Returns the value of the node.
QDomNode removeChild(const QDomNode &oldChild)
Removes oldChild from the list of children.
bool isDocument() const
Returns true if the node is a document; otherwise returns false.
QDomElement firstChildElement(const QString &tagName=QString(), const QString &namespaceURI=QString()) const
Returns the first child element with tag name tagName and namespace URI namespaceURI.
QDomComment toComment() const
Converts a QDomNode into a QDomComment.
QDomNode previousSibling() const
Returns the previous sibling in the document tree.
QDomNode appendChild(const QDomNode &newChild)
Appends newChild as the node's last child.
bool isDocumentType() const
Returns true if the node is a document type; otherwise returns false.
NodeType nodeType() const
Returns the type of the node.
~QDomNode()
Destroys the object and frees its resources.
virtual void save(QTextStream &s, int, int) const override
QDomNotationPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &name, const QString &pub, const QString &sys)
QDomNodePrivate * cloneNode(bool deep=true) override
QDomNotation()
Constructor.
QDomNotation & operator=(const QDomNotation &other)
Assigns other to this DOM notation.
QString publicId() const
Returns the public identifier of this notation.
QString systemId() const
Returns the system identifier of this notation.
QDomNodePrivate * cloneNode(bool deep=true) override
virtual void save(QTextStream &s, int, int) const override
QDomProcessingInstructionPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &target, const QString &data)
void setData(const QString &data)
Sets the data contained in the processing instruction to data.
QDomProcessingInstruction()
Constructs an empty processing instruction.
QString target() const
Returns the target of this processing instruction.
QString data() const
Returns the content of this processing instruction.
QDomProcessingInstruction & operator=(const QDomProcessingInstruction &other)
Assigns other to this processing instruction.
QDomNodePrivate * cloneNode(bool deep=true) override
QDomTextPrivate(QDomDocumentPrivate *, QDomNodePrivate *parent, const QString &val)
QDomTextPrivate * splitText(int offset)
virtual void save(QTextStream &s, int, int) const override
QDomText()
Constructs an empty QDomText object.
QDomText splitText(int offset)
Splits this DOM text object into two QDomText objects.
QDomText & operator=(const QDomText &other)
Assigns other to this DOM text.
void reset(T *ptr=nullptr) noexcept
\inmodule QtCore \reentrant
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
iterator find(const Key &key)
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
T value(const Key &key) const noexcept
bool contains(const Key &key) const noexcept
qsizetype remove(const Key &key)
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool isEmpty() const noexcept
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
qsizetype size() const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
\inmodule QtCore \reentrant
QRegularExpressionMatch match(const QString &subject, qsizetype offset=0, MatchType matchType=NormalMatch, MatchOptions matchOptions=NoMatchOption) const
Attempts to match the regular expression against the given subject string, starting at the position o...
static Q_CORE_EXPORT const char * nameForEncoding(Encoding e)
Returns the canonical name for encoding e.
static Q_CORE_EXPORT std::optional< Encoding > encodingForName(const char *name) noexcept
Convert name to the corresponding \l Encoding member, if there is one.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QString & replace(qsizetype i, qsizetype len, QChar after)
void reserve(qsizetype size)
Ensures the string has space for at least size characters.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
void clear()
Clears the contents of the string and makes it null.
bool isNull() const
Returns true if this string is null; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString & insert(qsizetype i, QChar c)
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & setNum(short, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
QByteArray toUtf8() const &
static bool isChar(const char32_t c)
static bool isPublicID(QStringView candidate)
static bool isLetter(const QChar c)
static bool isNameChar(const QChar c)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
QImageReader reader("image.png")
[1]
#define QT_WARNING_DISABLE_DEPRECATED
DBusConnection const char DBusError * error
static QString fixedPIData(const QString &data, bool *ok)
static QString fixedPubidLiteral(const QString &data, bool *ok)
static QString fixedSystemLiteral(const QString &data, bool *ok)
static QString fixedXmlName(const QString &_name, bool *ok, bool namespaces=false)
static QString fixedCharData(const QString &data, bool *ok)
static QString quotedValue(const QString &data)
static void qt_split_namespace(QString &prefix, QString &name, const QString &qName, bool hasURI)
static QString encodeText(const QString &str, const bool encodeQuotes=true, const bool performAVN=false, const bool encodeEOLs=false)
static QString fixedCDataSection(const QString &data, bool *ok)
static QString fixedComment(const QString &data, bool *ok)
static QByteArray encodeEntity(const QByteArray &str)
static void qNormalizeNode(QDomNodePrivate *n)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
#define qPrintable(string)
#define QStringLiteral(str)
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
static QString quote(const QString &str)
The struct is used to store the result of QDomDocument::setContent().