| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/xml/dom/qdom.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtXml module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include <qplatformdefs.h> | - | ||||||||||||||||||||||||
| 41 | #include <qdom.h> | - | ||||||||||||||||||||||||
| 42 | #include "private/qxmlutils_p.h" | - | ||||||||||||||||||||||||
| 43 | - | |||||||||||||||||||||||||
| 44 | #ifndef QT_NO_DOM | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | #include <qatomic.h> | - | ||||||||||||||||||||||||
| 47 | #include <qbuffer.h> | - | ||||||||||||||||||||||||
| 48 | #include <qhash.h> | - | ||||||||||||||||||||||||
| 49 | #include <qiodevice.h> | - | ||||||||||||||||||||||||
| 50 | #include <qlist.h> | - | ||||||||||||||||||||||||
| 51 | #include <qregexp.h> | - | ||||||||||||||||||||||||
| 52 | #include <qtextcodec.h> | - | ||||||||||||||||||||||||
| 53 | #include <qtextstream.h> | - | ||||||||||||||||||||||||
| 54 | #include <qxml.h> | - | ||||||||||||||||||||||||
| 55 | #include "private/qxml_p.h" | - | ||||||||||||||||||||||||
| 56 | #include <qvariant.h> | - | ||||||||||||||||||||||||
| 57 | #include <qmap.h> | - | ||||||||||||||||||||||||
| 58 | #include <qshareddata.h> | - | ||||||||||||||||||||||||
| 59 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 60 | #include <stdio.h> | - | ||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | /* | - | ||||||||||||||||||||||||
| 65 | ### old todo comments -- I don't know if they still apply... | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | If the document dies, remove all pointers to it from children | - | ||||||||||||||||||||||||
| 68 | which can not be deleted at this time. | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | If a node dies and has direct children which can not be deleted, | - | ||||||||||||||||||||||||
| 71 | then remove the pointer to the parent. | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | createElement and friends create double reference counts. | - | ||||||||||||||||||||||||
| 74 | */ | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | /* ##### new TODOs: | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | Remove emtpy emthods in the *Private classes | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | Make a lot of the (mostly empty) methods in the public classes inline. | - | ||||||||||||||||||||||||
| 81 | Specially constructors assignment operators and comparison operators are candidates. | - | ||||||||||||||||||||||||
| 82 | */ | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | /* | - | ||||||||||||||||||||||||
| 85 | Reference counting: | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | Some simple rules: | - | ||||||||||||||||||||||||
| 88 | 1) If an intern object returns a pointer to another intern object | - | ||||||||||||||||||||||||
| 89 | then the reference count of the returned object is not increased. | - | ||||||||||||||||||||||||
| 90 | 2) If an extern object is created and gets a pointer to some intern | - | ||||||||||||||||||||||||
| 91 | object, then the extern object increases the intern objects reference count. | - | ||||||||||||||||||||||||
| 92 | 3) If an extern object is deleted, then it decreases the reference count | - | ||||||||||||||||||||||||
| 93 | on its associated intern object and deletes it if nobody else hold references | - | ||||||||||||||||||||||||
| 94 | on the intern object. | - | ||||||||||||||||||||||||
| 95 | */ | - | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | /* | - | ||||||||||||||||||||||||
| 99 | Helper to split a qualified name in the prefix and local name. | - | ||||||||||||||||||||||||
| 100 | */ | - | ||||||||||||||||||||||||
| 101 | static void qt_split_namespace(QString& prefix, QString& name, const QString& qName, bool hasURI) | - | ||||||||||||||||||||||||
| 102 | { | - | ||||||||||||||||||||||||
| 103 | int i = qName.indexOf(QLatin1Char(':')); | - | ||||||||||||||||||||||||
| 104 | if (i == -1) {
| 4 | ||||||||||||||||||||||||
| 105 | if (hasURI)
| 2 | ||||||||||||||||||||||||
| 106 | prefix = QLatin1String(""); executed 2 times by 1 test: prefix = QLatin1String("");Executed by:
| 2 | ||||||||||||||||||||||||
| 107 | else | - | ||||||||||||||||||||||||
| 108 | prefix.clear(); executed 2 times by 1 test: prefix.clear();Executed by:
| 2 | ||||||||||||||||||||||||
| 109 | name = qName; | - | ||||||||||||||||||||||||
| 110 | } else { executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 111 | prefix = qName.left(i); | - | ||||||||||||||||||||||||
| 112 | name = qName.mid(i + 1); | - | ||||||||||||||||||||||||
| 113 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 114 | } | - | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | /************************************************************** | - | ||||||||||||||||||||||||
| 117 | * | - | ||||||||||||||||||||||||
| 118 | * Private class declerations | - | ||||||||||||||||||||||||
| 119 | * | - | ||||||||||||||||||||||||
| 120 | **************************************************************/ | - | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | class QDomImplementationPrivate | - | ||||||||||||||||||||||||
| 123 | { | - | ||||||||||||||||||||||||
| 124 | public: | - | ||||||||||||||||||||||||
| 125 | inline QDomImplementationPrivate() {} | - | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | QDomImplementationPrivate* clone(); | - | ||||||||||||||||||||||||
| 128 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 129 | static QDomImplementation::InvalidDataPolicy invalidDataPolicy; | - | ||||||||||||||||||||||||
| 130 | }; | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | class QDomNodePrivate | - | ||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||
| 134 | public: | - | ||||||||||||||||||||||||
| 135 | QDomNodePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 136 | QDomNodePrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 137 | virtual ~QDomNodePrivate(); | - | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | QString nodeName() const { return name; } executed 1982 times by 4 tests: return name;Executed by:
| 1982 | ||||||||||||||||||||||||
| 140 | QString nodeValue() const { return value; } executed 33 times by 1 test: return value;Executed by:
| 33 | ||||||||||||||||||||||||
| 141 | virtual void setNodeValue(const QString& v) { value = v; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | QDomDocumentPrivate* ownerDocument(); | - | ||||||||||||||||||||||||
| 144 | void setOwnerDocument(QDomDocumentPrivate* doc); | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | virtual QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild); | - | ||||||||||||||||||||||||
| 147 | virtual QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild); | - | ||||||||||||||||||||||||
| 148 | virtual QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild); | - | ||||||||||||||||||||||||
| 149 | virtual QDomNodePrivate* removeChild(QDomNodePrivate* oldChild); | - | ||||||||||||||||||||||||
| 150 | virtual QDomNodePrivate* appendChild(QDomNodePrivate* newChild); | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | QDomNodePrivate* namedItem(const QString& name); | - | ||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||
| 154 | virtual QDomNodePrivate* cloneNode(bool deep = true); | - | ||||||||||||||||||||||||
| 155 | virtual void normalize(); | - | ||||||||||||||||||||||||
| 156 | virtual void clear(); | - | ||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||
| 158 | inline QDomNodePrivate* parent() const { return hasParent ? ownerNode : 0; } executed 15338 times by 5 tests: return hasParent ? ownerNode : 0;Executed by:
| 15338 | ||||||||||||||||||||||||
| 159 | inline void setParent(QDomNodePrivate *p) { ownerNode = p; hasParent = true; } executed 4239 times by 5 tests: end of blockExecuted by:
| 4239 | ||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | void setNoParent() { | - | ||||||||||||||||||||||||
| 162 | ownerNode = hasParent ? (QDomNodePrivate*)ownerDocument() : 0;
| 0-1 | ||||||||||||||||||||||||
| 163 | hasParent = false; | - | ||||||||||||||||||||||||
| 164 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | // Dynamic cast | - | ||||||||||||||||||||||||
| 167 | bool isAttr() const { return nodeType() == QDomNode::AttributeNode; } never executed: return nodeType() == QDomNode::AttributeNode; | 0 | ||||||||||||||||||||||||
| 168 | bool isCDATASection() const { return nodeType() == QDomNode::CDATASectionNode; } never executed: return nodeType() == QDomNode::CDATASectionNode; | 0 | ||||||||||||||||||||||||
| 169 | bool isDocumentFragment() const { return nodeType() == QDomNode::DocumentFragmentNode; } executed 2016 times by 5 tests: return nodeType() == QDomNode::DocumentFragmentNode;Executed by:
| 2016 | ||||||||||||||||||||||||
| 170 | bool isDocument() const { return nodeType() == QDomNode::DocumentNode; } executed 14368 times by 5 tests: return nodeType() == QDomNode::DocumentNode;Executed by:
| 14368 | ||||||||||||||||||||||||
| 171 | bool isDocumentType() const { return nodeType() == QDomNode::DocumentTypeNode; } never executed: return nodeType() == QDomNode::DocumentTypeNode; | 0 | ||||||||||||||||||||||||
| 172 | bool isElement() const { return nodeType() == QDomNode::ElementNode; } executed 365 times by 1 test: return nodeType() == QDomNode::ElementNode;Executed by:
| 365 | ||||||||||||||||||||||||
| 173 | bool isEntityReference() const { return nodeType() == QDomNode::EntityReferenceNode; } never executed: return nodeType() == QDomNode::EntityReferenceNode; | 0 | ||||||||||||||||||||||||
| 174 | bool isText() const { const QDomNode::NodeType nt = nodeType(); | - | ||||||||||||||||||||||||
| 175 | return (nt == QDomNode::TextNode) executed 320 times by 1 test: return (nt == QDomNode::TextNode) || (nt == QDomNode::CDATASectionNode);Executed by:
| 320 | ||||||||||||||||||||||||
| 176 | || (nt == QDomNode::CDATASectionNode); } executed 320 times by 1 test: return (nt == QDomNode::TextNode) || (nt == QDomNode::CDATASectionNode);Executed by:
| 320 | ||||||||||||||||||||||||
| 177 | bool isEntity() const { return nodeType() == QDomNode::EntityNode; } never executed: return nodeType() == QDomNode::EntityNode; | 0 | ||||||||||||||||||||||||
| 178 | bool isNotation() const { return nodeType() == QDomNode::NotationNode; } never executed: return nodeType() == QDomNode::NotationNode; | 0 | ||||||||||||||||||||||||
| 179 | bool isProcessingInstruction() const { return nodeType() == QDomNode::ProcessingInstructionNode; } executed 172 times by 2 tests: return nodeType() == QDomNode::ProcessingInstructionNode;Executed by:
| 172 | ||||||||||||||||||||||||
| 180 | bool isCharacterData() const { const QDomNode::NodeType nt = nodeType(); | - | ||||||||||||||||||||||||
| 181 | return (nt == QDomNode::CharacterDataNode) never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode); | 0 | ||||||||||||||||||||||||
| 182 | || (nt == QDomNode::TextNode) never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode); | 0 | ||||||||||||||||||||||||
| 183 | || (nt == QDomNode::CommentNode); } never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode); | 0 | ||||||||||||||||||||||||
| 184 | bool isComment() const { return nodeType() == QDomNode::CommentNode; } never executed: return nodeType() == QDomNode::CommentNode; | 0 | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | virtual QDomNode::NodeType nodeType() const { return QDomNode::BaseNode; } never executed: return QDomNode::BaseNode; | 0 | ||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||
| 188 | virtual void save(QTextStream&, int, int) const; | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | void setLocation(int lineNumber, int columnNumber); | - | ||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||
| 192 | // Variables | - | ||||||||||||||||||||||||
| 193 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 194 | QDomNodePrivate* prev; | - | ||||||||||||||||||||||||
| 195 | QDomNodePrivate* next; | - | ||||||||||||||||||||||||
| 196 | QDomNodePrivate* ownerNode; // either the node's parent or the node's owner document | - | ||||||||||||||||||||||||
| 197 | QDomNodePrivate* first; | - | ||||||||||||||||||||||||
| 198 | QDomNodePrivate* last; | - | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | QString name; // this is the local name if prefix != null | - | ||||||||||||||||||||||||
| 201 | QString value; | - | ||||||||||||||||||||||||
| 202 | QString prefix; // set this only for ElementNode and AttributeNode | - | ||||||||||||||||||||||||
| 203 | QString namespaceURI; // set this only for ElementNode and AttributeNode | - | ||||||||||||||||||||||||
| 204 | bool createdWithDom1Interface : 1; | - | ||||||||||||||||||||||||
| 205 | bool hasParent : 1; | - | ||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||
| 207 | int lineNumber; | - | ||||||||||||||||||||||||
| 208 | int columnNumber; | - | ||||||||||||||||||||||||
| 209 | }; | - | ||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | class QDomNodeListPrivate | - | ||||||||||||||||||||||||
| 212 | { | - | ||||||||||||||||||||||||
| 213 | public: | - | ||||||||||||||||||||||||
| 214 | QDomNodeListPrivate(QDomNodePrivate*); | - | ||||||||||||||||||||||||
| 215 | QDomNodeListPrivate(QDomNodePrivate*, const QString& ); | - | ||||||||||||||||||||||||
| 216 | QDomNodeListPrivate(QDomNodePrivate*, const QString&, const QString& ); | - | ||||||||||||||||||||||||
| 217 | ~QDomNodeListPrivate(); | - | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | bool operator== (const QDomNodeListPrivate&) const; | - | ||||||||||||||||||||||||
| 220 | bool operator!= (const QDomNodeListPrivate&) const; | - | ||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | void createList(); | - | ||||||||||||||||||||||||
| 223 | QDomNodePrivate* item(int index); | - | ||||||||||||||||||||||||
| 224 | int length() const; | - | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 227 | /* | - | ||||||||||||||||||||||||
| 228 | This list contains the children of this node. | - | ||||||||||||||||||||||||
| 229 | */ | - | ||||||||||||||||||||||||
| 230 | QDomNodePrivate* node_impl; | - | ||||||||||||||||||||||||
| 231 | QString tagname; | - | ||||||||||||||||||||||||
| 232 | QString nsURI; | - | ||||||||||||||||||||||||
| 233 | QList<QDomNodePrivate*> list; | - | ||||||||||||||||||||||||
| 234 | long timestamp; | - | ||||||||||||||||||||||||
| 235 | }; | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | class QDomNamedNodeMapPrivate | - | ||||||||||||||||||||||||
| 238 | { | - | ||||||||||||||||||||||||
| 239 | public: | - | ||||||||||||||||||||||||
| 240 | QDomNamedNodeMapPrivate(QDomNodePrivate*); | - | ||||||||||||||||||||||||
| 241 | ~QDomNamedNodeMapPrivate(); | - | ||||||||||||||||||||||||
| 242 | - | |||||||||||||||||||||||||
| 243 | QDomNodePrivate* namedItem(const QString& name) const; | - | ||||||||||||||||||||||||
| 244 | QDomNodePrivate* namedItemNS(const QString& nsURI, const QString& localName) const; | - | ||||||||||||||||||||||||
| 245 | QDomNodePrivate* setNamedItem(QDomNodePrivate* arg); | - | ||||||||||||||||||||||||
| 246 | QDomNodePrivate* setNamedItemNS(QDomNodePrivate* arg); | - | ||||||||||||||||||||||||
| 247 | QDomNodePrivate* removeNamedItem(const QString& name); | - | ||||||||||||||||||||||||
| 248 | QDomNodePrivate* item(int index) const; | - | ||||||||||||||||||||||||
| 249 | int length() const; | - | ||||||||||||||||||||||||
| 250 | bool contains(const QString& name) const; | - | ||||||||||||||||||||||||
| 251 | bool containsNS(const QString& nsURI, const QString & localName) const; | - | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | /** | - | ||||||||||||||||||||||||
| 254 | * Remove all children from the map. | - | ||||||||||||||||||||||||
| 255 | */ | - | ||||||||||||||||||||||||
| 256 | void clearMap(); | - | ||||||||||||||||||||||||
| 257 | bool isReadOnly() { return readonly; } never executed: return readonly; | 0 | ||||||||||||||||||||||||
| 258 | void setReadOnly(bool r) { readonly = r; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 259 | bool isAppendToParent() { return appendToParent; } never executed: return appendToParent; | 0 | ||||||||||||||||||||||||
| 260 | /** | - | ||||||||||||||||||||||||
| 261 | * If true, then the node will redirect insert/remove calls | - | ||||||||||||||||||||||||
| 262 | * to its parent by calling QDomNodePrivate::appendChild or removeChild. | - | ||||||||||||||||||||||||
| 263 | * In addition the map won't increase or decrease the reference count | - | ||||||||||||||||||||||||
| 264 | * of the nodes it contains. | - | ||||||||||||||||||||||||
| 265 | * | - | ||||||||||||||||||||||||
| 266 | * By default this value is false and the map will handle reference counting | - | ||||||||||||||||||||||||
| 267 | * by itself. | - | ||||||||||||||||||||||||
| 268 | */ | - | ||||||||||||||||||||||||
| 269 | void setAppendToParent(bool b) { appendToParent = b; } executed 976 times by 5 tests: end of blockExecuted by:
| 976 | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | /** | - | ||||||||||||||||||||||||
| 272 | * Creates a copy of the map. It is a deep copy | - | ||||||||||||||||||||||||
| 273 | * that means that all children are cloned. | - | ||||||||||||||||||||||||
| 274 | */ | - | ||||||||||||||||||||||||
| 275 | QDomNamedNodeMapPrivate* clone(QDomNodePrivate* parent); | - | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | // Variables | - | ||||||||||||||||||||||||
| 278 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 279 | QHash<QString, QDomNodePrivate *> map; | - | ||||||||||||||||||||||||
| 280 | QDomNodePrivate* parent; | - | ||||||||||||||||||||||||
| 281 | bool readonly; | - | ||||||||||||||||||||||||
| 282 | bool appendToParent; | - | ||||||||||||||||||||||||
| 283 | }; | - | ||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | class QDomDocumentTypePrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 286 | { | - | ||||||||||||||||||||||||
| 287 | public: | - | ||||||||||||||||||||||||
| 288 | QDomDocumentTypePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 289 | QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 290 | ~QDomDocumentTypePrivate(); | - | ||||||||||||||||||||||||
| 291 | void init(); | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 294 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 295 | QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 296 | QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 297 | QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 298 | QDomNodePrivate* removeChild(QDomNodePrivate* oldChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 299 | QDomNodePrivate* appendChild(QDomNodePrivate* newChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentTypeNode; } never executed: return QDomNode::DocumentTypeNode; | 0 | ||||||||||||||||||||||||
| 302 | - | |||||||||||||||||||||||||
| 303 | void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | // Variables | - | ||||||||||||||||||||||||
| 306 | QDomNamedNodeMapPrivate* entities; | - | ||||||||||||||||||||||||
| 307 | QDomNamedNodeMapPrivate* notations; | - | ||||||||||||||||||||||||
| 308 | QString publicId; | - | ||||||||||||||||||||||||
| 309 | QString systemId; | - | ||||||||||||||||||||||||
| 310 | QString internalSubset; | - | ||||||||||||||||||||||||
| 311 | }; | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | class QDomDocumentFragmentPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 314 | { | - | ||||||||||||||||||||||||
| 315 | public: | - | ||||||||||||||||||||||||
| 316 | QDomDocumentFragmentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 317 | QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||
| 319 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 320 | virtual QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 321 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentFragmentNode; } never executed: return QDomNode::DocumentFragmentNode; | 0 | ||||||||||||||||||||||||
| 322 | }; | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | class QDomCharacterDataPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 325 | { | - | ||||||||||||||||||||||||
| 326 | public: | - | ||||||||||||||||||||||||
| 327 | QDomCharacterDataPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& data); | - | ||||||||||||||||||||||||
| 328 | QDomCharacterDataPrivate(QDomCharacterDataPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | int dataLength() const; | - | ||||||||||||||||||||||||
| 331 | QString substringData(unsigned long offset, unsigned long count) const; | - | ||||||||||||||||||||||||
| 332 | void appendData(const QString& arg); | - | ||||||||||||||||||||||||
| 333 | void insertData(unsigned long offset, const QString& arg); | - | ||||||||||||||||||||||||
| 334 | void deleteData(unsigned long offset, unsigned long count); | - | ||||||||||||||||||||||||
| 335 | void replaceData(unsigned long offset, unsigned long count, const QString& arg); | - | ||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 338 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CharacterDataNode; } never executed: return QDomNode::CharacterDataNode; | 0 | ||||||||||||||||||||||||
| 339 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 340 | }; | - | ||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | class QDomTextPrivate : public QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 343 | { | - | ||||||||||||||||||||||||
| 344 | public: | - | ||||||||||||||||||||||||
| 345 | QDomTextPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 346 | QDomTextPrivate(QDomTextPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | QDomTextPrivate* splitText(int offset); | - | ||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 351 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 352 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::TextNode; } executed 994 times by 5 tests: return QDomNode::TextNode;Executed by:
| 994 | ||||||||||||||||||||||||
| 353 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 354 | }; | - | ||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | class QDomAttrPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||
| 358 | public: | - | ||||||||||||||||||||||||
| 359 | QDomAttrPrivate(QDomDocumentPrivate*, QDomNodePrivate*, const QString& name); | - | ||||||||||||||||||||||||
| 360 | QDomAttrPrivate(QDomDocumentPrivate*, QDomNodePrivate*, const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 361 | QDomAttrPrivate(QDomAttrPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 | bool specified() const; | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 366 | void setNodeValue(const QString& v) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 367 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 368 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::AttributeNode; } executed 1738 times by 4 tests: return QDomNode::AttributeNode;Executed by:
| 1738 | ||||||||||||||||||||||||
| 369 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | // Variables | - | ||||||||||||||||||||||||
| 372 | bool m_specified; | - | ||||||||||||||||||||||||
| 373 | }; | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | class QDomElementPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 376 | { | - | ||||||||||||||||||||||||
| 377 | public: | - | ||||||||||||||||||||||||
| 378 | QDomElementPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name); | - | ||||||||||||||||||||||||
| 379 | QDomElementPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 380 | QDomElementPrivate(QDomElementPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 381 | ~QDomElementPrivate(); | - | ||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | QString attribute(const QString& name, const QString& defValue) const; | - | ||||||||||||||||||||||||
| 384 | QString attributeNS(const QString& nsURI, const QString& localName, const QString& defValue) const; | - | ||||||||||||||||||||||||
| 385 | void setAttribute(const QString& name, const QString& value); | - | ||||||||||||||||||||||||
| 386 | void setAttributeNS(const QString& nsURI, const QString& qName, const QString& newValue); | - | ||||||||||||||||||||||||
| 387 | void removeAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 388 | QDomAttrPrivate* attributeNode(const QString& name); | - | ||||||||||||||||||||||||
| 389 | QDomAttrPrivate* attributeNodeNS(const QString& nsURI, const QString& localName); | - | ||||||||||||||||||||||||
| 390 | QDomAttrPrivate* setAttributeNode(QDomAttrPrivate* newAttr); | - | ||||||||||||||||||||||||
| 391 | QDomAttrPrivate* setAttributeNodeNS(QDomAttrPrivate* newAttr); | - | ||||||||||||||||||||||||
| 392 | QDomAttrPrivate* removeAttributeNode(QDomAttrPrivate* oldAttr); | - | ||||||||||||||||||||||||
| 393 | bool hasAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 394 | bool hasAttributeNS(const QString& nsURI, const QString& localName); | - | ||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||
| 396 | QString text(); | - | ||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 399 | QDomNamedNodeMapPrivate* attributes() { return m_attr; } never executed: return m_attr; | 0 | ||||||||||||||||||||||||
| 400 | bool hasAttributes() { return (m_attr->length() > 0); } executed 26 times by 1 test: return (m_attr->length() > 0);Executed by:
| 26 | ||||||||||||||||||||||||
| 401 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ElementNode; } executed 10667 times by 5 tests: return QDomNode::ElementNode;Executed by:
| 10667 | ||||||||||||||||||||||||
| 402 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 403 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | // Variables | - | ||||||||||||||||||||||||
| 406 | QDomNamedNodeMapPrivate* m_attr; | - | ||||||||||||||||||||||||
| 407 | }; | - | ||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | class QDomCommentPrivate : public QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 411 | { | - | ||||||||||||||||||||||||
| 412 | public: | - | ||||||||||||||||||||||||
| 413 | QDomCommentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 414 | QDomCommentPrivate(QDomCommentPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 417 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 418 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CommentNode; } never executed: return QDomNode::CommentNode; | 0 | ||||||||||||||||||||||||
| 419 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 420 | }; | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | class QDomCDATASectionPrivate : public QDomTextPrivate | - | ||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||
| 424 | public: | - | ||||||||||||||||||||||||
| 425 | QDomCDATASectionPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 426 | QDomCDATASectionPrivate(QDomCDATASectionPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 429 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 430 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CDATASectionNode; } never executed: return QDomNode::CDATASectionNode; | 0 | ||||||||||||||||||||||||
| 431 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 432 | }; | - | ||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | class QDomNotationPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 435 | { | - | ||||||||||||||||||||||||
| 436 | public: | - | ||||||||||||||||||||||||
| 437 | QDomNotationPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name, | - | ||||||||||||||||||||||||
| 438 | const QString& pub, const QString& sys); | - | ||||||||||||||||||||||||
| 439 | QDomNotationPrivate(QDomNotationPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 442 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 443 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::NotationNode; } never executed: return QDomNode::NotationNode; | 0 | ||||||||||||||||||||||||
| 444 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | // Variables | - | ||||||||||||||||||||||||
| 447 | QString m_sys; | - | ||||||||||||||||||||||||
| 448 | QString m_pub; | - | ||||||||||||||||||||||||
| 449 | }; | - | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | class QDomEntityPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 452 | { | - | ||||||||||||||||||||||||
| 453 | public: | - | ||||||||||||||||||||||||
| 454 | QDomEntityPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name, | - | ||||||||||||||||||||||||
| 455 | const QString& pub, const QString& sys, const QString& notation); | - | ||||||||||||||||||||||||
| 456 | QDomEntityPrivate(QDomEntityPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 459 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 460 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityNode; } never executed: return QDomNode::EntityNode; | 0 | ||||||||||||||||||||||||
| 461 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | // Variables | - | ||||||||||||||||||||||||
| 464 | QString m_sys; | - | ||||||||||||||||||||||||
| 465 | QString m_pub; | - | ||||||||||||||||||||||||
| 466 | QString m_notationName; | - | ||||||||||||||||||||||||
| 467 | }; | - | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | class QDomEntityReferencePrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 470 | { | - | ||||||||||||||||||||||||
| 471 | public: | - | ||||||||||||||||||||||||
| 472 | QDomEntityReferencePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name); | - | ||||||||||||||||||||||||
| 473 | QDomEntityReferencePrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 476 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 477 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityReferenceNode; } never executed: return QDomNode::EntityReferenceNode; | 0 | ||||||||||||||||||||||||
| 478 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 479 | }; | - | ||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | class QDomProcessingInstructionPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 482 | { | - | ||||||||||||||||||||||||
| 483 | public: | - | ||||||||||||||||||||||||
| 484 | QDomProcessingInstructionPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& target, | - | ||||||||||||||||||||||||
| 485 | const QString& data); | - | ||||||||||||||||||||||||
| 486 | QDomProcessingInstructionPrivate(QDomProcessingInstructionPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||
| 488 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 489 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 490 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ProcessingInstructionNode; } never executed: return QDomNode::ProcessingInstructionNode; | 0 | ||||||||||||||||||||||||
| 491 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 492 | }; | - | ||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||
| 494 | class QDomDocumentPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 495 | { | - | ||||||||||||||||||||||||
| 496 | public: | - | ||||||||||||||||||||||||
| 497 | QDomDocumentPrivate(); | - | ||||||||||||||||||||||||
| 498 | QDomDocumentPrivate(const QString& name); | - | ||||||||||||||||||||||||
| 499 | QDomDocumentPrivate(QDomDocumentTypePrivate* dt); | - | ||||||||||||||||||||||||
| 500 | QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 501 | ~QDomDocumentPrivate(); | - | ||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn); | - | ||||||||||||||||||||||||
| 504 | bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn); | - | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | // Attributes | - | ||||||||||||||||||||||||
| 507 | QDomDocumentTypePrivate* doctype() { return type.data(); } executed 471 times by 2 tests: return type.data();Executed by:
| 471 | ||||||||||||||||||||||||
| 508 | QDomImplementationPrivate* implementation() { return impl.data(); } never executed: return impl.data(); | 0 | ||||||||||||||||||||||||
| 509 | QDomElementPrivate* documentElement(); | - | ||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | // Factories | - | ||||||||||||||||||||||||
| 512 | QDomElementPrivate* createElement(const QString& tagName); | - | ||||||||||||||||||||||||
| 513 | QDomElementPrivate* createElementNS(const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 514 | QDomDocumentFragmentPrivate* createDocumentFragment(); | - | ||||||||||||||||||||||||
| 515 | QDomTextPrivate* createTextNode(const QString& data); | - | ||||||||||||||||||||||||
| 516 | QDomCommentPrivate* createComment(const QString& data); | - | ||||||||||||||||||||||||
| 517 | QDomCDATASectionPrivate* createCDATASection(const QString& data); | - | ||||||||||||||||||||||||
| 518 | QDomProcessingInstructionPrivate* createProcessingInstruction(const QString& target, const QString& data); | - | ||||||||||||||||||||||||
| 519 | QDomAttrPrivate* createAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 520 | QDomAttrPrivate* createAttributeNS(const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 521 | QDomEntityReferencePrivate* createEntityReference(const QString& name); | - | ||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | QDomNodePrivate* importNode(QDomNodePrivate* importedNode, bool deep); | - | ||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 526 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 527 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentNode; } executed 3842 times by 5 tests: return QDomNode::DocumentNode;Executed by:
| 3842 | ||||||||||||||||||||||||
| 528 | void clear() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||
| 530 | // Variables | - | ||||||||||||||||||||||||
| 531 | QExplicitlySharedDataPointer<QDomImplementationPrivate> impl; | - | ||||||||||||||||||||||||
| 532 | QExplicitlySharedDataPointer<QDomDocumentTypePrivate> type; | - | ||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||
| 534 | void saveDocument(QTextStream& stream, const int indent, QDomNode::EncodingPolicy encUsed) const; | - | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | /* \internal | - | ||||||||||||||||||||||||
| 537 | Counter for the QDomNodeListPrivate timestamps. | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | This is a cache optimization, that might in some cases be effective. The | - | ||||||||||||||||||||||||
| 540 | dilemma is that QDomNode::childNodes() returns a list, but the | - | ||||||||||||||||||||||||
| 541 | implementation stores the children in a linked list. Hence, in order to | - | ||||||||||||||||||||||||
| 542 | get the children out through childNodes(), a list must be populated each | - | ||||||||||||||||||||||||
| 543 | time, which is O(N). | - | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | DOM has the requirement of node references being live, see DOM Core | - | ||||||||||||||||||||||||
| 546 | Level 3, 1.1.1 The DOM Structure Model, which means that changes to the | - | ||||||||||||||||||||||||
| 547 | underlying documents must be reflected in node lists. | - | ||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | This mechanism, nodeListTime, is a caching optimization that reduces the | - | ||||||||||||||||||||||||
| 550 | amount of times the node list is rebuilt, by only doing so when the | - | ||||||||||||||||||||||||
| 551 | document actually changes. However, a change to anywhere in any document | - | ||||||||||||||||||||||||
| 552 | invalidate all lists, since no dependency tracking is done. | - | ||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||
| 554 | It functions by that all modifying functions(insertBefore() and so on) | - | ||||||||||||||||||||||||
| 555 | increment the count; each QDomNodeListPrivate copies nodeListTime on | - | ||||||||||||||||||||||||
| 556 | construction, and compares its own value to nodeListTime in order to | - | ||||||||||||||||||||||||
| 557 | determine whether it needs to rebuild. | - | ||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | This is reentrant. The nodeListTime may overflow, but that's ok since we | - | ||||||||||||||||||||||||
| 560 | check for equalness, not whether nodeListTime is smaller than the list's | - | ||||||||||||||||||||||||
| 561 | stored timestamp. | - | ||||||||||||||||||||||||
| 562 | */ | - | ||||||||||||||||||||||||
| 563 | long nodeListTime; | - | ||||||||||||||||||||||||
| 564 | }; | - | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | /************************************************************** | - | ||||||||||||||||||||||||
| 567 | * | - | ||||||||||||||||||||||||
| 568 | * QDomHandler | - | ||||||||||||||||||||||||
| 569 | * | - | ||||||||||||||||||||||||
| 570 | **************************************************************/ | - | ||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | class QDomHandler : public QXmlDefaultHandler | - | ||||||||||||||||||||||||
| 573 | { | - | ||||||||||||||||||||||||
| 574 | public: | - | ||||||||||||||||||||||||
| 575 | QDomHandler(QDomDocumentPrivate* d, QXmlSimpleReader *reader, bool namespaceProcessing); | - | ||||||||||||||||||||||||
| 576 | ~QDomHandler(); | - | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | // content handler | - | ||||||||||||||||||||||||
| 579 | bool endDocument() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 580 | bool startElement(const QString& nsURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 581 | bool endElement(const QString& nsURI, const QString& localName, const QString& qName) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 582 | bool characters(const QString& ch) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 583 | bool processingInstruction(const QString& target, const QString& data) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 584 | bool skippedEntity(const QString& name) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | // error handler | - | ||||||||||||||||||||||||
| 587 | bool fatalError(const QXmlParseException& exception) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 | // lexical handler | - | ||||||||||||||||||||||||
| 590 | bool startCDATA() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 591 | bool endCDATA() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 592 | bool startEntity(const QString &) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 593 | bool endEntity(const QString &) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 594 | bool startDTD(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 595 | bool comment(const QString& ch) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | // decl handler | - | ||||||||||||||||||||||||
| 598 | bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) Q_DECL_OVERRIDE ; | - | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | // DTD handler | - | ||||||||||||||||||||||||
| 601 | bool notationDecl(const QString & name, const QString & publicId, const QString & systemId) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 602 | bool unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName) Q_DECL_OVERRIDE ; | - | ||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | void setDocumentLocator(QXmlLocator *locator) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||
| 606 | QString errorMsg; | - | ||||||||||||||||||||||||
| 607 | int errorLine; | - | ||||||||||||||||||||||||
| 608 | int errorColumn; | - | ||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | private: | - | ||||||||||||||||||||||||
| 611 | QDomDocumentPrivate *doc; | - | ||||||||||||||||||||||||
| 612 | QDomNodePrivate *node; | - | ||||||||||||||||||||||||
| 613 | QString entityName; | - | ||||||||||||||||||||||||
| 614 | bool cdata; | - | ||||||||||||||||||||||||
| 615 | bool nsProcessing; | - | ||||||||||||||||||||||||
| 616 | QXmlLocator *locator; | - | ||||||||||||||||||||||||
| 617 | QXmlSimpleReader *reader; | - | ||||||||||||||||||||||||
| 618 | }; | - | ||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||
| 620 | /************************************************************** | - | ||||||||||||||||||||||||
| 621 | * | - | ||||||||||||||||||||||||
| 622 | * Functions for verifying legal data | - | ||||||||||||||||||||||||
| 623 | * | - | ||||||||||||||||||||||||
| 624 | **************************************************************/ | - | ||||||||||||||||||||||||
| 625 | QDomImplementation::InvalidDataPolicy QDomImplementationPrivate::invalidDataPolicy | - | ||||||||||||||||||||||||
| 626 | = QDomImplementation::AcceptInvalidChars; | - | ||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||
| 628 | // [5] Name ::= (Letter | '_' | ':') (NameChar)* | - | ||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||
| 630 | static QString fixedXmlName(const QString &_name, bool *ok, bool namespaces = false) | - | ||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||
| 632 | QString name, prefix; | - | ||||||||||||||||||||||||
| 633 | if (namespaces)
| 2-1021 | ||||||||||||||||||||||||
| 634 | qt_split_namespace(prefix, name, _name, true); executed 2 times by 1 test: qt_split_namespace(prefix, name, _name, true);Executed by:
| 2 | ||||||||||||||||||||||||
| 635 | else | - | ||||||||||||||||||||||||
| 636 | name = _name; executed 1021 times by 4 tests: name = _name;Executed by:
| 1021 | ||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | if (name.isEmpty()) {
| 0-1023 | ||||||||||||||||||||||||
| 639 | *ok = false; | - | ||||||||||||||||||||||||
| 640 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 641 | } | - | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0-1023 | ||||||||||||||||||||||||
| 644 | *ok = true; | - | ||||||||||||||||||||||||
| 645 | return _name; executed 1023 times by 5 tests: return _name;Executed by:
| 1023 | ||||||||||||||||||||||||
| 646 | } | - | ||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | QString result; | - | ||||||||||||||||||||||||
| 649 | bool firstChar = true; | - | ||||||||||||||||||||||||
| 650 | for (int i = 0; i < name.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 651 | QChar c = name.at(i); | - | ||||||||||||||||||||||||
| 652 | if (firstChar) {
| 0 | ||||||||||||||||||||||||
| 653 | if (QXmlUtils::isLetter(c) || c.unicode() == '_' || c.unicode() == ':') {
| 0 | ||||||||||||||||||||||||
| 654 | result.append(c); | - | ||||||||||||||||||||||||
| 655 | firstChar = false; | - | ||||||||||||||||||||||||
| 656 | } else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 657 | *ok = false; | - | ||||||||||||||||||||||||
| 658 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 659 | } | - | ||||||||||||||||||||||||
| 660 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 661 | if (QXmlUtils::isNameChar(c))
| 0 | ||||||||||||||||||||||||
| 662 | result.append(c); never executed: result.append(c); | 0 | ||||||||||||||||||||||||
| 663 | else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 664 | *ok = false; | - | ||||||||||||||||||||||||
| 665 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 666 | } | - | ||||||||||||||||||||||||
| 667 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 668 | } | - | ||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | if (result.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 671 | *ok = false; | - | ||||||||||||||||||||||||
| 672 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 673 | } | - | ||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | *ok = true; | - | ||||||||||||||||||||||||
| 676 | if (namespaces && !prefix.isEmpty())
| 0 | ||||||||||||||||||||||||
| 677 | return prefix + QLatin1Char(':') + result; never executed: return prefix + QLatin1Char(':') + result; | 0 | ||||||||||||||||||||||||
| 678 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 679 | } | - | ||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | // [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) | - | ||||||||||||||||||||||||
| 682 | // '<', '&' and "]]>" will be escaped when writing | - | ||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | static QString fixedCharData(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 685 | { | - | ||||||||||||||||||||||||
| 686 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0-125 | ||||||||||||||||||||||||
| 687 | *ok = true; | - | ||||||||||||||||||||||||
| 688 | return data; executed 125 times by 2 tests: return data;Executed by:
| 125 | ||||||||||||||||||||||||
| 689 | } | - | ||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||
| 691 | QString result; | - | ||||||||||||||||||||||||
| 692 | for (int i = 0; i < data.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 693 | QChar c = data.at(i); | - | ||||||||||||||||||||||||
| 694 | if (QXmlUtils::isChar(c)) {
| 0 | ||||||||||||||||||||||||
| 695 | result.append(c); | - | ||||||||||||||||||||||||
| 696 | } else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 697 | *ok = false; | - | ||||||||||||||||||||||||
| 698 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 699 | } | - | ||||||||||||||||||||||||
| 700 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| 702 | *ok = true; | - | ||||||||||||||||||||||||
| 703 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 704 | } | - | ||||||||||||||||||||||||
| 705 | - | |||||||||||||||||||||||||
| 706 | // [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' | - | ||||||||||||||||||||||||
| 707 | // can't escape "--", since entities are not recognised within comments | - | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | static QString fixedComment(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 710 | { | - | ||||||||||||||||||||||||
| 711 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 712 | *ok = true; | - | ||||||||||||||||||||||||
| 713 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 714 | } | - | ||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||
| 716 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 717 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 718 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 | for (;;) { | - | ||||||||||||||||||||||||
| 721 | int idx = fixedData.indexOf(QLatin1String("--")); | - | ||||||||||||||||||||||||
| 722 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 723 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 724 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 725 | *ok = false; | - | ||||||||||||||||||||||||
| 726 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 727 | } | - | ||||||||||||||||||||||||
| 728 | fixedData.remove(idx, 2); | - | ||||||||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | *ok = true; | - | ||||||||||||||||||||||||
| 732 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||
| 735 | // [20] CData ::= (Char* - (Char* ']]>' Char*)) | - | ||||||||||||||||||||||||
| 736 | // can't escape "]]>", since entities are not recognised within comments | - | ||||||||||||||||||||||||
| 737 | - | |||||||||||||||||||||||||
| 738 | static QString fixedCDataSection(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 739 | { | - | ||||||||||||||||||||||||
| 740 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 741 | *ok = true; | - | ||||||||||||||||||||||||
| 742 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 743 | } | - | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 746 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 747 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | for (;;) { | - | ||||||||||||||||||||||||
| 750 | int idx = fixedData.indexOf(QLatin1String("]]>")); | - | ||||||||||||||||||||||||
| 751 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 752 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 753 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 754 | *ok = false; | - | ||||||||||||||||||||||||
| 755 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 756 | } | - | ||||||||||||||||||||||||
| 757 | fixedData.remove(idx, 3); | - | ||||||||||||||||||||||||
| 758 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | *ok = true; | - | ||||||||||||||||||||||||
| 761 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 762 | } | - | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | // [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | static QString fixedPIData(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 767 | { | - | ||||||||||||||||||||||||
| 768 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 769 | *ok = true; | - | ||||||||||||||||||||||||
| 770 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 771 | } | - | ||||||||||||||||||||||||
| 772 | - | |||||||||||||||||||||||||
| 773 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 774 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 775 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | for (;;) { | - | ||||||||||||||||||||||||
| 778 | int idx = fixedData.indexOf(QLatin1String("?>")); | - | ||||||||||||||||||||||||
| 779 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 780 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 781 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 782 | *ok = false; | - | ||||||||||||||||||||||||
| 783 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 784 | } | - | ||||||||||||||||||||||||
| 785 | fixedData.remove(idx, 2); | - | ||||||||||||||||||||||||
| 786 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||
| 788 | *ok = true; | - | ||||||||||||||||||||||||
| 789 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | // [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" | - | ||||||||||||||||||||||||
| 793 | // The correct quote will be chosen when writing | - | ||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||
| 795 | static QString fixedPubidLiteral(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 796 | { | - | ||||||||||||||||||||||||
| 797 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 798 | *ok = true; | - | ||||||||||||||||||||||||
| 799 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 800 | } | - | ||||||||||||||||||||||||
| 801 | - | |||||||||||||||||||||||||
| 802 | QString result; | - | ||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||
| 804 | if(QXmlUtils::isPublicID(data))
| 0 | ||||||||||||||||||||||||
| 805 | result = data; never executed: result = data; | 0 | ||||||||||||||||||||||||
| 806 | else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 807 | *ok = false; | - | ||||||||||||||||||||||||
| 808 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||
| 810 | - | |||||||||||||||||||||||||
| 811 | if (result.indexOf(QLatin1Char('\'')) != -1
| 0 | ||||||||||||||||||||||||
| 812 | && result.indexOf(QLatin1Char('"')) != -1) {
| 0 | ||||||||||||||||||||||||
| 813 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 814 | *ok = false; | - | ||||||||||||||||||||||||
| 815 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 816 | } else { | - | ||||||||||||||||||||||||
| 817 | result.remove(QLatin1Char('\'')); | - | ||||||||||||||||||||||||
| 818 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 819 | } | - | ||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||
| 821 | *ok = true; | - | ||||||||||||||||||||||||
| 822 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 823 | } | - | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | // [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") | - | ||||||||||||||||||||||||
| 826 | // The correct quote will be chosen when writing | - | ||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||
| 828 | static QString fixedSystemLiteral(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 829 | { | - | ||||||||||||||||||||||||
| 830 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 831 | *ok = true; | - | ||||||||||||||||||||||||
| 832 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 833 | } | - | ||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||
| 835 | QString result = data; | - | ||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||
| 837 | if (result.indexOf(QLatin1Char('\'')) != -1
| 0 | ||||||||||||||||||||||||
| 838 | && result.indexOf(QLatin1Char('"')) != -1) {
| 0 | ||||||||||||||||||||||||
| 839 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 840 | *ok = false; | - | ||||||||||||||||||||||||
| 841 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 842 | } else { | - | ||||||||||||||||||||||||
| 843 | result.remove(QLatin1Char('\'')); | - | ||||||||||||||||||||||||
| 844 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 845 | } | - | ||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||
| 847 | *ok = true; | - | ||||||||||||||||||||||||
| 848 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 849 | } | - | ||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | /************************************************************** | - | ||||||||||||||||||||||||
| 852 | * | - | ||||||||||||||||||||||||
| 853 | * QDomImplementationPrivate | - | ||||||||||||||||||||||||
| 854 | * | - | ||||||||||||||||||||||||
| 855 | **************************************************************/ | - | ||||||||||||||||||||||||
| 856 | - | |||||||||||||||||||||||||
| 857 | QDomImplementationPrivate* QDomImplementationPrivate::clone() | - | ||||||||||||||||||||||||
| 858 | { | - | ||||||||||||||||||||||||
| 859 | return new QDomImplementationPrivate; never executed: return new QDomImplementationPrivate; | 0 | ||||||||||||||||||||||||
| 860 | } | - | ||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | /************************************************************** | - | ||||||||||||||||||||||||
| 863 | * | - | ||||||||||||||||||||||||
| 864 | * QDomImplementation | - | ||||||||||||||||||||||||
| 865 | * | - | ||||||||||||||||||||||||
| 866 | **************************************************************/ | - | ||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | /*! | - | ||||||||||||||||||||||||
| 869 | \class QDomImplementation | - | ||||||||||||||||||||||||
| 870 | \reentrant | - | ||||||||||||||||||||||||
| 871 | \brief The QDomImplementation class provides information about the | - | ||||||||||||||||||||||||
| 872 | features of the DOM implementation. | - | ||||||||||||||||||||||||
| 873 | - | |||||||||||||||||||||||||
| 874 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 875 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||
| 877 | This class describes the features that are supported by the DOM | - | ||||||||||||||||||||||||
| 878 | implementation. Currently the XML subset of DOM Level 1 and DOM | - | ||||||||||||||||||||||||
| 879 | Level 2 Core are supported. | - | ||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | Normally you will use the function QDomDocument::implementation() | - | ||||||||||||||||||||||||
| 882 | to get the implementation object. | - | ||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||
| 884 | You can create a new document type with createDocumentType() and a | - | ||||||||||||||||||||||||
| 885 | new document with createDocument(). | - | ||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 888 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 889 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. For a more | - | ||||||||||||||||||||||||
| 890 | general introduction of the DOM implementation see the QDomDocument | - | ||||||||||||||||||||||||
| 891 | documentation. | - | ||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | The QDom classes have a few issues of nonconformance with the XML | - | ||||||||||||||||||||||||
| 894 | specifications that cannot be fixed in Qt 4 without breaking backward | - | ||||||||||||||||||||||||
| 895 | compatibility. The Qt XML Patterns module and the QXmlStreamReader and | - | ||||||||||||||||||||||||
| 896 | QXmlStreamWriter classes have a higher degree of a conformance. | - | ||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||
| 898 | \sa hasFeature() | - | ||||||||||||||||||||||||
| 899 | */ | - | ||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||
| 901 | /*! | - | ||||||||||||||||||||||||
| 902 | Constructs a QDomImplementation object. | - | ||||||||||||||||||||||||
| 903 | */ | - | ||||||||||||||||||||||||
| 904 | QDomImplementation::QDomImplementation() | - | ||||||||||||||||||||||||
| 905 | { | - | ||||||||||||||||||||||||
| 906 | impl = 0; | - | ||||||||||||||||||||||||
| 907 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||
| 909 | /*! | - | ||||||||||||||||||||||||
| 910 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 911 | */ | - | ||||||||||||||||||||||||
| 912 | QDomImplementation::QDomImplementation(const QDomImplementation &x) | - | ||||||||||||||||||||||||
| 913 | { | - | ||||||||||||||||||||||||
| 914 | impl = x.impl; | - | ||||||||||||||||||||||||
| 915 | if (impl)
| 0 | ||||||||||||||||||||||||
| 916 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 917 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||
| 919 | QDomImplementation::QDomImplementation(QDomImplementationPrivate *p) | - | ||||||||||||||||||||||||
| 920 | { | - | ||||||||||||||||||||||||
| 921 | // We want to be co-owners, so increase the reference count | - | ||||||||||||||||||||||||
| 922 | impl = p; | - | ||||||||||||||||||||||||
| 923 | if (impl)
| 0 | ||||||||||||||||||||||||
| 924 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 925 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | /*! | - | ||||||||||||||||||||||||
| 928 | Assigns \a x to this DOM implementation. | - | ||||||||||||||||||||||||
| 929 | */ | - | ||||||||||||||||||||||||
| 930 | QDomImplementation& QDomImplementation::operator=(const QDomImplementation &x) | - | ||||||||||||||||||||||||
| 931 | { | - | ||||||||||||||||||||||||
| 932 | if (x.impl)
| 0 | ||||||||||||||||||||||||
| 933 | x.impl->ref.ref(); never executed: x.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 934 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 935 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 936 | impl = x.impl; | - | ||||||||||||||||||||||||
| 937 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 938 | } | - | ||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||
| 940 | /*! | - | ||||||||||||||||||||||||
| 941 | Returns \c true if \a x and this DOM implementation object were | - | ||||||||||||||||||||||||
| 942 | created from the same QDomDocument; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 943 | */ | - | ||||||||||||||||||||||||
| 944 | bool QDomImplementation::operator==(const QDomImplementation &x) const | - | ||||||||||||||||||||||||
| 945 | { | - | ||||||||||||||||||||||||
| 946 | return (impl == x.impl); never executed: return (impl == x.impl); | 0 | ||||||||||||||||||||||||
| 947 | } | - | ||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 | /*! | - | ||||||||||||||||||||||||
| 950 | Returns \c true if \a x and this DOM implementation object were | - | ||||||||||||||||||||||||
| 951 | created from different QDomDocuments; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 952 | */ | - | ||||||||||||||||||||||||
| 953 | bool QDomImplementation::operator!=(const QDomImplementation &x) const | - | ||||||||||||||||||||||||
| 954 | { | - | ||||||||||||||||||||||||
| 955 | return (impl != x.impl); never executed: return (impl != x.impl); | 0 | ||||||||||||||||||||||||
| 956 | } | - | ||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | /*! | - | ||||||||||||||||||||||||
| 959 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 960 | */ | - | ||||||||||||||||||||||||
| 961 | QDomImplementation::~QDomImplementation() | - | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 964 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 965 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | /*! | - | ||||||||||||||||||||||||
| 968 | The function returns \c true if QDom implements the requested \a | - | ||||||||||||||||||||||||
| 969 | version of a \a feature; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 970 | - | |||||||||||||||||||||||||
| 971 | The currently supported features and their versions: | - | ||||||||||||||||||||||||
| 972 | \table | - | ||||||||||||||||||||||||
| 973 | \header \li Feature \li Version | - | ||||||||||||||||||||||||
| 974 | \row \li XML \li 1.0 | - | ||||||||||||||||||||||||
| 975 | \endtable | - | ||||||||||||||||||||||||
| 976 | */ | - | ||||||||||||||||||||||||
| 977 | bool QDomImplementation::hasFeature(const QString& feature, const QString& version) const | - | ||||||||||||||||||||||||
| 978 | { | - | ||||||||||||||||||||||||
| 979 | if (feature == QLatin1String("XML")) {
| 0 | ||||||||||||||||||||||||
| 980 | if (version.isEmpty() || version == QLatin1String("1.0")) {
| 0 | ||||||||||||||||||||||||
| 981 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 982 | } | - | ||||||||||||||||||||||||
| 983 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 984 | // ### add DOM level 2 features | - | ||||||||||||||||||||||||
| 985 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 986 | } | - | ||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | /*! | - | ||||||||||||||||||||||||
| 989 | Creates a document type node for the name \a qName. | - | ||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||
| 991 | \a publicId specifies the public identifier of the external | - | ||||||||||||||||||||||||
| 992 | subset. If you specify an empty string (QString()) as the \a | - | ||||||||||||||||||||||||
| 993 | publicId, this means that the document type has no public | - | ||||||||||||||||||||||||
| 994 | identifier. | - | ||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||
| 996 | \a systemId specifies the system identifier of the external | - | ||||||||||||||||||||||||
| 997 | subset. If you specify an empty string as the \a systemId, this | - | ||||||||||||||||||||||||
| 998 | means that the document type has no system identifier. | - | ||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | Since you cannot have a public identifier without a system | - | ||||||||||||||||||||||||
| 1001 | identifier, the public identifier is set to an empty string if | - | ||||||||||||||||||||||||
| 1002 | there is no system identifier. | - | ||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||
| 1004 | DOM level 2 does not support any other document type declaration | - | ||||||||||||||||||||||||
| 1005 | features. | - | ||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||
| 1007 | The only way you can use a document type that was created this | - | ||||||||||||||||||||||||
| 1008 | way, is in combination with the createDocument() function to | - | ||||||||||||||||||||||||
| 1009 | create a QDomDocument with this document type. | - | ||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | In the DOM specification, this is the only way to create a non-null | - | ||||||||||||||||||||||||
| 1012 | document. For historical reasons, Qt also allows to create the | - | ||||||||||||||||||||||||
| 1013 | document using the default empty constructor. The resulting document | - | ||||||||||||||||||||||||
| 1014 | is null, but becomes non-null when a factory function, for example | - | ||||||||||||||||||||||||
| 1015 | QDomDocument::createElement(), is called. The document also becomes | - | ||||||||||||||||||||||||
| 1016 | non-null when setContent() is called. | - | ||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | \sa createDocument() | - | ||||||||||||||||||||||||
| 1019 | */ | - | ||||||||||||||||||||||||
| 1020 | QDomDocumentType QDomImplementation::createDocumentType(const QString& qName, const QString& publicId, const QString& systemId) | - | ||||||||||||||||||||||||
| 1021 | { | - | ||||||||||||||||||||||||
| 1022 | bool ok; | - | ||||||||||||||||||||||||
| 1023 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 1024 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1025 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | QString fixedPublicId = fixedPubidLiteral(publicId, &ok); | - | ||||||||||||||||||||||||
| 1028 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1029 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||
| 1031 | QString fixedSystemId = fixedSystemLiteral(systemId, &ok); | - | ||||||||||||||||||||||||
| 1032 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1033 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1034 | - | |||||||||||||||||||||||||
| 1035 | QDomDocumentTypePrivate *dt = new QDomDocumentTypePrivate(0); | - | ||||||||||||||||||||||||
| 1036 | dt->name = fixedName; | - | ||||||||||||||||||||||||
| 1037 | if (systemId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1038 | dt->publicId.clear(); | - | ||||||||||||||||||||||||
| 1039 | dt->systemId.clear(); | - | ||||||||||||||||||||||||
| 1040 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1041 | dt->publicId = fixedPublicId; | - | ||||||||||||||||||||||||
| 1042 | dt->systemId = fixedSystemId; | - | ||||||||||||||||||||||||
| 1043 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1044 | dt->ref.deref(); | - | ||||||||||||||||||||||||
| 1045 | return QDomDocumentType(dt); never executed: return QDomDocumentType(dt); | 0 | ||||||||||||||||||||||||
| 1046 | } | - | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | /*! | - | ||||||||||||||||||||||||
| 1049 | Creates a DOM document with the document type \a doctype. This | - | ||||||||||||||||||||||||
| 1050 | function also adds a root element node with the qualified name \a | - | ||||||||||||||||||||||||
| 1051 | qName and the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 1052 | */ | - | ||||||||||||||||||||||||
| 1053 | QDomDocument QDomImplementation::createDocument(const QString& nsURI, const QString& qName, const QDomDocumentType& doctype) | - | ||||||||||||||||||||||||
| 1054 | { | - | ||||||||||||||||||||||||
| 1055 | QDomDocument doc(doctype); | - | ||||||||||||||||||||||||
| 1056 | QDomElement root = doc.createElementNS(nsURI, qName); | - | ||||||||||||||||||||||||
| 1057 | if (root.isNull())
| 0 | ||||||||||||||||||||||||
| 1058 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 1059 | doc.appendChild(root); | - | ||||||||||||||||||||||||
| 1060 | return doc; never executed: return doc; | 0 | ||||||||||||||||||||||||
| 1061 | } | - | ||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||
| 1063 | /*! | - | ||||||||||||||||||||||||
| 1064 | Returns \c false if the object was created by | - | ||||||||||||||||||||||||
| 1065 | QDomDocument::implementation(); otherwise returns \c true. | - | ||||||||||||||||||||||||
| 1066 | */ | - | ||||||||||||||||||||||||
| 1067 | bool QDomImplementation::isNull() | - | ||||||||||||||||||||||||
| 1068 | { | - | ||||||||||||||||||||||||
| 1069 | return (impl == 0); never executed: return (impl == 0); | 0 | ||||||||||||||||||||||||
| 1070 | } | - | ||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||
| 1072 | /*! | - | ||||||||||||||||||||||||
| 1073 | \enum QDomImplementation::InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||
| 1075 | This enum specifies what should be done when a factory function | - | ||||||||||||||||||||||||
| 1076 | in QDomDocument is called with invalid data. | - | ||||||||||||||||||||||||
| 1077 | \value AcceptInvalidChars The data should be stored in the DOM object | - | ||||||||||||||||||||||||
| 1078 | anyway. In this case the resulting XML document might not be well-formed. | - | ||||||||||||||||||||||||
| 1079 | This is the default value and QDom's behavior in Qt < 4.1. | - | ||||||||||||||||||||||||
| 1080 | \value DropInvalidChars The invalid characters should be removed from | - | ||||||||||||||||||||||||
| 1081 | the data. | - | ||||||||||||||||||||||||
| 1082 | \value ReturnNullNode The factory function should return a null node. | - | ||||||||||||||||||||||||
| 1083 | - | |||||||||||||||||||||||||
| 1084 | \sa setInvalidDataPolicy(), invalidDataPolicy() | - | ||||||||||||||||||||||||
| 1085 | */ | - | ||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||
| 1087 | /*! | - | ||||||||||||||||||||||||
| 1088 | \enum QDomNode::EncodingPolicy | - | ||||||||||||||||||||||||
| 1089 | \since 4.3 | - | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | This enum specifies how QDomNode::save() determines what encoding to use | - | ||||||||||||||||||||||||
| 1092 | when serializing. | - | ||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | \value EncodingFromDocument The encoding is fetched from the document. | - | ||||||||||||||||||||||||
| 1095 | \value EncodingFromTextStream The encoding is fetched from the QTextStream. | - | ||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||
| 1097 | \sa QDomNode::save() | - | ||||||||||||||||||||||||
| 1098 | */ | - | ||||||||||||||||||||||||
| 1099 | - | |||||||||||||||||||||||||
| 1100 | /*! | - | ||||||||||||||||||||||||
| 1101 | \since 4.1 | - | ||||||||||||||||||||||||
| 1102 | \nonreentrant | - | ||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||
| 1104 | Returns the invalid data policy, which specifies what should be done when | - | ||||||||||||||||||||||||
| 1105 | a factory function in QDomDocument is passed invalid data. | - | ||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||
| 1107 | \sa setInvalidDataPolicy(), InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1108 | */ | - | ||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||
| 1110 | QDomImplementation::InvalidDataPolicy QDomImplementation::invalidDataPolicy() | - | ||||||||||||||||||||||||
| 1111 | { | - | ||||||||||||||||||||||||
| 1112 | return QDomImplementationPrivate::invalidDataPolicy; never executed: return QDomImplementationPrivate::invalidDataPolicy; | 0 | ||||||||||||||||||||||||
| 1113 | } | - | ||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||
| 1115 | /*! | - | ||||||||||||||||||||||||
| 1116 | \since 4.1 | - | ||||||||||||||||||||||||
| 1117 | \nonreentrant | - | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | Sets the invalid data policy, which specifies what should be done when | - | ||||||||||||||||||||||||
| 1120 | a factory function in QDomDocument is passed invalid data. | - | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | The \a policy is set for all instances of QDomDocument which already | - | ||||||||||||||||||||||||
| 1123 | exist and which will be created in the future. | - | ||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||
| 1125 | \snippet code/src_xml_dom_qdom.cpp 0 | - | ||||||||||||||||||||||||
| 1126 | - | |||||||||||||||||||||||||
| 1127 | \sa invalidDataPolicy(), InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1128 | */ | - | ||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||
| 1130 | void QDomImplementation::setInvalidDataPolicy(InvalidDataPolicy policy) | - | ||||||||||||||||||||||||
| 1131 | { | - | ||||||||||||||||||||||||
| 1132 | QDomImplementationPrivate::invalidDataPolicy = policy; | - | ||||||||||||||||||||||||
| 1133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | /************************************************************** | - | ||||||||||||||||||||||||
| 1136 | * | - | ||||||||||||||||||||||||
| 1137 | * QDomNodeListPrivate | - | ||||||||||||||||||||||||
| 1138 | * | - | ||||||||||||||||||||||||
| 1139 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl) : ref(1) | - | ||||||||||||||||||||||||
| 1142 | { | - | ||||||||||||||||||||||||
| 1143 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1144 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1145 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1146 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name) : | - | ||||||||||||||||||||||||
| 1150 | ref(1) | - | ||||||||||||||||||||||||
| 1151 | { | - | ||||||||||||||||||||||||
| 1152 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1153 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1154 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1155 | tagname = name; | - | ||||||||||||||||||||||||
| 1156 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1157 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||
| 1159 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName) : | - | ||||||||||||||||||||||||
| 1160 | ref(1) | - | ||||||||||||||||||||||||
| 1161 | { | - | ||||||||||||||||||||||||
| 1162 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1163 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1164 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1165 | tagname = localName; | - | ||||||||||||||||||||||||
| 1166 | nsURI = _nsURI; | - | ||||||||||||||||||||||||
| 1167 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | QDomNodeListPrivate::~QDomNodeListPrivate() | - | ||||||||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||||||||
| 1172 | if (node_impl && !node_impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1173 | delete node_impl; never executed: delete node_impl; | 0 | ||||||||||||||||||||||||
| 1174 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1175 | - | |||||||||||||||||||||||||
| 1176 | bool QDomNodeListPrivate::operator==(const QDomNodeListPrivate &other) const | - | ||||||||||||||||||||||||
| 1177 | { | - | ||||||||||||||||||||||||
| 1178 | return (node_impl == other.node_impl) && (tagname == other.tagname); never executed: return (node_impl == other.node_impl) && (tagname == other.tagname); | 0 | ||||||||||||||||||||||||
| 1179 | } | - | ||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | bool QDomNodeListPrivate::operator!=(const QDomNodeListPrivate &other) const | - | ||||||||||||||||||||||||
| 1182 | { | - | ||||||||||||||||||||||||
| 1183 | return (node_impl != other.node_impl) || (tagname != other.tagname); never executed: return (node_impl != other.node_impl) || (tagname != other.tagname); | 0 | ||||||||||||||||||||||||
| 1184 | } | - | ||||||||||||||||||||||||
| 1185 | - | |||||||||||||||||||||||||
| 1186 | void QDomNodeListPrivate::createList() | - | ||||||||||||||||||||||||
| 1187 | { | - | ||||||||||||||||||||||||
| 1188 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1189 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||
| 1191 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1192 | if (doc && timestamp != doc->nodeListTime)
| 0 | ||||||||||||||||||||||||
| 1193 | timestamp = doc->nodeListTime; never executed: timestamp = doc->nodeListTime; | 0 | ||||||||||||||||||||||||
| 1194 | - | |||||||||||||||||||||||||
| 1195 | QDomNodePrivate* p = node_impl->first; | - | ||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||
| 1197 | list.clear(); | - | ||||||||||||||||||||||||
| 1198 | if (tagname.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1199 | while (p) {
| 0 | ||||||||||||||||||||||||
| 1200 | list.append(p); | - | ||||||||||||||||||||||||
| 1201 | p = p->next; | - | ||||||||||||||||||||||||
| 1202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1203 | } else if (nsURI.isNull()) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1204 | while (p && p != node_impl) {
| 0 | ||||||||||||||||||||||||
| 1205 | if (p->isElement() && p->nodeName() == tagname) {
| 0 | ||||||||||||||||||||||||
| 1206 | list.append(p); | - | ||||||||||||||||||||||||
| 1207 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1208 | if (p->first)
| 0 | ||||||||||||||||||||||||
| 1209 | p = p->first; never executed: p = p->first; | 0 | ||||||||||||||||||||||||
| 1210 | else if (p->next)
| 0 | ||||||||||||||||||||||||
| 1211 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1212 | else { | - | ||||||||||||||||||||||||
| 1213 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1214 | while (p && p != node_impl && !p->next)
| 0 | ||||||||||||||||||||||||
| 1215 | p = p->parent(); never executed: p = p->parent(); | 0 | ||||||||||||||||||||||||
| 1216 | if (p && p != node_impl)
| 0 | ||||||||||||||||||||||||
| 1217 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1219 | } | - | ||||||||||||||||||||||||
| 1220 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1221 | while (p && p != node_impl) {
| 0 | ||||||||||||||||||||||||
| 1222 | if (p->isElement() && p->name==tagname && p->namespaceURI==nsURI) {
| 0 | ||||||||||||||||||||||||
| 1223 | list.append(p); | - | ||||||||||||||||||||||||
| 1224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1225 | if (p->first)
| 0 | ||||||||||||||||||||||||
| 1226 | p = p->first; never executed: p = p->first; | 0 | ||||||||||||||||||||||||
| 1227 | else if (p->next)
| 0 | ||||||||||||||||||||||||
| 1228 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1229 | else { | - | ||||||||||||||||||||||||
| 1230 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1231 | while (p && p != node_impl && !p->next)
| 0 | ||||||||||||||||||||||||
| 1232 | p = p->parent(); never executed: p = p->parent(); | 0 | ||||||||||||||||||||||||
| 1233 | if (p && p != node_impl)
| 0 | ||||||||||||||||||||||||
| 1234 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1235 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1236 | } | - | ||||||||||||||||||||||||
| 1237 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1238 | } | - | ||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||
| 1240 | QDomNodePrivate* QDomNodeListPrivate::item(int index) | - | ||||||||||||||||||||||||
| 1241 | { | - | ||||||||||||||||||||||||
| 1242 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1243 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1244 | - | |||||||||||||||||||||||||
| 1245 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1246 | if (!doc || timestamp != doc->nodeListTime)
| 0 | ||||||||||||||||||||||||
| 1247 | createList(); never executed: createList(); | 0 | ||||||||||||||||||||||||
| 1248 | - | |||||||||||||||||||||||||
| 1249 | if (index >= list.size())
| 0 | ||||||||||||||||||||||||
| 1250 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||
| 1252 | return list.at(index); never executed: return list.at(index); | 0 | ||||||||||||||||||||||||
| 1253 | } | - | ||||||||||||||||||||||||
| 1254 | - | |||||||||||||||||||||||||
| 1255 | int QDomNodeListPrivate::length() const | - | ||||||||||||||||||||||||
| 1256 | { | - | ||||||||||||||||||||||||
| 1257 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1258 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1261 | if (!doc || timestamp != doc->nodeListTime) {
| 0 | ||||||||||||||||||||||||
| 1262 | QDomNodeListPrivate *that = const_cast<QDomNodeListPrivate *>(this); | - | ||||||||||||||||||||||||
| 1263 | that->createList(); | - | ||||||||||||||||||||||||
| 1264 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||
| 1266 | return list.count(); never executed: return list.count(); | 0 | ||||||||||||||||||||||||
| 1267 | } | - | ||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||
| 1269 | /************************************************************** | - | ||||||||||||||||||||||||
| 1270 | * | - | ||||||||||||||||||||||||
| 1271 | * QDomNodeList | - | ||||||||||||||||||||||||
| 1272 | * | - | ||||||||||||||||||||||||
| 1273 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1274 | - | |||||||||||||||||||||||||
| 1275 | /*! | - | ||||||||||||||||||||||||
| 1276 | \class QDomNodeList | - | ||||||||||||||||||||||||
| 1277 | \reentrant | - | ||||||||||||||||||||||||
| 1278 | \brief The QDomNodeList class is a list of QDomNode objects. | - | ||||||||||||||||||||||||
| 1279 | - | |||||||||||||||||||||||||
| 1280 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 1281 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||
| 1283 | Lists can be obtained by QDomDocument::elementsByTagName() and | - | ||||||||||||||||||||||||
| 1284 | QDomNode::childNodes(). The Document Object Model (DOM) requires | - | ||||||||||||||||||||||||
| 1285 | these lists to be "live": whenever you change the underlying | - | ||||||||||||||||||||||||
| 1286 | document, the contents of the list will get updated. | - | ||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||
| 1288 | You can get a particular node from the list with item(). The | - | ||||||||||||||||||||||||
| 1289 | number of items in the list is returned by length(). | - | ||||||||||||||||||||||||
| 1290 | - | |||||||||||||||||||||||||
| 1291 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 1292 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 1293 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 1294 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 1295 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 1296 | - | |||||||||||||||||||||||||
| 1297 | \sa QDomNode::childNodes(), QDomDocument::elementsByTagName() | - | ||||||||||||||||||||||||
| 1298 | */ | - | ||||||||||||||||||||||||
| 1299 | - | |||||||||||||||||||||||||
| 1300 | /*! | - | ||||||||||||||||||||||||
| 1301 | Creates an empty node list. | - | ||||||||||||||||||||||||
| 1302 | */ | - | ||||||||||||||||||||||||
| 1303 | QDomNodeList::QDomNodeList() | - | ||||||||||||||||||||||||
| 1304 | { | - | ||||||||||||||||||||||||
| 1305 | impl = 0; | - | ||||||||||||||||||||||||
| 1306 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1307 | - | |||||||||||||||||||||||||
| 1308 | QDomNodeList::QDomNodeList(QDomNodeListPrivate* p) | - | ||||||||||||||||||||||||
| 1309 | { | - | ||||||||||||||||||||||||
| 1310 | impl = p; | - | ||||||||||||||||||||||||
| 1311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1312 | - | |||||||||||||||||||||||||
| 1313 | /*! | - | ||||||||||||||||||||||||
| 1314 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 1315 | */ | - | ||||||||||||||||||||||||
| 1316 | QDomNodeList::QDomNodeList(const QDomNodeList& n) | - | ||||||||||||||||||||||||
| 1317 | { | - | ||||||||||||||||||||||||
| 1318 | impl = n.impl; | - | ||||||||||||||||||||||||
| 1319 | if (impl)
| 0 | ||||||||||||||||||||||||
| 1320 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1321 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1322 | - | |||||||||||||||||||||||||
| 1323 | /*! | - | ||||||||||||||||||||||||
| 1324 | Assigns \a n to this node list. | - | ||||||||||||||||||||||||
| 1325 | */ | - | ||||||||||||||||||||||||
| 1326 | QDomNodeList& QDomNodeList::operator=(const QDomNodeList &n) | - | ||||||||||||||||||||||||
| 1327 | { | - | ||||||||||||||||||||||||
| 1328 | if (n.impl)
| 0 | ||||||||||||||||||||||||
| 1329 | n.impl->ref.ref(); never executed: n.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1330 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1331 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 1332 | impl = n.impl; | - | ||||||||||||||||||||||||
| 1333 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 1334 | } | - | ||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||
| 1336 | /*! | - | ||||||||||||||||||||||||
| 1337 | Returns \c true if the node list \a n and this node list are equal; | - | ||||||||||||||||||||||||
| 1338 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1339 | */ | - | ||||||||||||||||||||||||
| 1340 | bool QDomNodeList::operator==(const QDomNodeList &n) const | - | ||||||||||||||||||||||||
| 1341 | { | - | ||||||||||||||||||||||||
| 1342 | if (impl == n.impl)
| 0 | ||||||||||||||||||||||||
| 1343 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1344 | if (!impl || !n.impl)
| 0 | ||||||||||||||||||||||||
| 1345 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1346 | return (*impl == *n.impl); never executed: return (*impl == *n.impl); | 0 | ||||||||||||||||||||||||
| 1347 | } | - | ||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||
| 1349 | /*! | - | ||||||||||||||||||||||||
| 1350 | Returns \c true the node list \a n and this node list are not equal; | - | ||||||||||||||||||||||||
| 1351 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1352 | */ | - | ||||||||||||||||||||||||
| 1353 | bool QDomNodeList::operator!=(const QDomNodeList &n) const | - | ||||||||||||||||||||||||
| 1354 | { | - | ||||||||||||||||||||||||
| 1355 | return !operator==(n); never executed: return !operator==(n); | 0 | ||||||||||||||||||||||||
| 1356 | } | - | ||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||
| 1358 | /*! | - | ||||||||||||||||||||||||
| 1359 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 1360 | */ | - | ||||||||||||||||||||||||
| 1361 | QDomNodeList::~QDomNodeList() | - | ||||||||||||||||||||||||
| 1362 | { | - | ||||||||||||||||||||||||
| 1363 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1364 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 1365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||
| 1367 | /*! | - | ||||||||||||||||||||||||
| 1368 | Returns the node at position \a index. | - | ||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||
| 1370 | If \a index is negative or if \a index >= length() then a null | - | ||||||||||||||||||||||||
| 1371 | node is returned (i.e. a node for which QDomNode::isNull() returns | - | ||||||||||||||||||||||||
| 1372 | true). | - | ||||||||||||||||||||||||
| 1373 | - | |||||||||||||||||||||||||
| 1374 | \sa length() | - | ||||||||||||||||||||||||
| 1375 | */ | - | ||||||||||||||||||||||||
| 1376 | QDomNode QDomNodeList::item(int index) const | - | ||||||||||||||||||||||||
| 1377 | { | - | ||||||||||||||||||||||||
| 1378 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 1379 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||
| 1381 | return QDomNode(impl->item(index)); never executed: return QDomNode(impl->item(index)); | 0 | ||||||||||||||||||||||||
| 1382 | } | - | ||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||
| 1384 | /*! | - | ||||||||||||||||||||||||
| 1385 | Returns the number of nodes in the list. | - | ||||||||||||||||||||||||
| 1386 | */ | - | ||||||||||||||||||||||||
| 1387 | int QDomNodeList::length() const | - | ||||||||||||||||||||||||
| 1388 | { | - | ||||||||||||||||||||||||
| 1389 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 1390 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1391 | return impl->length(); never executed: return impl->length(); | 0 | ||||||||||||||||||||||||
| 1392 | } | - | ||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||
| 1394 | /*! | - | ||||||||||||||||||||||||
| 1395 | \fn bool QDomNodeList::isEmpty() const | - | ||||||||||||||||||||||||
| 1396 | - | |||||||||||||||||||||||||
| 1397 | Returns \c true if the list contains no items; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1398 | This function is provided for Qt API consistency. | - | ||||||||||||||||||||||||
| 1399 | */ | - | ||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||
| 1401 | /*! | - | ||||||||||||||||||||||||
| 1402 | \fn int QDomNodeList::count() const | - | ||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||
| 1404 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 1405 | */ | - | ||||||||||||||||||||||||
| 1406 | - | |||||||||||||||||||||||||
| 1407 | /*! | - | ||||||||||||||||||||||||
| 1408 | \fn int QDomNodeList::size() const | - | ||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||
| 1410 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 1411 | */ | - | ||||||||||||||||||||||||
| 1412 | - | |||||||||||||||||||||||||
| 1413 | /*! | - | ||||||||||||||||||||||||
| 1414 | \fn QDomNode QDomNodeList::at(int index) const | - | ||||||||||||||||||||||||
| 1415 | - | |||||||||||||||||||||||||
| 1416 | This function is provided for Qt API consistency. It is equivalent | - | ||||||||||||||||||||||||
| 1417 | to item(). | - | ||||||||||||||||||||||||
| 1418 | - | |||||||||||||||||||||||||
| 1419 | If \a index is negative or if \a index >= length() then a null | - | ||||||||||||||||||||||||
| 1420 | node is returned (i.e. a node for which QDomNode::isNull() returns | - | ||||||||||||||||||||||||
| 1421 | true). | - | ||||||||||||||||||||||||
| 1422 | */ | - | ||||||||||||||||||||||||
| 1423 | - | |||||||||||||||||||||||||
| 1424 | /************************************************************** | - | ||||||||||||||||||||||||
| 1425 | * | - | ||||||||||||||||||||||||
| 1426 | * QDomNodePrivate | - | ||||||||||||||||||||||||
| 1427 | * | - | ||||||||||||||||||||||||
| 1428 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||
| 1430 | inline void QDomNodePrivate::setOwnerDocument(QDomDocumentPrivate *doc) | - | ||||||||||||||||||||||||
| 1431 | { | - | ||||||||||||||||||||||||
| 1432 | ownerNode = doc; | - | ||||||||||||||||||||||||
| 1433 | hasParent = false; | - | ||||||||||||||||||||||||
| 1434 | } executed 1392 times by 5 tests: end of blockExecuted by:
| 1392 | ||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||
| 1436 | QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par) : ref(1) | - | ||||||||||||||||||||||||
| 1437 | { | - | ||||||||||||||||||||||||
| 1438 | if (par)
| 1392-2223 | ||||||||||||||||||||||||
| 1439 | setParent(par); executed 2223 times by 5 tests: setParent(par);Executed by:
| 2223 | ||||||||||||||||||||||||
| 1440 | else | - | ||||||||||||||||||||||||
| 1441 | setOwnerDocument(doc); executed 1392 times by 5 tests: setOwnerDocument(doc);Executed by:
| 1392 | ||||||||||||||||||||||||
| 1442 | prev = 0; | - | ||||||||||||||||||||||||
| 1443 | next = 0; | - | ||||||||||||||||||||||||
| 1444 | first = 0; | - | ||||||||||||||||||||||||
| 1445 | last = 0; | - | ||||||||||||||||||||||||
| 1446 | createdWithDom1Interface = true; | - | ||||||||||||||||||||||||
| 1447 | lineNumber = -1; | - | ||||||||||||||||||||||||
| 1448 | columnNumber = -1; | - | ||||||||||||||||||||||||
| 1449 | } executed 3615 times by 5 tests: end of blockExecuted by:
| 3615 | ||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||
| 1451 | QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep) : ref(1) | - | ||||||||||||||||||||||||
| 1452 | { | - | ||||||||||||||||||||||||
| 1453 | setOwnerDocument(n->ownerDocument()); | - | ||||||||||||||||||||||||
| 1454 | prev = 0; | - | ||||||||||||||||||||||||
| 1455 | next = 0; | - | ||||||||||||||||||||||||
| 1456 | first = 0; | - | ||||||||||||||||||||||||
| 1457 | last = 0; | - | ||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||
| 1459 | name = n->name; | - | ||||||||||||||||||||||||
| 1460 | value = n->value; | - | ||||||||||||||||||||||||
| 1461 | prefix = n->prefix; | - | ||||||||||||||||||||||||
| 1462 | namespaceURI = n->namespaceURI; | - | ||||||||||||||||||||||||
| 1463 | createdWithDom1Interface = n->createdWithDom1Interface; | - | ||||||||||||||||||||||||
| 1464 | lineNumber = -1; | - | ||||||||||||||||||||||||
| 1465 | columnNumber = -1; | - | ||||||||||||||||||||||||
| 1466 | - | |||||||||||||||||||||||||
| 1467 | if (!deep)
| 0 | ||||||||||||||||||||||||
| 1468 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1469 | - | |||||||||||||||||||||||||
| 1470 | for (QDomNodePrivate* x = n->first; x; x = x->next)
| 0 | ||||||||||||||||||||||||
| 1471 | appendChild(x->cloneNode(true)); never executed: appendChild(x->cloneNode(true)); | 0 | ||||||||||||||||||||||||
| 1472 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1473 | - | |||||||||||||||||||||||||
| 1474 | QDomNodePrivate::~QDomNodePrivate() | - | ||||||||||||||||||||||||
| 1475 | { | - | ||||||||||||||||||||||||
| 1476 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1477 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||
| 1479 | while (p) {
| 2015-3615 | ||||||||||||||||||||||||
| 1480 | n = p->next; | - | ||||||||||||||||||||||||
| 1481 | if (!p->ref.deref())
| 0-2015 | ||||||||||||||||||||||||
| 1482 | delete p; executed 2015 times by 5 tests: delete p;Executed by:
| 2015 | ||||||||||||||||||||||||
| 1483 | else | - | ||||||||||||||||||||||||
| 1484 | p->setNoParent(); never executed: p->setNoParent(); | 0 | ||||||||||||||||||||||||
| 1485 | p = n; | - | ||||||||||||||||||||||||
| 1486 | } executed 2015 times by 5 tests: end of blockExecuted by:
| 2015 | ||||||||||||||||||||||||
| 1487 | first = 0; | - | ||||||||||||||||||||||||
| 1488 | last = 0; | - | ||||||||||||||||||||||||
| 1489 | } executed 3615 times by 5 tests: end of blockExecuted by:
| 3615 | ||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||
| 1491 | void QDomNodePrivate::clear() | - | ||||||||||||||||||||||||
| 1492 | { | - | ||||||||||||||||||||||||
| 1493 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1494 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||
| 1496 | while (p) {
| 0-244 | ||||||||||||||||||||||||
| 1497 | n = p->next; | - | ||||||||||||||||||||||||
| 1498 | if (!p->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1499 | delete p; never executed: delete p; | 0 | ||||||||||||||||||||||||
| 1500 | p = n; | - | ||||||||||||||||||||||||
| 1501 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1502 | first = 0; | - | ||||||||||||||||||||||||
| 1503 | last = 0; | - | ||||||||||||||||||||||||
| 1504 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||
| 1506 | QDomNodePrivate* QDomNodePrivate::namedItem(const QString &n) | - | ||||||||||||||||||||||||
| 1507 | { | - | ||||||||||||||||||||||||
| 1508 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1509 | while (p) {
| 0-51 | ||||||||||||||||||||||||
| 1510 | if (p->nodeName() == n)
| 2-49 | ||||||||||||||||||||||||
| 1511 | return p; executed 49 times by 1 test: return p;Executed by:
| 49 | ||||||||||||||||||||||||
| 1512 | p = p->next; | - | ||||||||||||||||||||||||
| 1513 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1514 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1515 | } | - | ||||||||||||||||||||||||
| 1516 | - | |||||||||||||||||||||||||
| 1517 | - | |||||||||||||||||||||||||
| 1518 | QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 1519 | { | - | ||||||||||||||||||||||||
| 1520 | // Error check | - | ||||||||||||||||||||||||
| 1521 | if (!newChild)
| 0 | ||||||||||||||||||||||||
| 1522 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||
| 1524 | // Error check | - | ||||||||||||||||||||||||
| 1525 | if (newChild == refChild)
| 0 | ||||||||||||||||||||||||
| 1526 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||
| 1528 | // Error check | - | ||||||||||||||||||||||||
| 1529 | if (refChild && refChild->parent() != this)
| 0 | ||||||||||||||||||||||||
| 1530 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||
| 1532 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1533 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1534 | if(doc)
| 0 | ||||||||||||||||||||||||
| 1535 | doc->nodeListTime++; never executed: doc->nodeListTime++; | 0 | ||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||
| 1537 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1538 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1539 | if (newChild->isDocumentFragment()) {
| 0 | ||||||||||||||||||||||||
| 1540 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1541 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1542 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||
| 1544 | // New parent | - | ||||||||||||||||||||||||
| 1545 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1546 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1547 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1548 | n = n->next; | - | ||||||||||||||||||||||||
| 1549 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||
| 1551 | // Insert at the beginning ? | - | ||||||||||||||||||||||||
| 1552 | if (!refChild || refChild->prev == 0) {
| 0 | ||||||||||||||||||||||||
| 1553 | if (first)
| 0 | ||||||||||||||||||||||||
| 1554 | first->prev = newChild->last; never executed: first->prev = newChild->last; | 0 | ||||||||||||||||||||||||
| 1555 | newChild->last->next = first; | - | ||||||||||||||||||||||||
| 1556 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1557 | last = newChild->last; never executed: last = newChild->last; | 0 | ||||||||||||||||||||||||
| 1558 | first = newChild->first; | - | ||||||||||||||||||||||||
| 1559 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1560 | // Insert in the middle | - | ||||||||||||||||||||||||
| 1561 | newChild->last->next = refChild; | - | ||||||||||||||||||||||||
| 1562 | newChild->first->prev = refChild->prev; | - | ||||||||||||||||||||||||
| 1563 | refChild->prev->next = newChild->first; | - | ||||||||||||||||||||||||
| 1564 | refChild->prev = newChild->last; | - | ||||||||||||||||||||||||
| 1565 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||
| 1567 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1568 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||
| 1570 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1571 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1572 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1573 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1574 | } | - | ||||||||||||||||||||||||
| 1575 | - | |||||||||||||||||||||||||
| 1576 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1577 | // ownership of the node. | - | ||||||||||||||||||||||||
| 1578 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1579 | - | |||||||||||||||||||||||||
| 1580 | if (newChild->parent())
| 0 | ||||||||||||||||||||||||
| 1581 | newChild->parent()->removeChild(newChild); never executed: newChild->parent()->removeChild(newChild); | 0 | ||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||
| 1583 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||
| 1585 | if (!refChild) {
| 0 | ||||||||||||||||||||||||
| 1586 | if (first)
| 0 | ||||||||||||||||||||||||
| 1587 | first->prev = newChild; never executed: first->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1588 | newChild->next = first; | - | ||||||||||||||||||||||||
| 1589 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1590 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1591 | first = newChild; | - | ||||||||||||||||||||||||
| 1592 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1593 | } | - | ||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||
| 1595 | if (refChild->prev == 0) {
| 0 | ||||||||||||||||||||||||
| 1596 | if (first)
| 0 | ||||||||||||||||||||||||
| 1597 | first->prev = newChild; never executed: first->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1598 | newChild->next = first; | - | ||||||||||||||||||||||||
| 1599 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1600 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1601 | first = newChild; | - | ||||||||||||||||||||||||
| 1602 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1603 | } | - | ||||||||||||||||||||||||
| 1604 | - | |||||||||||||||||||||||||
| 1605 | newChild->next = refChild; | - | ||||||||||||||||||||||||
| 1606 | newChild->prev = refChild->prev; | - | ||||||||||||||||||||||||
| 1607 | refChild->prev->next = newChild; | - | ||||||||||||||||||||||||
| 1608 | refChild->prev = newChild; | - | ||||||||||||||||||||||||
| 1609 | - | |||||||||||||||||||||||||
| 1610 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1611 | } | - | ||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||
| 1613 | QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 1614 | { | - | ||||||||||||||||||||||||
| 1615 | // Error check | - | ||||||||||||||||||||||||
| 1616 | if (!newChild)
| 0-2016 | ||||||||||||||||||||||||
| 1617 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||
| 1619 | // Error check | - | ||||||||||||||||||||||||
| 1620 | if (newChild == refChild)
| 0-2016 | ||||||||||||||||||||||||
| 1621 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1622 | - | |||||||||||||||||||||||||
| 1623 | // Error check | - | ||||||||||||||||||||||||
| 1624 | if (refChild && refChild->parent() != this)
| 0-2016 | ||||||||||||||||||||||||
| 1625 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1626 | - | |||||||||||||||||||||||||
| 1627 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1628 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1629 | if(doc)
| 0-2016 | ||||||||||||||||||||||||
| 1630 | doc->nodeListTime++; executed 2016 times by 5 tests: doc->nodeListTime++;Executed by:
| 2016 | ||||||||||||||||||||||||
| 1631 | - | |||||||||||||||||||||||||
| 1632 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1633 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1634 | if (newChild->isDocumentFragment()) {
| 0-2016 | ||||||||||||||||||||||||
| 1635 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1636 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1637 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1638 | - | |||||||||||||||||||||||||
| 1639 | // New parent | - | ||||||||||||||||||||||||
| 1640 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1641 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1642 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1643 | n = n->next; | - | ||||||||||||||||||||||||
| 1644 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1645 | - | |||||||||||||||||||||||||
| 1646 | // Insert at the end | - | ||||||||||||||||||||||||
| 1647 | if (!refChild || refChild->next == 0) {
| 0 | ||||||||||||||||||||||||
| 1648 | if (last)
| 0 | ||||||||||||||||||||||||
| 1649 | last->next = newChild->first; never executed: last->next = newChild->first; | 0 | ||||||||||||||||||||||||
| 1650 | newChild->first->prev = last; | - | ||||||||||||||||||||||||
| 1651 | if (!first)
| 0 | ||||||||||||||||||||||||
| 1652 | first = newChild->first; never executed: first = newChild->first; | 0 | ||||||||||||||||||||||||
| 1653 | last = newChild->last; | - | ||||||||||||||||||||||||
| 1654 | } else { // Insert in the middle never executed: end of block | 0 | ||||||||||||||||||||||||
| 1655 | newChild->first->prev = refChild; | - | ||||||||||||||||||||||||
| 1656 | newChild->last->next = refChild->next; | - | ||||||||||||||||||||||||
| 1657 | refChild->next->prev = newChild->last; | - | ||||||||||||||||||||||||
| 1658 | refChild->next = newChild->first; | - | ||||||||||||||||||||||||
| 1659 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||
| 1661 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1662 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||
| 1664 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1665 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1666 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1667 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1668 | } | - | ||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||
| 1670 | // Release new node from its current parent | - | ||||||||||||||||||||||||
| 1671 | if (newChild->parent())
| 868-1148 | ||||||||||||||||||||||||
| 1672 | newChild->parent()->removeChild(newChild); executed 868 times by 4 tests: newChild->parent()->removeChild(newChild);Executed by:
| 868 | ||||||||||||||||||||||||
| 1673 | - | |||||||||||||||||||||||||
| 1674 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1675 | // ownership of the node | - | ||||||||||||||||||||||||
| 1676 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1679 | - | |||||||||||||||||||||||||
| 1680 | // Insert at the end | - | ||||||||||||||||||||||||
| 1681 | if (!refChild) {
| 0-2016 | ||||||||||||||||||||||||
| 1682 | if (last)
| 267-1749 | ||||||||||||||||||||||||
| 1683 | last->next = newChild; executed 267 times by 4 tests: last->next = newChild;Executed by:
| 267 | ||||||||||||||||||||||||
| 1684 | newChild->prev = last; | - | ||||||||||||||||||||||||
| 1685 | if (!first)
| 267-1749 | ||||||||||||||||||||||||
| 1686 | first = newChild; executed 1749 times by 5 tests: first = newChild;Executed by:
| 1749 | ||||||||||||||||||||||||
| 1687 | last = newChild; | - | ||||||||||||||||||||||||
| 1688 | return newChild; executed 2016 times by 5 tests: return newChild;Executed by:
| 2016 | ||||||||||||||||||||||||
| 1689 | } | - | ||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||
| 1691 | if (refChild->next == 0) {
| 0 | ||||||||||||||||||||||||
| 1692 | if (last)
| 0 | ||||||||||||||||||||||||
| 1693 | last->next = newChild; never executed: last->next = newChild; | 0 | ||||||||||||||||||||||||
| 1694 | newChild->prev = last; | - | ||||||||||||||||||||||||
| 1695 | if (!first)
| 0 | ||||||||||||||||||||||||
| 1696 | first = newChild; never executed: first = newChild; | 0 | ||||||||||||||||||||||||
| 1697 | last = newChild; | - | ||||||||||||||||||||||||
| 1698 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1699 | } | - | ||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||
| 1701 | newChild->prev = refChild; | - | ||||||||||||||||||||||||
| 1702 | newChild->next = refChild->next; | - | ||||||||||||||||||||||||
| 1703 | refChild->next->prev = newChild; | - | ||||||||||||||||||||||||
| 1704 | refChild->next = newChild; | - | ||||||||||||||||||||||||
| 1705 | - | |||||||||||||||||||||||||
| 1706 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1707 | } | - | ||||||||||||||||||||||||
| 1708 | - | |||||||||||||||||||||||||
| 1709 | QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 1710 | { | - | ||||||||||||||||||||||||
| 1711 | if (!newChild || !oldChild)
| 0 | ||||||||||||||||||||||||
| 1712 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1713 | if (oldChild->parent() != this)
| 0 | ||||||||||||||||||||||||
| 1714 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1715 | if (newChild == oldChild)
| 0 | ||||||||||||||||||||||||
| 1716 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1717 | - | |||||||||||||||||||||||||
| 1718 | // mark lists as dirty | - | ||||||||||||||||||||||||
| 1719 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1720 | if(doc)
| 0 | ||||||||||||||||||||||||
| 1721 | doc->nodeListTime++; never executed: doc->nodeListTime++; | 0 | ||||||||||||||||||||||||
| 1722 | - | |||||||||||||||||||||||||
| 1723 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1724 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1725 | if (newChild->isDocumentFragment()) {
| 0 | ||||||||||||||||||||||||
| 1726 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1727 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1728 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1729 | - | |||||||||||||||||||||||||
| 1730 | // New parent | - | ||||||||||||||||||||||||
| 1731 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1732 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1733 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1734 | n = n->next; | - | ||||||||||||||||||||||||
| 1735 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1736 | - | |||||||||||||||||||||||||
| 1737 | - | |||||||||||||||||||||||||
| 1738 | if (oldChild->next)
| 0 | ||||||||||||||||||||||||
| 1739 | oldChild->next->prev = newChild->last; never executed: oldChild->next->prev = newChild->last; | 0 | ||||||||||||||||||||||||
| 1740 | if (oldChild->prev)
| 0 | ||||||||||||||||||||||||
| 1741 | oldChild->prev->next = newChild->first; never executed: oldChild->prev->next = newChild->first; | 0 | ||||||||||||||||||||||||
| 1742 | - | |||||||||||||||||||||||||
| 1743 | newChild->last->next = oldChild->next; | - | ||||||||||||||||||||||||
| 1744 | newChild->first->prev = oldChild->prev; | - | ||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||
| 1746 | if (first == oldChild)
| 0 | ||||||||||||||||||||||||
| 1747 | first = newChild->first; never executed: first = newChild->first; | 0 | ||||||||||||||||||||||||
| 1748 | if (last == oldChild)
| 0 | ||||||||||||||||||||||||
| 1749 | last = newChild->last; never executed: last = newChild->last; | 0 | ||||||||||||||||||||||||
| 1750 | - | |||||||||||||||||||||||||
| 1751 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1752 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1753 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||
| 1755 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1756 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||
| 1758 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1759 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1760 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1761 | - | |||||||||||||||||||||||||
| 1762 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1763 | if (oldChild)
| 0 | ||||||||||||||||||||||||
| 1764 | oldChild->ref.deref(); never executed: oldChild->ref.deref(); | 0 | ||||||||||||||||||||||||
| 1765 | - | |||||||||||||||||||||||||
| 1766 | return oldChild; never executed: return oldChild; | 0 | ||||||||||||||||||||||||
| 1767 | } | - | ||||||||||||||||||||||||
| 1768 | - | |||||||||||||||||||||||||
| 1769 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1770 | // ownership of the node | - | ||||||||||||||||||||||||
| 1771 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||
| 1773 | // Release new node from its current parent | - | ||||||||||||||||||||||||
| 1774 | if (newChild->parent())
| 0 | ||||||||||||||||||||||||
| 1775 | newChild->parent()->removeChild(newChild); never executed: newChild->parent()->removeChild(newChild); | 0 | ||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||
| 1777 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1778 | - | |||||||||||||||||||||||||
| 1779 | if (oldChild->next)
| 0 | ||||||||||||||||||||||||
| 1780 | oldChild->next->prev = newChild; never executed: oldChild->next->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1781 | if (oldChild->prev)
| 0 | ||||||||||||||||||||||||
| 1782 | oldChild->prev->next = newChild; never executed: oldChild->prev->next = newChild; | 0 | ||||||||||||||||||||||||
| 1783 | - | |||||||||||||||||||||||||
| 1784 | newChild->next = oldChild->next; | - | ||||||||||||||||||||||||
| 1785 | newChild->prev = oldChild->prev; | - | ||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||
| 1787 | if (first == oldChild)
| 0 | ||||||||||||||||||||||||
| 1788 | first = newChild; never executed: first = newChild; | 0 | ||||||||||||||||||||||||
| 1789 | if (last == oldChild)
| 0 | ||||||||||||||||||||||||
| 1790 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1791 | - | |||||||||||||||||||||||||
| 1792 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1793 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1794 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1795 | - | |||||||||||||||||||||||||
| 1796 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1797 | if (oldChild)
| 0 | ||||||||||||||||||||||||
| 1798 | oldChild->ref.deref(); never executed: oldChild->ref.deref(); | 0 | ||||||||||||||||||||||||
| 1799 | - | |||||||||||||||||||||||||
| 1800 | return oldChild; never executed: return oldChild; | 0 | ||||||||||||||||||||||||
| 1801 | } | - | ||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||
| 1803 | QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 1804 | { | - | ||||||||||||||||||||||||
| 1805 | // Error check | - | ||||||||||||||||||||||||
| 1806 | if (oldChild->parent() != this)
| 0-869 | ||||||||||||||||||||||||
| 1807 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||
| 1809 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1810 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1811 | if(doc)
| 0-869 | ||||||||||||||||||||||||
| 1812 | doc->nodeListTime++; executed 869 times by 4 tests: doc->nodeListTime++;Executed by:
| 869 | ||||||||||||||||||||||||
| 1813 | - | |||||||||||||||||||||||||
| 1814 | // Perhaps oldChild was just created with "createElement" or that. In this case | - | ||||||||||||||||||||||||
| 1815 | // its parent is QDomDocument but it is not part of the documents child list. | - | ||||||||||||||||||||||||
| 1816 | if (oldChild->next == 0 && oldChild->prev == 0 && first != oldChild)
| 0-869 | ||||||||||||||||||||||||
| 1817 | return 0; executed 868 times by 4 tests: return 0;Executed by:
| 868 | ||||||||||||||||||||||||
| 1818 | - | |||||||||||||||||||||||||
| 1819 | if (oldChild->next)
| 0-1 | ||||||||||||||||||||||||
| 1820 | oldChild->next->prev = oldChild->prev; never executed: oldChild->next->prev = oldChild->prev; | 0 | ||||||||||||||||||||||||
| 1821 | if (oldChild->prev)
| 0-1 | ||||||||||||||||||||||||
| 1822 | oldChild->prev->next = oldChild->next; never executed: oldChild->prev->next = oldChild->next; | 0 | ||||||||||||||||||||||||
| 1823 | - | |||||||||||||||||||||||||
| 1824 | if (last == oldChild)
| 0-1 | ||||||||||||||||||||||||
| 1825 | last = oldChild->prev; executed 1 time by 1 test: last = oldChild->prev;Executed by:
| 1 | ||||||||||||||||||||||||
| 1826 | if (first == oldChild)
| 0-1 | ||||||||||||||||||||||||
| 1827 | first = oldChild->next; executed 1 time by 1 test: first = oldChild->next;Executed by:
| 1 | ||||||||||||||||||||||||
| 1828 | - | |||||||||||||||||||||||||
| 1829 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1830 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1831 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1832 | - | |||||||||||||||||||||||||
| 1833 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1834 | oldChild->ref.deref(); | - | ||||||||||||||||||||||||
| 1835 | - | |||||||||||||||||||||||||
| 1836 | return oldChild; executed 1 time by 1 test: return oldChild;Executed by:
| 1 | ||||||||||||||||||||||||
| 1837 | } | - | ||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||
| 1839 | QDomNodePrivate* QDomNodePrivate::appendChild(QDomNodePrivate* newChild) | - | ||||||||||||||||||||||||
| 1840 | { | - | ||||||||||||||||||||||||
| 1841 | // No reference manipulation needed. Done in insertAfter. | - | ||||||||||||||||||||||||
| 1842 | return insertAfter(newChild, 0); executed 2016 times by 5 tests: return insertAfter(newChild, 0);Executed by:
| 2016 | ||||||||||||||||||||||||
| 1843 | } | - | ||||||||||||||||||||||||
| 1844 | - | |||||||||||||||||||||||||
| 1845 | QDomDocumentPrivate* QDomNodePrivate::ownerDocument() | - | ||||||||||||||||||||||||
| 1846 | { | - | ||||||||||||||||||||||||
| 1847 | QDomNodePrivate* p = this; | - | ||||||||||||||||||||||||
| 1848 | while (p && !p->isDocument()) {
| 0-14282 | ||||||||||||||||||||||||
| 1849 | if (!p->hasParent)
| 0-10529 | ||||||||||||||||||||||||
| 1850 | return (QDomDocumentPrivate*)p->ownerNode; never executed: return (QDomDocumentPrivate*)p->ownerNode; | 0 | ||||||||||||||||||||||||
| 1851 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1852 | } executed 10529 times by 5 tests: end of blockExecuted by:
| 10529 | ||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||
| 1854 | return static_cast<QDomDocumentPrivate *>(p); executed 3753 times by 5 tests: return static_cast<QDomDocumentPrivate *>(p);Executed by:
| 3753 | ||||||||||||||||||||||||
| 1855 | } | - | ||||||||||||||||||||||||
| 1856 | - | |||||||||||||||||||||||||
| 1857 | QDomNodePrivate* QDomNodePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 1858 | { | - | ||||||||||||||||||||||||
| 1859 | QDomNodePrivate* p = new QDomNodePrivate(this, deep); | - | ||||||||||||||||||||||||
| 1860 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 1861 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 1862 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 1863 | } | - | ||||||||||||||||||||||||
| 1864 | - | |||||||||||||||||||||||||
| 1865 | static void qNormalizeNode(QDomNodePrivate* n) | - | ||||||||||||||||||||||||
| 1866 | { | - | ||||||||||||||||||||||||
| 1867 | QDomNodePrivate* p = n->first; | - | ||||||||||||||||||||||||
| 1868 | QDomTextPrivate* t = 0; | - | ||||||||||||||||||||||||
| 1869 | - | |||||||||||||||||||||||||
| 1870 | while (p) {
| 0 | ||||||||||||||||||||||||
| 1871 | if (p->isText()) {
| 0 | ||||||||||||||||||||||||
| 1872 | if (t) {
| 0 | ||||||||||||||||||||||||
| 1873 | QDomNodePrivate* tmp = p->next; | - | ||||||||||||||||||||||||
| 1874 | t->appendData(p->nodeValue()); | - | ||||||||||||||||||||||||
| 1875 | n->removeChild(p); | - | ||||||||||||||||||||||||
| 1876 | p = tmp; | - | ||||||||||||||||||||||||
| 1877 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1878 | t = (QDomTextPrivate*)p; | - | ||||||||||||||||||||||||
| 1879 | p = p->next; | - | ||||||||||||||||||||||||
| 1880 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1881 | } else { | - | ||||||||||||||||||||||||
| 1882 | p = p->next; | - | ||||||||||||||||||||||||
| 1883 | t = 0; | - | ||||||||||||||||||||||||
| 1884 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1885 | } | - | ||||||||||||||||||||||||
| 1886 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1887 | void QDomNodePrivate::normalize() | - | ||||||||||||||||||||||||
| 1888 | { | - | ||||||||||||||||||||||||
| 1889 | // ### This one has moved from QDomElementPrivate to this position. It is | - | ||||||||||||||||||||||||
| 1890 | // not tested. | - | ||||||||||||||||||||||||
| 1891 | qNormalizeNode(this); | - | ||||||||||||||||||||||||
| 1892 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1893 | - | |||||||||||||||||||||||||
| 1894 | /*! \internal | - | ||||||||||||||||||||||||
| 1895 | \a depth is used for indentation, it seems. | - | ||||||||||||||||||||||||
| 1896 | */ | - | ||||||||||||||||||||||||
| 1897 | void QDomNodePrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 1898 | { | - | ||||||||||||||||||||||||
| 1899 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 1900 | while (n) {
| 94-160 | ||||||||||||||||||||||||
| 1901 | n->save(s, depth, indent); | - | ||||||||||||||||||||||||
| 1902 | n = n->next; | - | ||||||||||||||||||||||||
| 1903 | } executed 160 times by 1 test: end of blockExecuted by:
| 160 | ||||||||||||||||||||||||
| 1904 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 1905 | - | |||||||||||||||||||||||||
| 1906 | void QDomNodePrivate::setLocation(int lineNumber, int columnNumber) | - | ||||||||||||||||||||||||
| 1907 | { | - | ||||||||||||||||||||||||
| 1908 | this->lineNumber = lineNumber; | - | ||||||||||||||||||||||||
| 1909 | this->columnNumber = columnNumber; | - | ||||||||||||||||||||||||
| 1910 | } executed 1148 times by 5 tests: end of blockExecuted by:
| 1148 | ||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||
| 1912 | /************************************************************** | - | ||||||||||||||||||||||||
| 1913 | * | - | ||||||||||||||||||||||||
| 1914 | * QDomNode | - | ||||||||||||||||||||||||
| 1915 | * | - | ||||||||||||||||||||||||
| 1916 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1917 | - | |||||||||||||||||||||||||
| 1918 | #define IMPL ((QDomNodePrivate*)impl) | - | ||||||||||||||||||||||||
| 1919 | - | |||||||||||||||||||||||||
| 1920 | /*! | - | ||||||||||||||||||||||||
| 1921 | \class QDomNode | - | ||||||||||||||||||||||||
| 1922 | \reentrant | - | ||||||||||||||||||||||||
| 1923 | \brief The QDomNode class is the base class for all the nodes in a DOM tree. | - | ||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||
| 1925 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 1926 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||
| 1929 | Many functions in the DOM return a QDomNode. | - | ||||||||||||||||||||||||
| 1930 | - | |||||||||||||||||||||||||
| 1931 | You can find out the type of a node using isAttr(), | - | ||||||||||||||||||||||||
| 1932 | isCDATASection(), isDocumentFragment(), isDocument(), | - | ||||||||||||||||||||||||
| 1933 | isDocumentType(), isElement(), isEntityReference(), isText(), | - | ||||||||||||||||||||||||
| 1934 | isEntity(), isNotation(), isProcessingInstruction(), | - | ||||||||||||||||||||||||
| 1935 | isCharacterData() and isComment(). | - | ||||||||||||||||||||||||
| 1936 | - | |||||||||||||||||||||||||
| 1937 | A QDomNode can be converted into one of its subclasses using | - | ||||||||||||||||||||||||
| 1938 | toAttr(), toCDATASection(), toDocumentFragment(), toDocument(), | - | ||||||||||||||||||||||||
| 1939 | toDocumentType(), toElement(), toEntityReference(), toText(), | - | ||||||||||||||||||||||||
| 1940 | toEntity(), toNotation(), toProcessingInstruction(), | - | ||||||||||||||||||||||||
| 1941 | toCharacterData() or toComment(). You can convert a node to a null | - | ||||||||||||||||||||||||
| 1942 | node with clear(). | - | ||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||
| 1944 | Copies of the QDomNode class share their data using explicit | - | ||||||||||||||||||||||||
| 1945 | sharing. This means that modifying one node will change all | - | ||||||||||||||||||||||||
| 1946 | copies. This is especially useful in combination with functions | - | ||||||||||||||||||||||||
| 1947 | which return a QDomNode, e.g. firstChild(). You can make an | - | ||||||||||||||||||||||||
| 1948 | independent (deep) copy of the node with cloneNode(). | - | ||||||||||||||||||||||||
| 1949 | - | |||||||||||||||||||||||||
| 1950 | A QDomNode can be null, much like a null pointer. Creating a copy | - | ||||||||||||||||||||||||
| 1951 | of a null node results in another null node. It is not | - | ||||||||||||||||||||||||
| 1952 | possible to modify a null node, but it is possible to assign another, | - | ||||||||||||||||||||||||
| 1953 | possibly non-null node to it. In this case, the copy of the null node | - | ||||||||||||||||||||||||
| 1954 | will remain null. You can check if a QDomNode is null by calling isNull(). | - | ||||||||||||||||||||||||
| 1955 | The empty constructor of a QDomNode (or any of the derived classes) creates | - | ||||||||||||||||||||||||
| 1956 | a null node. | - | ||||||||||||||||||||||||
| 1957 | - | |||||||||||||||||||||||||
| 1958 | Nodes are inserted with insertBefore(), insertAfter() or | - | ||||||||||||||||||||||||
| 1959 | appendChild(). You can replace one node with another using | - | ||||||||||||||||||||||||
| 1960 | replaceChild() and remove a node with removeChild(). | - | ||||||||||||||||||||||||
| 1961 | - | |||||||||||||||||||||||||
| 1962 | To traverse nodes use firstChild() to get a node's first child (if | - | ||||||||||||||||||||||||
| 1963 | any), and nextSibling() to traverse. QDomNode also provides | - | ||||||||||||||||||||||||
| 1964 | lastChild(), previousSibling() and parentNode(). To find the first | - | ||||||||||||||||||||||||
| 1965 | child node with a particular node name use namedItem(). | - | ||||||||||||||||||||||||
| 1966 | - | |||||||||||||||||||||||||
| 1967 | To find out if a node has children use hasChildNodes() and to get | - | ||||||||||||||||||||||||
| 1968 | a list of all of a node's children use childNodes(). | - | ||||||||||||||||||||||||
| 1969 | - | |||||||||||||||||||||||||
| 1970 | The node's name and value (the meaning of which varies depending | - | ||||||||||||||||||||||||
| 1971 | on its type) is returned by nodeName() and nodeValue() | - | ||||||||||||||||||||||||
| 1972 | respectively. The node's type is returned by nodeType(). The | - | ||||||||||||||||||||||||
| 1973 | node's value can be set with setNodeValue(). | - | ||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||
| 1975 | The document to which the node belongs is returned by | - | ||||||||||||||||||||||||
| 1976 | ownerDocument(). | - | ||||||||||||||||||||||||
| 1977 | - | |||||||||||||||||||||||||
| 1978 | Adjacent QDomText nodes can be merged into a single node with | - | ||||||||||||||||||||||||
| 1979 | normalize(). | - | ||||||||||||||||||||||||
| 1980 | - | |||||||||||||||||||||||||
| 1981 | \l QDomElement nodes have attributes which can be retrieved with | - | ||||||||||||||||||||||||
| 1982 | attributes(). | - | ||||||||||||||||||||||||
| 1983 | - | |||||||||||||||||||||||||
| 1984 | QDomElement and QDomAttr nodes can have namespaces which can be | - | ||||||||||||||||||||||||
| 1985 | retrieved with namespaceURI(). Their local name is retrieved with | - | ||||||||||||||||||||||||
| 1986 | localName(), and their prefix with prefix(). The prefix can be set | - | ||||||||||||||||||||||||
| 1987 | with setPrefix(). | - | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | You can write the XML representation of the node to a text stream | - | ||||||||||||||||||||||||
| 1990 | with save(). | - | ||||||||||||||||||||||||
| 1991 | - | |||||||||||||||||||||||||
| 1992 | The following example looks for the first element in an XML document and | - | ||||||||||||||||||||||||
| 1993 | prints the names of all the elements that are its direct children. | - | ||||||||||||||||||||||||
| 1994 | - | |||||||||||||||||||||||||
| 1995 | \snippet code/src_xml_dom_qdom.cpp 1 | - | ||||||||||||||||||||||||
| 1996 | - | |||||||||||||||||||||||||
| 1997 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 1998 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 1999 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 2000 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 2001 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 2002 | */ | - | ||||||||||||||||||||||||
| 2003 | - | |||||||||||||||||||||||||
| 2004 | /*! | - | ||||||||||||||||||||||||
| 2005 | Constructs a \l{isNull()}{null} node. | - | ||||||||||||||||||||||||
| 2006 | */ | - | ||||||||||||||||||||||||
| 2007 | QDomNode::QDomNode() | - | ||||||||||||||||||||||||
| 2008 | { | - | ||||||||||||||||||||||||
| 2009 | impl = 0; | - | ||||||||||||||||||||||||
| 2010 | } executed 247 times by 5 tests: end of blockExecuted by:
| 247 | ||||||||||||||||||||||||
| 2011 | - | |||||||||||||||||||||||||
| 2012 | /*! | - | ||||||||||||||||||||||||
| 2013 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 2014 | - | |||||||||||||||||||||||||
| 2015 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 2016 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 2017 | cloneNode(). | - | ||||||||||||||||||||||||
| 2018 | */ | - | ||||||||||||||||||||||||
| 2019 | QDomNode::QDomNode(const QDomNode &n) | - | ||||||||||||||||||||||||
| 2020 | { | - | ||||||||||||||||||||||||
| 2021 | impl = n.impl; | - | ||||||||||||||||||||||||
| 2022 | if (impl)
| 0-193 | ||||||||||||||||||||||||
| 2023 | impl->ref.ref(); executed 193 times by 1 test: impl->ref.ref();Executed by:
| 193 | ||||||||||||||||||||||||
| 2024 | } executed 193 times by 1 test: end of blockExecuted by:
| 193 | ||||||||||||||||||||||||
| 2025 | - | |||||||||||||||||||||||||
| 2026 | /*! \internal | - | ||||||||||||||||||||||||
| 2027 | Constructs a new node for the data \a n. | - | ||||||||||||||||||||||||
| 2028 | */ | - | ||||||||||||||||||||||||
| 2029 | QDomNode::QDomNode(QDomNodePrivate *n) | - | ||||||||||||||||||||||||
| 2030 | { | - | ||||||||||||||||||||||||
| 2031 | impl = n; | - | ||||||||||||||||||||||||
| 2032 | if (impl)
| 0-418 | ||||||||||||||||||||||||
| 2033 | impl->ref.ref(); executed 418 times by 1 test: impl->ref.ref();Executed by:
| 418 | ||||||||||||||||||||||||
| 2034 | } executed 418 times by 1 test: end of blockExecuted by:
| 418 | ||||||||||||||||||||||||
| 2035 | - | |||||||||||||||||||||||||
| 2036 | /*! | - | ||||||||||||||||||||||||
| 2037 | Assigns a copy of \a n to this DOM node. | - | ||||||||||||||||||||||||
| 2038 | - | |||||||||||||||||||||||||
| 2039 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 2040 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 2041 | cloneNode(). | - | ||||||||||||||||||||||||
| 2042 | */ | - | ||||||||||||||||||||||||
| 2043 | QDomNode& QDomNode::operator=(const QDomNode &n) | - | ||||||||||||||||||||||||
| 2044 | { | - | ||||||||||||||||||||||||
| 2045 | if (n.impl)
| 0-71 | ||||||||||||||||||||||||
| 2046 | n.impl->ref.ref(); executed 71 times by 1 test: n.impl->ref.ref();Executed by:
| 71 | ||||||||||||||||||||||||
| 2047 | if (impl && !impl->ref.deref())
| 0-71 | ||||||||||||||||||||||||
| 2048 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 2049 | impl = n.impl; | - | ||||||||||||||||||||||||
| 2050 | return *this; executed 71 times by 1 test: return *this;Executed by:
| 71 | ||||||||||||||||||||||||
| 2051 | } | - | ||||||||||||||||||||||||
| 2052 | - | |||||||||||||||||||||||||
| 2053 | /*! | - | ||||||||||||||||||||||||
| 2054 | Returns \c true if \a n and this DOM node are equal; otherwise | - | ||||||||||||||||||||||||
| 2055 | returns \c false. | - | ||||||||||||||||||||||||
| 2056 | - | |||||||||||||||||||||||||
| 2057 | Any instance of QDomNode acts as a reference to an underlying data | - | ||||||||||||||||||||||||
| 2058 | structure in QDomDocument. The test for equality checks if the two | - | ||||||||||||||||||||||||
| 2059 | references point to the same underlying node. For example: | - | ||||||||||||||||||||||||
| 2060 | - | |||||||||||||||||||||||||
| 2061 | \snippet code/src_xml_dom_qdom.cpp 2 | - | ||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||
| 2063 | The two nodes (QDomElement is a QDomNode subclass) both refer to | - | ||||||||||||||||||||||||
| 2064 | the document's root element, and \c {element1 == element2} will | - | ||||||||||||||||||||||||
| 2065 | return true. On the other hand: | - | ||||||||||||||||||||||||
| 2066 | - | |||||||||||||||||||||||||
| 2067 | \snippet code/src_xml_dom_qdom.cpp 3 | - | ||||||||||||||||||||||||
| 2068 | - | |||||||||||||||||||||||||
| 2069 | Even though both nodes are empty elements carrying the same name, | - | ||||||||||||||||||||||||
| 2070 | \c {element3 == element4} will return false because they refer to | - | ||||||||||||||||||||||||
| 2071 | two different nodes in the underlying data structure. | - | ||||||||||||||||||||||||
| 2072 | */ | - | ||||||||||||||||||||||||
| 2073 | bool QDomNode::operator== (const QDomNode& n) const | - | ||||||||||||||||||||||||
| 2074 | { | - | ||||||||||||||||||||||||
| 2075 | return (impl == n.impl); never executed: return (impl == n.impl); | 0 | ||||||||||||||||||||||||
| 2076 | } | - | ||||||||||||||||||||||||
| 2077 | - | |||||||||||||||||||||||||
| 2078 | /*! | - | ||||||||||||||||||||||||
| 2079 | Returns \c true if \a n and this DOM node are not equal; otherwise | - | ||||||||||||||||||||||||
| 2080 | returns \c false. | - | ||||||||||||||||||||||||
| 2081 | */ | - | ||||||||||||||||||||||||
| 2082 | bool QDomNode::operator!= (const QDomNode& n) const | - | ||||||||||||||||||||||||
| 2083 | { | - | ||||||||||||||||||||||||
| 2084 | return (impl != n.impl); never executed: return (impl != n.impl); | 0 | ||||||||||||||||||||||||
| 2085 | } | - | ||||||||||||||||||||||||
| 2086 | - | |||||||||||||||||||||||||
| 2087 | /*! | - | ||||||||||||||||||||||||
| 2088 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 2089 | */ | - | ||||||||||||||||||||||||
| 2090 | QDomNode::~QDomNode() | - | ||||||||||||||||||||||||
| 2091 | { | - | ||||||||||||||||||||||||
| 2092 | if (impl && !impl->ref.deref())
| 3-855 | ||||||||||||||||||||||||
| 2093 | delete impl; executed 244 times by 5 tests: delete impl;Executed by:
| 244 | ||||||||||||||||||||||||
| 2094 | } executed 858 times by 5 tests: end of blockExecuted by:
| 858 | ||||||||||||||||||||||||
| 2095 | - | |||||||||||||||||||||||||
| 2096 | /*! | - | ||||||||||||||||||||||||
| 2097 | Returns the name of the node. | - | ||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | The meaning of the name depends on the subclass: | - | ||||||||||||||||||||||||
| 2100 | - | |||||||||||||||||||||||||
| 2101 | \table | - | ||||||||||||||||||||||||
| 2102 | \header \li Name \li Meaning | - | ||||||||||||||||||||||||
| 2103 | \row \li QDomAttr \li The name of the attribute | - | ||||||||||||||||||||||||
| 2104 | \row \li QDomCDATASection \li The string "#cdata-section" | - | ||||||||||||||||||||||||
| 2105 | \row \li QDomComment \li The string "#comment" | - | ||||||||||||||||||||||||
| 2106 | \row \li QDomDocument \li The string "#document" | - | ||||||||||||||||||||||||
| 2107 | \row \li QDomDocumentFragment \li The string "#document-fragment" | - | ||||||||||||||||||||||||
| 2108 | \row \li QDomDocumentType \li The name of the document type | - | ||||||||||||||||||||||||
| 2109 | \row \li QDomElement \li The tag name | - | ||||||||||||||||||||||||
| 2110 | \row \li QDomEntity \li The name of the entity | - | ||||||||||||||||||||||||
| 2111 | \row \li QDomEntityReference \li The name of the referenced entity | - | ||||||||||||||||||||||||
| 2112 | \row \li QDomNotation \li The name of the notation | - | ||||||||||||||||||||||||
| 2113 | \row \li QDomProcessingInstruction \li The target of the processing instruction | - | ||||||||||||||||||||||||
| 2114 | \row \li QDomText \li The string "#text" | - | ||||||||||||||||||||||||
| 2115 | \endtable | - | ||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||
| 2117 | \b{Note:} This function does not take the presence of namespaces into account | - | ||||||||||||||||||||||||
| 2118 | when processing the names of element and attribute nodes. As a result, the | - | ||||||||||||||||||||||||
| 2119 | returned name can contain any namespace prefix that may be present. | - | ||||||||||||||||||||||||
| 2120 | To obtain the node name of an element or attribute, use localName(); to | - | ||||||||||||||||||||||||
| 2121 | obtain the namespace prefix, use namespaceURI(). | - | ||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||
| 2123 | \sa nodeValue() | - | ||||||||||||||||||||||||
| 2124 | */ | - | ||||||||||||||||||||||||
| 2125 | QString QDomNode::nodeName() const | - | ||||||||||||||||||||||||
| 2126 | { | - | ||||||||||||||||||||||||
| 2127 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2128 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2129 | - | |||||||||||||||||||||||||
| 2130 | if (!IMPL->prefix.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2131 | return IMPL->prefix + QLatin1Char(':') + IMPL->name; never executed: return ((QDomNodePrivate*)impl)->prefix + QLatin1Char(':') + ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2132 | return IMPL->name; never executed: return ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2133 | } | - | ||||||||||||||||||||||||
| 2134 | - | |||||||||||||||||||||||||
| 2135 | /*! | - | ||||||||||||||||||||||||
| 2136 | Returns the value of the node. | - | ||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||
| 2138 | The meaning of the value depends on the subclass: | - | ||||||||||||||||||||||||
| 2139 | \table | - | ||||||||||||||||||||||||
| 2140 | \header \li Name \li Meaning | - | ||||||||||||||||||||||||
| 2141 | \row \li QDomAttr \li The attribute value | - | ||||||||||||||||||||||||
| 2142 | \row \li QDomCDATASection \li The content of the CDATA section | - | ||||||||||||||||||||||||
| 2143 | \row \li QDomComment \li The comment | - | ||||||||||||||||||||||||
| 2144 | \row \li QDomProcessingInstruction \li The data of the processing instruction | - | ||||||||||||||||||||||||
| 2145 | \row \li QDomText \li The text | - | ||||||||||||||||||||||||
| 2146 | \endtable | - | ||||||||||||||||||||||||
| 2147 | - | |||||||||||||||||||||||||
| 2148 | All the other subclasses do not have a node value and will return | - | ||||||||||||||||||||||||
| 2149 | an empty string. | - | ||||||||||||||||||||||||
| 2150 | - | |||||||||||||||||||||||||
| 2151 | \sa setNodeValue(), nodeName() | - | ||||||||||||||||||||||||
| 2152 | */ | - | ||||||||||||||||||||||||
| 2153 | QString QDomNode::nodeValue() const | - | ||||||||||||||||||||||||
| 2154 | { | - | ||||||||||||||||||||||||
| 2155 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2156 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2157 | return IMPL->value; never executed: return ((QDomNodePrivate*)impl)->value; | 0 | ||||||||||||||||||||||||
| 2158 | } | - | ||||||||||||||||||||||||
| 2159 | - | |||||||||||||||||||||||||
| 2160 | /*! | - | ||||||||||||||||||||||||
| 2161 | Sets the node's value to \a v. | - | ||||||||||||||||||||||||
| 2162 | - | |||||||||||||||||||||||||
| 2163 | \sa nodeValue() | - | ||||||||||||||||||||||||
| 2164 | */ | - | ||||||||||||||||||||||||
| 2165 | void QDomNode::setNodeValue(const QString& v) | - | ||||||||||||||||||||||||
| 2166 | { | - | ||||||||||||||||||||||||
| 2167 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2168 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2169 | IMPL->setNodeValue(v); | - | ||||||||||||||||||||||||
| 2170 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2171 | - | |||||||||||||||||||||||||
| 2172 | /*! | - | ||||||||||||||||||||||||
| 2173 | \enum QDomNode::NodeType | - | ||||||||||||||||||||||||
| 2174 | - | |||||||||||||||||||||||||
| 2175 | This enum defines the type of the node: | - | ||||||||||||||||||||||||
| 2176 | \value ElementNode | - | ||||||||||||||||||||||||
| 2177 | \value AttributeNode | - | ||||||||||||||||||||||||
| 2178 | \value TextNode | - | ||||||||||||||||||||||||
| 2179 | \value CDATASectionNode | - | ||||||||||||||||||||||||
| 2180 | \value EntityReferenceNode | - | ||||||||||||||||||||||||
| 2181 | \value EntityNode | - | ||||||||||||||||||||||||
| 2182 | \value ProcessingInstructionNode | - | ||||||||||||||||||||||||
| 2183 | \value CommentNode | - | ||||||||||||||||||||||||
| 2184 | \value DocumentNode | - | ||||||||||||||||||||||||
| 2185 | \value DocumentTypeNode | - | ||||||||||||||||||||||||
| 2186 | \value DocumentFragmentNode | - | ||||||||||||||||||||||||
| 2187 | \value NotationNode | - | ||||||||||||||||||||||||
| 2188 | \value BaseNode A QDomNode object, i.e. not a QDomNode subclass. | - | ||||||||||||||||||||||||
| 2189 | \value CharacterDataNode | - | ||||||||||||||||||||||||
| 2190 | */ | - | ||||||||||||||||||||||||
| 2191 | - | |||||||||||||||||||||||||
| 2192 | /*! | - | ||||||||||||||||||||||||
| 2193 | Returns the type of the node. | - | ||||||||||||||||||||||||
| 2194 | - | |||||||||||||||||||||||||
| 2195 | \sa toAttr(), toCDATASection(), toDocumentFragment(), | - | ||||||||||||||||||||||||
| 2196 | toDocument(), toDocumentType(), toElement(), toEntityReference(), | - | ||||||||||||||||||||||||
| 2197 | toText(), toEntity(), toNotation(), toProcessingInstruction(), | - | ||||||||||||||||||||||||
| 2198 | toCharacterData(), toComment() | - | ||||||||||||||||||||||||
| 2199 | */ | - | ||||||||||||||||||||||||
| 2200 | QDomNode::NodeType QDomNode::nodeType() const | - | ||||||||||||||||||||||||
| 2201 | { | - | ||||||||||||||||||||||||
| 2202 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2203 | return QDomNode::BaseNode; never executed: return QDomNode::BaseNode; | 0 | ||||||||||||||||||||||||
| 2204 | return IMPL->nodeType(); never executed: return ((QDomNodePrivate*)impl)->nodeType(); | 0 | ||||||||||||||||||||||||
| 2205 | } | - | ||||||||||||||||||||||||
| 2206 | - | |||||||||||||||||||||||||
| 2207 | /*! | - | ||||||||||||||||||||||||
| 2208 | Returns the parent node. If this node has no parent, a null node | - | ||||||||||||||||||||||||
| 2209 | is returned (i.e. a node for which isNull() returns \c true). | - | ||||||||||||||||||||||||
| 2210 | */ | - | ||||||||||||||||||||||||
| 2211 | QDomNode QDomNode::parentNode() const | - | ||||||||||||||||||||||||
| 2212 | { | - | ||||||||||||||||||||||||
| 2213 | if (!impl)
| 0-33 | ||||||||||||||||||||||||
| 2214 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2215 | return QDomNode(IMPL->parent()); executed 33 times by 1 test: return QDomNode(((QDomNodePrivate*)impl)->parent());Executed by:
| 33 | ||||||||||||||||||||||||
| 2216 | } | - | ||||||||||||||||||||||||
| 2217 | - | |||||||||||||||||||||||||
| 2218 | /*! | - | ||||||||||||||||||||||||
| 2219 | Returns a list of all direct child nodes. | - | ||||||||||||||||||||||||
| 2220 | - | |||||||||||||||||||||||||
| 2221 | Most often you will call this function on a QDomElement object. | - | ||||||||||||||||||||||||
| 2222 | - | |||||||||||||||||||||||||
| 2223 | For example, if the XML document looks like this: | - | ||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||
| 2225 | \snippet code/src_xml_dom_qdom.cpp 4 | - | ||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||
| 2227 | Then the list of child nodes for the "body"-element will contain | - | ||||||||||||||||||||||||
| 2228 | the node created by the <h1> tag and the node created by the | - | ||||||||||||||||||||||||
| 2229 | <p> tag. | - | ||||||||||||||||||||||||
| 2230 | - | |||||||||||||||||||||||||
| 2231 | The nodes in the list are not copied; so changing the nodes in the | - | ||||||||||||||||||||||||
| 2232 | list will also change the children of this node. | - | ||||||||||||||||||||||||
| 2233 | - | |||||||||||||||||||||||||
| 2234 | \sa firstChild(), lastChild() | - | ||||||||||||||||||||||||
| 2235 | */ | - | ||||||||||||||||||||||||
| 2236 | QDomNodeList QDomNode::childNodes() const | - | ||||||||||||||||||||||||
| 2237 | { | - | ||||||||||||||||||||||||
| 2238 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2239 | return QDomNodeList(); never executed: return QDomNodeList(); | 0 | ||||||||||||||||||||||||
| 2240 | return QDomNodeList(new QDomNodeListPrivate(impl)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl)); | 0 | ||||||||||||||||||||||||
| 2241 | } | - | ||||||||||||||||||||||||
| 2242 | - | |||||||||||||||||||||||||
| 2243 | /*! | - | ||||||||||||||||||||||||
| 2244 | Returns the first child of the node. If there is no child node, a | - | ||||||||||||||||||||||||
| 2245 | \l{isNull()}{null node} is returned. Changing the | - | ||||||||||||||||||||||||
| 2246 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2247 | - | |||||||||||||||||||||||||
| 2248 | \sa lastChild(), childNodes() | - | ||||||||||||||||||||||||
| 2249 | */ | - | ||||||||||||||||||||||||
| 2250 | QDomNode QDomNode::firstChild() const | - | ||||||||||||||||||||||||
| 2251 | { | - | ||||||||||||||||||||||||
| 2252 | if (!impl)
| 0-79 | ||||||||||||||||||||||||
| 2253 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2254 | return QDomNode(IMPL->first); executed 79 times by 1 test: return QDomNode(((QDomNodePrivate*)impl)->first);Executed by:
| 79 | ||||||||||||||||||||||||
| 2255 | } | - | ||||||||||||||||||||||||
| 2256 | - | |||||||||||||||||||||||||
| 2257 | /*! | - | ||||||||||||||||||||||||
| 2258 | Returns the last child of the node. If there is no child node, a | - | ||||||||||||||||||||||||
| 2259 | \l{isNull()}{null node} is returned. Changing the | - | ||||||||||||||||||||||||
| 2260 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2261 | - | |||||||||||||||||||||||||
| 2262 | \sa firstChild(), childNodes() | - | ||||||||||||||||||||||||
| 2263 | */ | - | ||||||||||||||||||||||||
| 2264 | QDomNode QDomNode::lastChild() const | - | ||||||||||||||||||||||||
| 2265 | { | - | ||||||||||||||||||||||||
| 2266 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2267 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2268 | return QDomNode(IMPL->last); never executed: return QDomNode(((QDomNodePrivate*)impl)->last); | 0 | ||||||||||||||||||||||||
| 2269 | } | - | ||||||||||||||||||||||||
| 2270 | - | |||||||||||||||||||||||||
| 2271 | /*! | - | ||||||||||||||||||||||||
| 2272 | Returns the previous sibling in the document tree. Changing the | - | ||||||||||||||||||||||||
| 2273 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2274 | - | |||||||||||||||||||||||||
| 2275 | For example, if you have XML like this: | - | ||||||||||||||||||||||||
| 2276 | - | |||||||||||||||||||||||||
| 2277 | \snippet code/src_xml_dom_qdom.cpp 5 | - | ||||||||||||||||||||||||
| 2278 | - | |||||||||||||||||||||||||
| 2279 | and this QDomNode represents the <p> tag, previousSibling() | - | ||||||||||||||||||||||||
| 2280 | will return the node representing the <h1> tag. | - | ||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||
| 2282 | \sa nextSibling() | - | ||||||||||||||||||||||||
| 2283 | */ | - | ||||||||||||||||||||||||
| 2284 | QDomNode QDomNode::previousSibling() const | - | ||||||||||||||||||||||||
| 2285 | { | - | ||||||||||||||||||||||||
| 2286 | if (!impl)
| 0-1 | ||||||||||||||||||||||||
| 2287 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2288 | return QDomNode(IMPL->prev); executed 1 time by 1 test: return QDomNode(((QDomNodePrivate*)impl)->prev);Executed by:
| 1 | ||||||||||||||||||||||||
| 2289 | } | - | ||||||||||||||||||||||||
| 2290 | - | |||||||||||||||||||||||||
| 2291 | /*! | - | ||||||||||||||||||||||||
| 2292 | Returns the next sibling in the document tree. Changing the | - | ||||||||||||||||||||||||
| 2293 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2294 | - | |||||||||||||||||||||||||
| 2295 | If you have XML like this: | - | ||||||||||||||||||||||||
| 2296 | - | |||||||||||||||||||||||||
| 2297 | \snippet code/src_xml_dom_qdom.cpp 6 | - | ||||||||||||||||||||||||
| 2298 | - | |||||||||||||||||||||||||
| 2299 | and this QDomNode represents the <p> tag, nextSibling() will | - | ||||||||||||||||||||||||
| 2300 | return the node representing the <h2> tag. | - | ||||||||||||||||||||||||
| 2301 | - | |||||||||||||||||||||||||
| 2302 | \sa previousSibling() | - | ||||||||||||||||||||||||
| 2303 | */ | - | ||||||||||||||||||||||||
| 2304 | QDomNode QDomNode::nextSibling() const | - | ||||||||||||||||||||||||
| 2305 | { | - | ||||||||||||||||||||||||
| 2306 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2307 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2308 | return QDomNode(IMPL->next); never executed: return QDomNode(((QDomNodePrivate*)impl)->next); | 0 | ||||||||||||||||||||||||
| 2309 | } | - | ||||||||||||||||||||||||
| 2310 | - | |||||||||||||||||||||||||
| 2311 | - | |||||||||||||||||||||||||
| 2312 | // ###### don't think this is part of the DOM and | - | ||||||||||||||||||||||||
| 2313 | /*! | - | ||||||||||||||||||||||||
| 2314 | Returns a named node map of all attributes. Attributes are only | - | ||||||||||||||||||||||||
| 2315 | provided for \l{QDomElement}s. | - | ||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||
| 2317 | Changing the attributes in the map will also change the attributes | - | ||||||||||||||||||||||||
| 2318 | of this QDomNode. | - | ||||||||||||||||||||||||
| 2319 | */ | - | ||||||||||||||||||||||||
| 2320 | QDomNamedNodeMap QDomNode::attributes() const | - | ||||||||||||||||||||||||
| 2321 | { | - | ||||||||||||||||||||||||
| 2322 | if (!impl || !impl->isElement())
| 0 | ||||||||||||||||||||||||
| 2323 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 2324 | - | |||||||||||||||||||||||||
| 2325 | return QDomNamedNodeMap(static_cast<QDomElementPrivate *>(impl)->attributes()); never executed: return QDomNamedNodeMap(static_cast<QDomElementPrivate *>(impl)->attributes()); | 0 | ||||||||||||||||||||||||
| 2326 | } | - | ||||||||||||||||||||||||
| 2327 | - | |||||||||||||||||||||||||
| 2328 | /*! | - | ||||||||||||||||||||||||
| 2329 | Returns the document to which this node belongs. | - | ||||||||||||||||||||||||
| 2330 | */ | - | ||||||||||||||||||||||||
| 2331 | QDomDocument QDomNode::ownerDocument() const | - | ||||||||||||||||||||||||
| 2332 | { | - | ||||||||||||||||||||||||
| 2333 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2334 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 2335 | return QDomDocument(IMPL->ownerDocument()); never executed: return QDomDocument(((QDomNodePrivate*)impl)->ownerDocument()); | 0 | ||||||||||||||||||||||||
| 2336 | } | - | ||||||||||||||||||||||||
| 2337 | - | |||||||||||||||||||||||||
| 2338 | /*! | - | ||||||||||||||||||||||||
| 2339 | Creates a deep (not shallow) copy of the QDomNode. | - | ||||||||||||||||||||||||
| 2340 | - | |||||||||||||||||||||||||
| 2341 | If \a deep is true, then the cloning is done recursively which | - | ||||||||||||||||||||||||
| 2342 | means that all the node's children are deep copied too. If \a deep | - | ||||||||||||||||||||||||
| 2343 | is false only the node itself is copied and the copy will have no | - | ||||||||||||||||||||||||
| 2344 | child nodes. | - | ||||||||||||||||||||||||
| 2345 | */ | - | ||||||||||||||||||||||||
| 2346 | QDomNode QDomNode::cloneNode(bool deep) const | - | ||||||||||||||||||||||||
| 2347 | { | - | ||||||||||||||||||||||||
| 2348 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2349 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2350 | return QDomNode(IMPL->cloneNode(deep)); never executed: return QDomNode(((QDomNodePrivate*)impl)->cloneNode(deep)); | 0 | ||||||||||||||||||||||||
| 2351 | } | - | ||||||||||||||||||||||||
| 2352 | - | |||||||||||||||||||||||||
| 2353 | /*! | - | ||||||||||||||||||||||||
| 2354 | Calling normalize() on an element converts all its children into a | - | ||||||||||||||||||||||||
| 2355 | standard form. This means that adjacent QDomText objects will be | - | ||||||||||||||||||||||||
| 2356 | merged into a single text object (QDomCDATASection nodes are not | - | ||||||||||||||||||||||||
| 2357 | merged). | - | ||||||||||||||||||||||||
| 2358 | */ | - | ||||||||||||||||||||||||
| 2359 | void QDomNode::normalize() | - | ||||||||||||||||||||||||
| 2360 | { | - | ||||||||||||||||||||||||
| 2361 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2362 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2363 | IMPL->normalize(); | - | ||||||||||||||||||||||||
| 2364 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2365 | - | |||||||||||||||||||||||||
| 2366 | /*! | - | ||||||||||||||||||||||||
| 2367 | Returns \c true if the DOM implementation implements the feature \a | - | ||||||||||||||||||||||||
| 2368 | feature and this feature is supported by this node in the version | - | ||||||||||||||||||||||||
| 2369 | \a version; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2370 | - | |||||||||||||||||||||||||
| 2371 | \sa QDomImplementation::hasFeature() | - | ||||||||||||||||||||||||
| 2372 | */ | - | ||||||||||||||||||||||||
| 2373 | bool QDomNode::isSupported(const QString& feature, const QString& version) const | - | ||||||||||||||||||||||||
| 2374 | { | - | ||||||||||||||||||||||||
| 2375 | QDomImplementation i; | - | ||||||||||||||||||||||||
| 2376 | return i.hasFeature(feature, version); never executed: return i.hasFeature(feature, version); | 0 | ||||||||||||||||||||||||
| 2377 | } | - | ||||||||||||||||||||||||
| 2378 | - | |||||||||||||||||||||||||
| 2379 | /*! | - | ||||||||||||||||||||||||
| 2380 | Returns the namespace URI of this node or an empty string if the | - | ||||||||||||||||||||||||
| 2381 | node has no namespace URI. | - | ||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||
| 2383 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2384 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2385 | namespaces. A namespace URI must be specified at creation time and | - | ||||||||||||||||||||||||
| 2386 | cannot be changed later. | - | ||||||||||||||||||||||||
| 2387 | - | |||||||||||||||||||||||||
| 2388 | \sa prefix(), localName(), QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2389 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2390 | */ | - | ||||||||||||||||||||||||
| 2391 | QString QDomNode::namespaceURI() const | - | ||||||||||||||||||||||||
| 2392 | { | - | ||||||||||||||||||||||||
| 2393 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2394 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2395 | return IMPL->namespaceURI; never executed: return ((QDomNodePrivate*)impl)->namespaceURI; | 0 | ||||||||||||||||||||||||
| 2396 | } | - | ||||||||||||||||||||||||
| 2397 | - | |||||||||||||||||||||||||
| 2398 | /*! | - | ||||||||||||||||||||||||
| 2399 | Returns the namespace prefix of the node or an empty string if the | - | ||||||||||||||||||||||||
| 2400 | node has no namespace prefix. | - | ||||||||||||||||||||||||
| 2401 | - | |||||||||||||||||||||||||
| 2402 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2403 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2404 | namespaces. A namespace prefix must be specified at creation time. | - | ||||||||||||||||||||||||
| 2405 | If a node was created with a namespace prefix, you can change it | - | ||||||||||||||||||||||||
| 2406 | later with setPrefix(). | - | ||||||||||||||||||||||||
| 2407 | - | |||||||||||||||||||||||||
| 2408 | If you create an element or attribute with | - | ||||||||||||||||||||||||
| 2409 | QDomDocument::createElement() or QDomDocument::createAttribute(), | - | ||||||||||||||||||||||||
| 2410 | the prefix will be an empty string. If you use | - | ||||||||||||||||||||||||
| 2411 | QDomDocument::createElementNS() or | - | ||||||||||||||||||||||||
| 2412 | QDomDocument::createAttributeNS() instead, the prefix will not be | - | ||||||||||||||||||||||||
| 2413 | an empty string; but it might be an empty string if the name does | - | ||||||||||||||||||||||||
| 2414 | not have a prefix. | - | ||||||||||||||||||||||||
| 2415 | - | |||||||||||||||||||||||||
| 2416 | \sa setPrefix(), localName(), namespaceURI(), | - | ||||||||||||||||||||||||
| 2417 | QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2418 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2419 | */ | - | ||||||||||||||||||||||||
| 2420 | QString QDomNode::prefix() const | - | ||||||||||||||||||||||||
| 2421 | { | - | ||||||||||||||||||||||||
| 2422 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2423 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2424 | return IMPL->prefix; never executed: return ((QDomNodePrivate*)impl)->prefix; | 0 | ||||||||||||||||||||||||
| 2425 | } | - | ||||||||||||||||||||||||
| 2426 | - | |||||||||||||||||||||||||
| 2427 | /*! | - | ||||||||||||||||||||||||
| 2428 | If the node has a namespace prefix, this function changes the | - | ||||||||||||||||||||||||
| 2429 | namespace prefix of the node to \a pre. Otherwise this function | - | ||||||||||||||||||||||||
| 2430 | does nothing. | - | ||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||
| 2432 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2433 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2434 | namespaces. A namespace prefix must have be specified at creation | - | ||||||||||||||||||||||||
| 2435 | time; it is not possible to add a namespace prefix afterwards. | - | ||||||||||||||||||||||||
| 2436 | - | |||||||||||||||||||||||||
| 2437 | \sa prefix(), localName(), namespaceURI(), | - | ||||||||||||||||||||||||
| 2438 | QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2439 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2440 | */ | - | ||||||||||||||||||||||||
| 2441 | void QDomNode::setPrefix(const QString& pre) | - | ||||||||||||||||||||||||
| 2442 | { | - | ||||||||||||||||||||||||
| 2443 | if (!impl || IMPL->prefix.isNull())
| 0 | ||||||||||||||||||||||||
| 2444 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2445 | if (isAttr() || isElement())
| 0 | ||||||||||||||||||||||||
| 2446 | IMPL->prefix = pre; never executed: ((QDomNodePrivate*)impl)->prefix = pre; | 0 | ||||||||||||||||||||||||
| 2447 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2448 | - | |||||||||||||||||||||||||
| 2449 | /*! | - | ||||||||||||||||||||||||
| 2450 | If the node uses namespaces, this function returns the local name | - | ||||||||||||||||||||||||
| 2451 | of the node; otherwise it returns an empty string. | - | ||||||||||||||||||||||||
| 2452 | - | |||||||||||||||||||||||||
| 2453 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2454 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2455 | namespaces. A namespace must have been specified at creation time; | - | ||||||||||||||||||||||||
| 2456 | it is not possible to add a namespace afterwards. | - | ||||||||||||||||||||||||
| 2457 | - | |||||||||||||||||||||||||
| 2458 | \sa prefix(), namespaceURI(), QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2459 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2460 | */ | - | ||||||||||||||||||||||||
| 2461 | QString QDomNode::localName() const | - | ||||||||||||||||||||||||
| 2462 | { | - | ||||||||||||||||||||||||
| 2463 | if (!impl || IMPL->createdWithDom1Interface)
| 0 | ||||||||||||||||||||||||
| 2464 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2465 | return IMPL->name; never executed: return ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2466 | } | - | ||||||||||||||||||||||||
| 2467 | - | |||||||||||||||||||||||||
| 2468 | /*! | - | ||||||||||||||||||||||||
| 2469 | Returns \c true if the node has attributes; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2470 | - | |||||||||||||||||||||||||
| 2471 | \sa attributes() | - | ||||||||||||||||||||||||
| 2472 | */ | - | ||||||||||||||||||||||||
| 2473 | bool QDomNode::hasAttributes() const | - | ||||||||||||||||||||||||
| 2474 | { | - | ||||||||||||||||||||||||
| 2475 | if (!impl || !impl->isElement())
| 0-26 | ||||||||||||||||||||||||
| 2476 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2477 | return static_cast<QDomElementPrivate *>(impl)->hasAttributes(); executed 26 times by 1 test: return static_cast<QDomElementPrivate *>(impl)->hasAttributes();Executed by:
| 26 | ||||||||||||||||||||||||
| 2478 | } | - | ||||||||||||||||||||||||
| 2479 | - | |||||||||||||||||||||||||
| 2480 | /*! | - | ||||||||||||||||||||||||
| 2481 | Inserts the node \a newChild before the child node \a refChild. | - | ||||||||||||||||||||||||
| 2482 | \a refChild must be a direct child of this node. If \a refChild is | - | ||||||||||||||||||||||||
| 2483 | \l{isNull()}{null} then \a newChild is inserted as the | - | ||||||||||||||||||||||||
| 2484 | node's first child. | - | ||||||||||||||||||||||||
| 2485 | - | |||||||||||||||||||||||||
| 2486 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2487 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2488 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2489 | - | |||||||||||||||||||||||||
| 2490 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2491 | fragment are removed from the fragment and inserted before \a | - | ||||||||||||||||||||||||
| 2492 | refChild. | - | ||||||||||||||||||||||||
| 2493 | - | |||||||||||||||||||||||||
| 2494 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2495 | - | |||||||||||||||||||||||||
| 2496 | The DOM specification disallow inserting attribute nodes, but due | - | ||||||||||||||||||||||||
| 2497 | to historical reasons QDom accept them nevertheless. | - | ||||||||||||||||||||||||
| 2498 | - | |||||||||||||||||||||||||
| 2499 | \sa insertAfter(), replaceChild(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2500 | */ | - | ||||||||||||||||||||||||
| 2501 | QDomNode QDomNode::insertBefore(const QDomNode& newChild, const QDomNode& refChild) | - | ||||||||||||||||||||||||
| 2502 | { | - | ||||||||||||||||||||||||
| 2503 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2504 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2505 | return QDomNode(IMPL->insertBefore(newChild.impl, refChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->insertBefore(newChild.impl, refChild.impl)); | 0 | ||||||||||||||||||||||||
| 2506 | } | - | ||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||
| 2508 | /*! | - | ||||||||||||||||||||||||
| 2509 | Inserts the node \a newChild after the child node \a refChild. \a | - | ||||||||||||||||||||||||
| 2510 | refChild must be a direct child of this node. If \a refChild is | - | ||||||||||||||||||||||||
| 2511 | \l{isNull()}{null} then \a newChild is appended as this | - | ||||||||||||||||||||||||
| 2512 | node's last child. | - | ||||||||||||||||||||||||
| 2513 | - | |||||||||||||||||||||||||
| 2514 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2515 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2516 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2517 | - | |||||||||||||||||||||||||
| 2518 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2519 | fragment are removed from the fragment and inserted after \a | - | ||||||||||||||||||||||||
| 2520 | refChild. | - | ||||||||||||||||||||||||
| 2521 | - | |||||||||||||||||||||||||
| 2522 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2523 | - | |||||||||||||||||||||||||
| 2524 | The DOM specification disallow inserting attribute nodes, but due | - | ||||||||||||||||||||||||
| 2525 | to historical reasons QDom accept them nevertheless. | - | ||||||||||||||||||||||||
| 2526 | - | |||||||||||||||||||||||||
| 2527 | \sa insertBefore(), replaceChild(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2528 | */ | - | ||||||||||||||||||||||||
| 2529 | QDomNode QDomNode::insertAfter(const QDomNode& newChild, const QDomNode& refChild) | - | ||||||||||||||||||||||||
| 2530 | { | - | ||||||||||||||||||||||||
| 2531 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2532 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2533 | return QDomNode(IMPL->insertAfter(newChild.impl, refChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->insertAfter(newChild.impl, refChild.impl)); | 0 | ||||||||||||||||||||||||
| 2534 | } | - | ||||||||||||||||||||||||
| 2535 | - | |||||||||||||||||||||||||
| 2536 | /*! | - | ||||||||||||||||||||||||
| 2537 | Replaces \a oldChild with \a newChild. \a oldChild must be a | - | ||||||||||||||||||||||||
| 2538 | direct child of this node. | - | ||||||||||||||||||||||||
| 2539 | - | |||||||||||||||||||||||||
| 2540 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2541 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2542 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2543 | - | |||||||||||||||||||||||||
| 2544 | If \a newChild is a QDomDocumentFragment, then \a oldChild is | - | ||||||||||||||||||||||||
| 2545 | replaced by all of the children of the fragment. | - | ||||||||||||||||||||||||
| 2546 | - | |||||||||||||||||||||||||
| 2547 | Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} an failure. | - | ||||||||||||||||||||||||
| 2548 | - | |||||||||||||||||||||||||
| 2549 | \sa insertBefore(), insertAfter(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2550 | */ | - | ||||||||||||||||||||||||
| 2551 | QDomNode QDomNode::replaceChild(const QDomNode& newChild, const QDomNode& oldChild) | - | ||||||||||||||||||||||||
| 2552 | { | - | ||||||||||||||||||||||||
| 2553 | if (!impl || !newChild.impl || !oldChild.impl)
| 0 | ||||||||||||||||||||||||
| 2554 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2555 | return QDomNode(IMPL->replaceChild(newChild.impl, oldChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->replaceChild(newChild.impl, oldChild.impl)); | 0 | ||||||||||||||||||||||||
| 2556 | } | - | ||||||||||||||||||||||||
| 2557 | - | |||||||||||||||||||||||||
| 2558 | /*! | - | ||||||||||||||||||||||||
| 2559 | Removes \a oldChild from the list of children. \a oldChild must be | - | ||||||||||||||||||||||||
| 2560 | a direct child of this node. | - | ||||||||||||||||||||||||
| 2561 | - | |||||||||||||||||||||||||
| 2562 | Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2563 | - | |||||||||||||||||||||||||
| 2564 | \sa insertBefore(), insertAfter(), replaceChild(), appendChild() | - | ||||||||||||||||||||||||
| 2565 | */ | - | ||||||||||||||||||||||||
| 2566 | QDomNode QDomNode::removeChild(const QDomNode& oldChild) | - | ||||||||||||||||||||||||
| 2567 | { | - | ||||||||||||||||||||||||
| 2568 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2569 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2570 | - | |||||||||||||||||||||||||
| 2571 | if (oldChild.isNull())
| 0 | ||||||||||||||||||||||||
| 2572 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2573 | - | |||||||||||||||||||||||||
| 2574 | return QDomNode(IMPL->removeChild(oldChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->removeChild(oldChild.impl)); | 0 | ||||||||||||||||||||||||
| 2575 | } | - | ||||||||||||||||||||||||
| 2576 | - | |||||||||||||||||||||||||
| 2577 | /*! | - | ||||||||||||||||||||||||
| 2578 | Appends \a newChild as the node's last child. | - | ||||||||||||||||||||||||
| 2579 | - | |||||||||||||||||||||||||
| 2580 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2581 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2582 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2583 | - | |||||||||||||||||||||||||
| 2584 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2585 | fragment are removed from the fragment and appended. | - | ||||||||||||||||||||||||
| 2586 | - | |||||||||||||||||||||||||
| 2587 | If \a newChild is a QDomElement and this node is a QDomDocument that | - | ||||||||||||||||||||||||
| 2588 | already has an element node as a child, \a newChild is not added as | - | ||||||||||||||||||||||||
| 2589 | a child and a null node is returned. | - | ||||||||||||||||||||||||
| 2590 | - | |||||||||||||||||||||||||
| 2591 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||
| 2593 | Calling this function on a null node(created, for example, with | - | ||||||||||||||||||||||||
| 2594 | the default constructor) does nothing and returns a \l{isNull()}{null node}. | - | ||||||||||||||||||||||||
| 2595 | - | |||||||||||||||||||||||||
| 2596 | The DOM specification disallow inserting attribute nodes, but for | - | ||||||||||||||||||||||||
| 2597 | historical reasons, QDom accepts them anyway. | - | ||||||||||||||||||||||||
| 2598 | - | |||||||||||||||||||||||||
| 2599 | \sa insertBefore(), insertAfter(), replaceChild(), removeChild() | - | ||||||||||||||||||||||||
| 2600 | */ | - | ||||||||||||||||||||||||
| 2601 | QDomNode QDomNode::appendChild(const QDomNode& newChild) | - | ||||||||||||||||||||||||
| 2602 | { | - | ||||||||||||||||||||||||
| 2603 | if (!impl) {
| 0 | ||||||||||||||||||||||||
| 2604 | qWarning("Calling appendChild() on a null node does nothing."); | - | ||||||||||||||||||||||||
| 2605 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2606 | } | - | ||||||||||||||||||||||||
| 2607 | return QDomNode(IMPL->appendChild(newChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->appendChild(newChild.impl)); | 0 | ||||||||||||||||||||||||
| 2608 | } | - | ||||||||||||||||||||||||
| 2609 | - | |||||||||||||||||||||||||
| 2610 | /*! | - | ||||||||||||||||||||||||
| 2611 | Returns \c true if the node has one or more children; otherwise | - | ||||||||||||||||||||||||
| 2612 | returns \c false. | - | ||||||||||||||||||||||||
| 2613 | */ | - | ||||||||||||||||||||||||
| 2614 | bool QDomNode::hasChildNodes() const | - | ||||||||||||||||||||||||
| 2615 | { | - | ||||||||||||||||||||||||
| 2616 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2617 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2618 | return IMPL->first != 0; never executed: return ((QDomNodePrivate*)impl)->first != 0; | 0 | ||||||||||||||||||||||||
| 2619 | } | - | ||||||||||||||||||||||||
| 2620 | - | |||||||||||||||||||||||||
| 2621 | /*! | - | ||||||||||||||||||||||||
| 2622 | Returns \c true if this node is null (i.e. if it has no type or | - | ||||||||||||||||||||||||
| 2623 | contents); otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2624 | */ | - | ||||||||||||||||||||||||
| 2625 | bool QDomNode::isNull() const | - | ||||||||||||||||||||||||
| 2626 | { | - | ||||||||||||||||||||||||
| 2627 | return (impl == 0); executed 154 times by 1 test: return (impl == 0);Executed by:
| 154 | ||||||||||||||||||||||||
| 2628 | } | - | ||||||||||||||||||||||||
| 2629 | - | |||||||||||||||||||||||||
| 2630 | /*! | - | ||||||||||||||||||||||||
| 2631 | Converts the node into a null node; if it was not a null node | - | ||||||||||||||||||||||||
| 2632 | before, its type and contents are deleted. | - | ||||||||||||||||||||||||
| 2633 | - | |||||||||||||||||||||||||
| 2634 | \sa isNull() | - | ||||||||||||||||||||||||
| 2635 | */ | - | ||||||||||||||||||||||||
| 2636 | void QDomNode::clear() | - | ||||||||||||||||||||||||
| 2637 | { | - | ||||||||||||||||||||||||
| 2638 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 2639 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 2640 | impl = 0; | - | ||||||||||||||||||||||||
| 2641 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2642 | - | |||||||||||||||||||||||||
| 2643 | /*! | - | ||||||||||||||||||||||||
| 2644 | Returns the first direct child node for which nodeName() equals \a | - | ||||||||||||||||||||||||
| 2645 | name. | - | ||||||||||||||||||||||||
| 2646 | - | |||||||||||||||||||||||||
| 2647 | If no such direct child exists, a \l{isNull()}{null node} | - | ||||||||||||||||||||||||
| 2648 | is returned. | - | ||||||||||||||||||||||||
| 2649 | - | |||||||||||||||||||||||||
| 2650 | \sa nodeName() | - | ||||||||||||||||||||||||
| 2651 | */ | - | ||||||||||||||||||||||||
| 2652 | QDomNode QDomNode::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 2653 | { | - | ||||||||||||||||||||||||
| 2654 | if (!impl)
| 0-49 | ||||||||||||||||||||||||
| 2655 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2656 | return QDomNode(impl->namedItem(name)); executed 49 times by 1 test: return QDomNode(impl->namedItem(name));Executed by:
| 49 | ||||||||||||||||||||||||
| 2657 | } | - | ||||||||||||||||||||||||
| 2658 | - | |||||||||||||||||||||||||
| 2659 | /*! | - | ||||||||||||||||||||||||
| 2660 | Writes the XML representation of the node and all its children to | - | ||||||||||||||||||||||||
| 2661 | the stream \a stream. This function uses \a indent as the amount of | - | ||||||||||||||||||||||||
| 2662 | space to indent the node. | - | ||||||||||||||||||||||||
| 2663 | - | |||||||||||||||||||||||||
| 2664 | If the document contains invalid XML characters or characters that cannot be | - | ||||||||||||||||||||||||
| 2665 | encoded in the given encoding, the result and behavior is undefined. | - | ||||||||||||||||||||||||
| 2666 | - | |||||||||||||||||||||||||
| 2667 | If \a encodingPolicy is QDomNode::EncodingFromDocument and this node is a | - | ||||||||||||||||||||||||
| 2668 | document node, the encoding of text stream \a stream's encoding is set by | - | ||||||||||||||||||||||||
| 2669 | treating a processing instruction by name "xml" as an XML declaration, if | - | ||||||||||||||||||||||||
| 2670 | one exists, and otherwise defaults to UTF-8. XML declarations are not | - | ||||||||||||||||||||||||
| 2671 | processing instructions, but this behavior exists for historical | - | ||||||||||||||||||||||||
| 2672 | reasons. If this node is not a document node, the text stream's encoding | - | ||||||||||||||||||||||||
| 2673 | is used. | - | ||||||||||||||||||||||||
| 2674 | - | |||||||||||||||||||||||||
| 2675 | If \a encodingPolicy is EncodingFromTextStream and this node is a document node, this | - | ||||||||||||||||||||||||
| 2676 | function behaves as save(QTextStream &str, int indent) with the exception that the encoding | - | ||||||||||||||||||||||||
| 2677 | specified in the text stream \a stream is used. | - | ||||||||||||||||||||||||
| 2678 | - | |||||||||||||||||||||||||
| 2679 | If the document contains invalid XML characters or characters that cannot be | - | ||||||||||||||||||||||||
| 2680 | encoded in the given encoding, the result and behavior is undefined. | - | ||||||||||||||||||||||||
| 2681 | - | |||||||||||||||||||||||||
| 2682 | \since 4.2 | - | ||||||||||||||||||||||||
| 2683 | */ | - | ||||||||||||||||||||||||
| 2684 | void QDomNode::save(QTextStream& stream, int indent, EncodingPolicy encodingPolicy) const | - | ||||||||||||||||||||||||
| 2685 | { | - | ||||||||||||||||||||||||
| 2686 | if (!impl)
| 0-86 | ||||||||||||||||||||||||
| 2687 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2688 | - | |||||||||||||||||||||||||
| 2689 | if(isDocument())
| 0-86 | ||||||||||||||||||||||||
| 2690 | static_cast<const QDomDocumentPrivate *>(impl)->saveDocument(stream, indent, encodingPolicy); executed 86 times by 2 tests: static_cast<const QDomDocumentPrivate *>(impl)->saveDocument(stream, indent, encodingPolicy);Executed by:
| 86 | ||||||||||||||||||||||||
| 2691 | else | - | ||||||||||||||||||||||||
| 2692 | IMPL->save(stream, 1, indent); never executed: ((QDomNodePrivate*)impl)->save(stream, 1, indent); | 0 | ||||||||||||||||||||||||
| 2693 | } | - | ||||||||||||||||||||||||
| 2694 | - | |||||||||||||||||||||||||
| 2695 | /*! | - | ||||||||||||||||||||||||
| 2696 | \relates QDomNode | - | ||||||||||||||||||||||||
| 2697 | - | |||||||||||||||||||||||||
| 2698 | Writes the XML representation of the node \a node and all its | - | ||||||||||||||||||||||||
| 2699 | children to the stream \a str. | - | ||||||||||||||||||||||||
| 2700 | */ | - | ||||||||||||||||||||||||
| 2701 | QTextStream& operator<<(QTextStream& str, const QDomNode& node) | - | ||||||||||||||||||||||||
| 2702 | { | - | ||||||||||||||||||||||||
| 2703 | node.save(str, 1); | - | ||||||||||||||||||||||||
| 2704 | - | |||||||||||||||||||||||||
| 2705 | return str; never executed: return str; | 0 | ||||||||||||||||||||||||
| 2706 | } | - | ||||||||||||||||||||||||
| 2707 | - | |||||||||||||||||||||||||
| 2708 | /*! | - | ||||||||||||||||||||||||
| 2709 | Returns \c true if the node is an attribute; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2710 | - | |||||||||||||||||||||||||
| 2711 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2712 | is a QDomAttribute; you can get the QDomAttribute with | - | ||||||||||||||||||||||||
| 2713 | toAttribute(). | - | ||||||||||||||||||||||||
| 2714 | - | |||||||||||||||||||||||||
| 2715 | \sa toAttr() | - | ||||||||||||||||||||||||
| 2716 | */ | - | ||||||||||||||||||||||||
| 2717 | bool QDomNode::isAttr() const | - | ||||||||||||||||||||||||
| 2718 | { | - | ||||||||||||||||||||||||
| 2719 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2720 | return impl->isAttr(); never executed: return impl->isAttr(); | 0 | ||||||||||||||||||||||||
| 2721 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2722 | } | - | ||||||||||||||||||||||||
| 2723 | - | |||||||||||||||||||||||||
| 2724 | /*! | - | ||||||||||||||||||||||||
| 2725 | Returns \c true if the node is a CDATA section; otherwise returns | - | ||||||||||||||||||||||||
| 2726 | false. | - | ||||||||||||||||||||||||
| 2727 | - | |||||||||||||||||||||||||
| 2728 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2729 | is a QDomCDATASection; you can get the QDomCDATASection with | - | ||||||||||||||||||||||||
| 2730 | toCDATASection(). | - | ||||||||||||||||||||||||
| 2731 | - | |||||||||||||||||||||||||
| 2732 | \sa toCDATASection() | - | ||||||||||||||||||||||||
| 2733 | */ | - | ||||||||||||||||||||||||
| 2734 | bool QDomNode::isCDATASection() const | - | ||||||||||||||||||||||||
| 2735 | { | - | ||||||||||||||||||||||||
| 2736 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2737 | return impl->isCDATASection(); never executed: return impl->isCDATASection(); | 0 | ||||||||||||||||||||||||
| 2738 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2739 | } | - | ||||||||||||||||||||||||
| 2740 | - | |||||||||||||||||||||||||
| 2741 | /*! | - | ||||||||||||||||||||||||
| 2742 | Returns \c true if the node is a document fragment; otherwise returns | - | ||||||||||||||||||||||||
| 2743 | false. | - | ||||||||||||||||||||||||
| 2744 | - | |||||||||||||||||||||||||
| 2745 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2746 | is a QDomDocumentFragment; you can get the QDomDocumentFragment | - | ||||||||||||||||||||||||
| 2747 | with toDocumentFragment(). | - | ||||||||||||||||||||||||
| 2748 | - | |||||||||||||||||||||||||
| 2749 | \sa toDocumentFragment() | - | ||||||||||||||||||||||||
| 2750 | */ | - | ||||||||||||||||||||||||
| 2751 | bool QDomNode::isDocumentFragment() const | - | ||||||||||||||||||||||||
| 2752 | { | - | ||||||||||||||||||||||||
| 2753 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2754 | return impl->isDocumentFragment(); never executed: return impl->isDocumentFragment(); | 0 | ||||||||||||||||||||||||
| 2755 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2756 | } | - | ||||||||||||||||||||||||
| 2757 | - | |||||||||||||||||||||||||
| 2758 | /*! | - | ||||||||||||||||||||||||
| 2759 | Returns \c true if the node is a document; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2760 | - | |||||||||||||||||||||||||
| 2761 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2762 | is a QDomDocument; you can get the QDomDocument with toDocument(). | - | ||||||||||||||||||||||||
| 2763 | - | |||||||||||||||||||||||||
| 2764 | \sa toDocument() | - | ||||||||||||||||||||||||
| 2765 | */ | - | ||||||||||||||||||||||||
| 2766 | bool QDomNode::isDocument() const | - | ||||||||||||||||||||||||
| 2767 | { | - | ||||||||||||||||||||||||
| 2768 | if(impl)
| 0-86 | ||||||||||||||||||||||||
| 2769 | return impl->isDocument(); executed 86 times by 2 tests: return impl->isDocument();Executed by:
| 86 | ||||||||||||||||||||||||
| 2770 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2771 | } | - | ||||||||||||||||||||||||
| 2772 | - | |||||||||||||||||||||||||
| 2773 | /*! | - | ||||||||||||||||||||||||
| 2774 | Returns \c true if the node is a document type; otherwise returns | - | ||||||||||||||||||||||||
| 2775 | false. | - | ||||||||||||||||||||||||
| 2776 | - | |||||||||||||||||||||||||
| 2777 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2778 | is a QDomDocumentType; you can get the QDomDocumentType with | - | ||||||||||||||||||||||||
| 2779 | toDocumentType(). | - | ||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||
| 2781 | \sa toDocumentType() | - | ||||||||||||||||||||||||
| 2782 | */ | - | ||||||||||||||||||||||||
| 2783 | bool QDomNode::isDocumentType() const | - | ||||||||||||||||||||||||
| 2784 | { | - | ||||||||||||||||||||||||
| 2785 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2786 | return impl->isDocumentType(); never executed: return impl->isDocumentType(); | 0 | ||||||||||||||||||||||||
| 2787 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2788 | } | - | ||||||||||||||||||||||||
| 2789 | - | |||||||||||||||||||||||||
| 2790 | /*! | - | ||||||||||||||||||||||||
| 2791 | Returns \c true if the node is an element; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2792 | - | |||||||||||||||||||||||||
| 2793 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2794 | is a QDomElement; you can get the QDomElement with toElement(). | - | ||||||||||||||||||||||||
| 2795 | - | |||||||||||||||||||||||||
| 2796 | \sa toElement() | - | ||||||||||||||||||||||||
| 2797 | */ | - | ||||||||||||||||||||||||
| 2798 | bool QDomNode::isElement() const | - | ||||||||||||||||||||||||
| 2799 | { | - | ||||||||||||||||||||||||
| 2800 | if(impl)
| 0-80 | ||||||||||||||||||||||||
| 2801 | return impl->isElement(); executed 80 times by 1 test: return impl->isElement();Executed by:
| 80 | ||||||||||||||||||||||||
| 2802 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2803 | } | - | ||||||||||||||||||||||||
| 2804 | - | |||||||||||||||||||||||||
| 2805 | /*! | - | ||||||||||||||||||||||||
| 2806 | Returns \c true if the node is an entity reference; otherwise returns | - | ||||||||||||||||||||||||
| 2807 | false. | - | ||||||||||||||||||||||||
| 2808 | - | |||||||||||||||||||||||||
| 2809 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2810 | is a QDomEntityReference; you can get the QDomEntityReference with | - | ||||||||||||||||||||||||
| 2811 | toEntityReference(). | - | ||||||||||||||||||||||||
| 2812 | - | |||||||||||||||||||||||||
| 2813 | \sa toEntityReference() | - | ||||||||||||||||||||||||
| 2814 | */ | - | ||||||||||||||||||||||||
| 2815 | bool QDomNode::isEntityReference() const | - | ||||||||||||||||||||||||
| 2816 | { | - | ||||||||||||||||||||||||
| 2817 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2818 | return impl->isEntityReference(); never executed: return impl->isEntityReference(); | 0 | ||||||||||||||||||||||||
| 2819 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2820 | } | - | ||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||
| 2822 | /*! | - | ||||||||||||||||||||||||
| 2823 | Returns \c true if the node is a text node; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2824 | - | |||||||||||||||||||||||||
| 2825 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2826 | is a QDomText; you can get the QDomText with toText(). | - | ||||||||||||||||||||||||
| 2827 | - | |||||||||||||||||||||||||
| 2828 | \sa toText() | - | ||||||||||||||||||||||||
| 2829 | */ | - | ||||||||||||||||||||||||
| 2830 | bool QDomNode::isText() const | - | ||||||||||||||||||||||||
| 2831 | { | - | ||||||||||||||||||||||||
| 2832 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2833 | return impl->isText(); never executed: return impl->isText(); | 0 | ||||||||||||||||||||||||
| 2834 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2835 | } | - | ||||||||||||||||||||||||
| 2836 | - | |||||||||||||||||||||||||
| 2837 | /*! | - | ||||||||||||||||||||||||
| 2838 | Returns \c true if the node is an entity; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2839 | - | |||||||||||||||||||||||||
| 2840 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2841 | is a QDomEntity; you can get the QDomEntity with toEntity(). | - | ||||||||||||||||||||||||
| 2842 | - | |||||||||||||||||||||||||
| 2843 | \sa toEntity() | - | ||||||||||||||||||||||||
| 2844 | */ | - | ||||||||||||||||||||||||
| 2845 | bool QDomNode::isEntity() const | - | ||||||||||||||||||||||||
| 2846 | { | - | ||||||||||||||||||||||||
| 2847 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2848 | return impl->isEntity(); never executed: return impl->isEntity(); | 0 | ||||||||||||||||||||||||
| 2849 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2850 | } | - | ||||||||||||||||||||||||
| 2851 | - | |||||||||||||||||||||||||
| 2852 | /*! | - | ||||||||||||||||||||||||
| 2853 | Returns \c true if the node is a notation; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2854 | - | |||||||||||||||||||||||||
| 2855 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2856 | is a QDomNotation; you can get the QDomNotation with toNotation(). | - | ||||||||||||||||||||||||
| 2857 | - | |||||||||||||||||||||||||
| 2858 | \sa toNotation() | - | ||||||||||||||||||||||||
| 2859 | */ | - | ||||||||||||||||||||||||
| 2860 | bool QDomNode::isNotation() const | - | ||||||||||||||||||||||||
| 2861 | { | - | ||||||||||||||||||||||||
| 2862 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2863 | return impl->isNotation(); never executed: return impl->isNotation(); | 0 | ||||||||||||||||||||||||
| 2864 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2865 | } | - | ||||||||||||||||||||||||
| 2866 | - | |||||||||||||||||||||||||
| 2867 | /*! | - | ||||||||||||||||||||||||
| 2868 | Returns \c true if the node is a processing instruction; otherwise | - | ||||||||||||||||||||||||
| 2869 | returns \c false. | - | ||||||||||||||||||||||||
| 2870 | - | |||||||||||||||||||||||||
| 2871 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2872 | is a QDomProcessingInstruction; you can get the | - | ||||||||||||||||||||||||
| 2873 | QProcessingInstruction with toProcessingInstruction(). | - | ||||||||||||||||||||||||
| 2874 | - | |||||||||||||||||||||||||
| 2875 | \sa toProcessingInstruction() | - | ||||||||||||||||||||||||
| 2876 | */ | - | ||||||||||||||||||||||||
| 2877 | bool QDomNode::isProcessingInstruction() const | - | ||||||||||||||||||||||||
| 2878 | { | - | ||||||||||||||||||||||||
| 2879 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2880 | return impl->isProcessingInstruction(); never executed: return impl->isProcessingInstruction(); | 0 | ||||||||||||||||||||||||
| 2881 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2882 | } | - | ||||||||||||||||||||||||
| 2883 | - | |||||||||||||||||||||||||
| 2884 | /*! | - | ||||||||||||||||||||||||
| 2885 | Returns \c true if the node is a character data node; otherwise | - | ||||||||||||||||||||||||
| 2886 | returns \c false. | - | ||||||||||||||||||||||||
| 2887 | - | |||||||||||||||||||||||||
| 2888 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2889 | is a QDomCharacterData; you can get the QDomCharacterData with | - | ||||||||||||||||||||||||
| 2890 | toCharacterData(). | - | ||||||||||||||||||||||||
| 2891 | - | |||||||||||||||||||||||||
| 2892 | \sa toCharacterData() | - | ||||||||||||||||||||||||
| 2893 | */ | - | ||||||||||||||||||||||||
| 2894 | bool QDomNode::isCharacterData() const | - | ||||||||||||||||||||||||
| 2895 | { | - | ||||||||||||||||||||||||
| 2896 | if (impl)
| 0 | ||||||||||||||||||||||||
| 2897 | return impl->isCharacterData(); never executed: return impl->isCharacterData(); | 0 | ||||||||||||||||||||||||
| 2898 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2899 | } | - | ||||||||||||||||||||||||
| 2900 | - | |||||||||||||||||||||||||
| 2901 | /*! | - | ||||||||||||||||||||||||
| 2902 | Returns \c true if the node is a comment; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2903 | - | |||||||||||||||||||||||||
| 2904 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2905 | is a QDomComment; you can get the QDomComment with toComment(). | - | ||||||||||||||||||||||||
| 2906 | - | |||||||||||||||||||||||||
| 2907 | \sa toComment() | - | ||||||||||||||||||||||||
| 2908 | */ | - | ||||||||||||||||||||||||
| 2909 | bool QDomNode::isComment() const | - | ||||||||||||||||||||||||
| 2910 | { | - | ||||||||||||||||||||||||
| 2911 | if (impl)
| 0 | ||||||||||||||||||||||||
| 2912 | return impl->isComment(); never executed: return impl->isComment(); | 0 | ||||||||||||||||||||||||
| 2913 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2914 | } | - | ||||||||||||||||||||||||
| 2915 | - | |||||||||||||||||||||||||
| 2916 | #undef IMPL | - | ||||||||||||||||||||||||
| 2917 | - | |||||||||||||||||||||||||
| 2918 | /*! | - | ||||||||||||||||||||||||
| 2919 | Returns the first child element with tag name \a tagName if tagName is non-empty; | - | ||||||||||||||||||||||||
| 2920 | otherwise returns the first child element. Returns a null element if no | - | ||||||||||||||||||||||||
| 2921 | such child exists. | - | ||||||||||||||||||||||||
| 2922 | - | |||||||||||||||||||||||||
| 2923 | \sa lastChildElement(), previousSiblingElement(), nextSiblingElement() | - | ||||||||||||||||||||||||
| 2924 | */ | - | ||||||||||||||||||||||||
| 2925 | - | |||||||||||||||||||||||||
| 2926 | QDomElement QDomNode::firstChildElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2927 | { | - | ||||||||||||||||||||||||
| 2928 | for (QDomNode child = firstChild(); !child.isNull(); child = child.nextSibling()) {
| 0-79 | ||||||||||||||||||||||||
| 2929 | if (child.isElement()) {
| 0-79 | ||||||||||||||||||||||||
| 2930 | QDomElement elt = child.toElement(); | - | ||||||||||||||||||||||||
| 2931 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0-79 | ||||||||||||||||||||||||
| 2932 | return elt; executed 79 times by 1 test: return elt;Executed by:
| 79 | ||||||||||||||||||||||||
| 2933 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2934 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2935 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2936 | } | - | ||||||||||||||||||||||||
| 2937 | - | |||||||||||||||||||||||||
| 2938 | /*! | - | ||||||||||||||||||||||||
| 2939 | Returns the last child element with tag name \a tagName if tagName is non-empty; | - | ||||||||||||||||||||||||
| 2940 | otherwise returns the last child element. Returns a null element if no | - | ||||||||||||||||||||||||
| 2941 | such child exists. | - | ||||||||||||||||||||||||
| 2942 | - | |||||||||||||||||||||||||
| 2943 | \sa firstChildElement(), previousSiblingElement(), nextSiblingElement() | - | ||||||||||||||||||||||||
| 2944 | */ | - | ||||||||||||||||||||||||
| 2945 | - | |||||||||||||||||||||||||
| 2946 | QDomElement QDomNode::lastChildElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2947 | { | - | ||||||||||||||||||||||||
| 2948 | for (QDomNode child = lastChild(); !child.isNull(); child = child.previousSibling()) {
| 0 | ||||||||||||||||||||||||
| 2949 | if (child.isElement()) {
| 0 | ||||||||||||||||||||||||
| 2950 | QDomElement elt = child.toElement(); | - | ||||||||||||||||||||||||
| 2951 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0 | ||||||||||||||||||||||||
| 2952 | return elt; never executed: return elt; | 0 | ||||||||||||||||||||||||
| 2953 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2954 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2955 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2956 | } | - | ||||||||||||||||||||||||
| 2957 | - | |||||||||||||||||||||||||
| 2958 | /*! | - | ||||||||||||||||||||||||
| 2959 | Returns the next sibling element with tag name \a tagName if \a tagName | - | ||||||||||||||||||||||||
| 2960 | is non-empty; otherwise returns any next sibling element. | - | ||||||||||||||||||||||||
| 2961 | Returns a null element if no such sibling exists. | - | ||||||||||||||||||||||||
| 2962 | - | |||||||||||||||||||||||||
| 2963 | \sa firstChildElement(), previousSiblingElement(), lastChildElement() | - | ||||||||||||||||||||||||
| 2964 | */ | - | ||||||||||||||||||||||||
| 2965 | - | |||||||||||||||||||||||||
| 2966 | QDomElement QDomNode::nextSiblingElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2967 | { | - | ||||||||||||||||||||||||
| 2968 | for (QDomNode sib = nextSibling(); !sib.isNull(); sib = sib.nextSibling()) {
| 0 | ||||||||||||||||||||||||
| 2969 | if (sib.isElement()) {
| 0 | ||||||||||||||||||||||||
| 2970 | QDomElement elt = sib.toElement(); | - | ||||||||||||||||||||||||
| 2971 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0 | ||||||||||||||||||||||||
| 2972 | return elt; never executed: return elt; | 0 | ||||||||||||||||||||||||
| 2973 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2974 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2975 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2976 | } | - | ||||||||||||||||||||||||
| 2977 | - | |||||||||||||||||||||||||
| 2978 | /*! | - | ||||||||||||||||||||||||
| 2979 | Returns the previous sibilng element with tag name \a tagName if \a tagName | - | ||||||||||||||||||||||||
| 2980 | is non-empty; otherwise returns any previous sibling element. | - | ||||||||||||||||||||||||
| 2981 | Returns a null element if no such sibling exists. | - | ||||||||||||||||||||||||
| 2982 | - | |||||||||||||||||||||||||
| 2983 | \sa firstChildElement(), nextSiblingElement(), lastChildElement() | - | ||||||||||||||||||||||||
| 2984 | */ | - | ||||||||||||||||||||||||
| 2985 | - | |||||||||||||||||||||||||
| 2986 | QDomElement QDomNode::previousSiblingElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2987 | { | - | ||||||||||||||||||||||||
| 2988 | for (QDomNode sib = previousSibling(); !sib.isNull(); sib = sib.previousSibling()) {
| 0-1 | ||||||||||||||||||||||||
| 2989 | if (sib.isElement()) {
| 0-1 | ||||||||||||||||||||||||
| 2990 | QDomElement elt = sib.toElement(); | - | ||||||||||||||||||||||||
| 2991 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0-1 | ||||||||||||||||||||||||
| 2992 | return elt; executed 1 time by 1 test: return elt;Executed by:
| 1 | ||||||||||||||||||||||||
| 2993 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2994 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2995 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2996 | } | - | ||||||||||||||||||||||||
| 2997 | - | |||||||||||||||||||||||||
| 2998 | /*! | - | ||||||||||||||||||||||||
| 2999 | \since 4.1 | - | ||||||||||||||||||||||||
| 3000 | - | |||||||||||||||||||||||||
| 3001 | For nodes created by QDomDocument::setContent(), this function | - | ||||||||||||||||||||||||
| 3002 | returns the line number in the XML document where the node was parsed. | - | ||||||||||||||||||||||||
| 3003 | Otherwise, -1 is returned. | - | ||||||||||||||||||||||||
| 3004 | - | |||||||||||||||||||||||||
| 3005 | \sa columnNumber(), QDomDocument::setContent() | - | ||||||||||||||||||||||||
| 3006 | */ | - | ||||||||||||||||||||||||
| 3007 | int QDomNode::lineNumber() const | - | ||||||||||||||||||||||||
| 3008 | { | - | ||||||||||||||||||||||||
| 3009 | return impl ? impl->lineNumber : -1; never executed: return impl ? impl->lineNumber : -1; | 0 | ||||||||||||||||||||||||
| 3010 | } | - | ||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||
| 3012 | /*! | - | ||||||||||||||||||||||||
| 3013 | \since 4.1 | - | ||||||||||||||||||||||||
| 3014 | - | |||||||||||||||||||||||||
| 3015 | For nodes created by QDomDocument::setContent(), this function | - | ||||||||||||||||||||||||
| 3016 | returns the column number in the XML document where the node was parsed. | - | ||||||||||||||||||||||||
| 3017 | Otherwise, -1 is returned. | - | ||||||||||||||||||||||||
| 3018 | - | |||||||||||||||||||||||||
| 3019 | \sa lineNumber(), QDomDocument::setContent() | - | ||||||||||||||||||||||||
| 3020 | */ | - | ||||||||||||||||||||||||
| 3021 | int QDomNode::columnNumber() const | - | ||||||||||||||||||||||||
| 3022 | { | - | ||||||||||||||||||||||||
| 3023 | return impl ? impl->columnNumber : -1; never executed: return impl ? impl->columnNumber : -1; | 0 | ||||||||||||||||||||||||
| 3024 | } | - | ||||||||||||||||||||||||
| 3025 | - | |||||||||||||||||||||||||
| 3026 | - | |||||||||||||||||||||||||
| 3027 | /************************************************************** | - | ||||||||||||||||||||||||
| 3028 | * | - | ||||||||||||||||||||||||
| 3029 | * QDomNamedNodeMapPrivate | - | ||||||||||||||||||||||||
| 3030 | * | - | ||||||||||||||||||||||||
| 3031 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3032 | - | |||||||||||||||||||||||||
| 3033 | QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n) : ref(1) | - | ||||||||||||||||||||||||
| 3034 | { | - | ||||||||||||||||||||||||
| 3035 | readonly = false; | - | ||||||||||||||||||||||||
| 3036 | parent = n; | - | ||||||||||||||||||||||||
| 3037 | appendToParent = false; | - | ||||||||||||||||||||||||
| 3038 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3039 | - | |||||||||||||||||||||||||
| 3040 | QDomNamedNodeMapPrivate::~QDomNamedNodeMapPrivate() | - | ||||||||||||||||||||||||
| 3041 | { | - | ||||||||||||||||||||||||
| 3042 | clearMap(); | - | ||||||||||||||||||||||||
| 3043 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3044 | - | |||||||||||||||||||||||||
| 3045 | QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) | - | ||||||||||||||||||||||||
| 3046 | { | - | ||||||||||||||||||||||||
| 3047 | QScopedPointer<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(p)); | - | ||||||||||||||||||||||||
| 3048 | m->readonly = readonly; | - | ||||||||||||||||||||||||
| 3049 | m->appendToParent = appendToParent; | - | ||||||||||||||||||||||||
| 3050 | - | |||||||||||||||||||||||||
| 3051 | QHash<QString, QDomNodePrivate*>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3052 | for (; it != map.constEnd(); ++it) {
| 0 | ||||||||||||||||||||||||
| 3053 | QDomNodePrivate *new_node = (*it)->cloneNode(); | - | ||||||||||||||||||||||||
| 3054 | new_node->setParent(p); | - | ||||||||||||||||||||||||
| 3055 | m->setNamedItem(new_node); | - | ||||||||||||||||||||||||
| 3056 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3057 | - | |||||||||||||||||||||||||
| 3058 | // we are no longer interested in ownership | - | ||||||||||||||||||||||||
| 3059 | m->ref.deref(); | - | ||||||||||||||||||||||||
| 3060 | return m.take(); never executed: return m.take(); | 0 | ||||||||||||||||||||||||
| 3061 | } | - | ||||||||||||||||||||||||
| 3062 | - | |||||||||||||||||||||||||
| 3063 | void QDomNamedNodeMapPrivate::clearMap() | - | ||||||||||||||||||||||||
| 3064 | { | - | ||||||||||||||||||||||||
| 3065 | // Dereference all of our children if we took references | - | ||||||||||||||||||||||||
| 3066 | if (!appendToParent) {
| 976-1023 | ||||||||||||||||||||||||
| 3067 | QHash<QString, QDomNodePrivate *>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3068 | for (; it != map.constEnd(); ++it)
| 867-1023 | ||||||||||||||||||||||||
| 3069 | if (!(*it)->ref.deref())
| 0-867 | ||||||||||||||||||||||||
| 3070 | delete *it; executed 867 times by 4 tests: delete *it;Executed by:
| 867 | ||||||||||||||||||||||||
| 3071 | } executed 1023 times by 5 tests: end of blockExecuted by:
| 1023 | ||||||||||||||||||||||||
| 3072 | map.clear(); | - | ||||||||||||||||||||||||
| 3073 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3074 | - | |||||||||||||||||||||||||
| 3075 | QDomNodePrivate* QDomNamedNodeMapPrivate::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 3076 | { | - | ||||||||||||||||||||||||
| 3077 | QDomNodePrivate* p = map[name]; | - | ||||||||||||||||||||||||
| 3078 | return p; executed 900 times by 3 tests: return p;Executed by:
| 900 | ||||||||||||||||||||||||
| 3079 | } | - | ||||||||||||||||||||||||
| 3080 | - | |||||||||||||||||||||||||
| 3081 | QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 3082 | { | - | ||||||||||||||||||||||||
| 3083 | QHash<QString, QDomNodePrivate *>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3084 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 3085 | for (; it != map.constEnd(); ++it) {
| 0-2 | ||||||||||||||||||||||||
| 3086 | n = *it; | - | ||||||||||||||||||||||||
| 3087 | if (!n->prefix.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3088 | // node has a namespace | - | ||||||||||||||||||||||||
| 3089 | if (n->namespaceURI == nsURI && n->name == localName)
| 0 | ||||||||||||||||||||||||
| 3090 | return n; never executed: return n; | 0 | ||||||||||||||||||||||||
| 3091 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3092 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3093 | return 0; executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||||||||
| 3094 | } | - | ||||||||||||||||||||||||
| 3095 | - | |||||||||||||||||||||||||
| 3096 | QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg) | - | ||||||||||||||||||||||||
| 3097 | { | - | ||||||||||||||||||||||||
| 3098 | if (readonly || !arg)
| 0-867 | ||||||||||||||||||||||||
| 3099 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3100 | - | |||||||||||||||||||||||||
| 3101 | if (appendToParent)
| 0-867 | ||||||||||||||||||||||||
| 3102 | return parent->appendChild(arg); never executed: return parent->appendChild(arg); | 0 | ||||||||||||||||||||||||
| 3103 | - | |||||||||||||||||||||||||
| 3104 | QDomNodePrivate *n = map.value(arg->nodeName()); | - | ||||||||||||||||||||||||
| 3105 | // We take a reference | - | ||||||||||||||||||||||||
| 3106 | arg->ref.ref(); | - | ||||||||||||||||||||||||
| 3107 | map.insertMulti(arg->nodeName(), arg); | - | ||||||||||||||||||||||||
| 3108 | return n; executed 867 times by 4 tests: return n;Executed by:
| 867 | ||||||||||||||||||||||||
| 3109 | } | - | ||||||||||||||||||||||||
| 3110 | - | |||||||||||||||||||||||||
| 3111 | QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg) | - | ||||||||||||||||||||||||
| 3112 | { | - | ||||||||||||||||||||||||
| 3113 | if (readonly || !arg)
| 0 | ||||||||||||||||||||||||
| 3114 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3115 | - | |||||||||||||||||||||||||
| 3116 | if (appendToParent)
| 0 | ||||||||||||||||||||||||
| 3117 | return parent->appendChild(arg); never executed: return parent->appendChild(arg); | 0 | ||||||||||||||||||||||||
| 3118 | - | |||||||||||||||||||||||||
| 3119 | if (!arg->prefix.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3120 | // node has a namespace | - | ||||||||||||||||||||||||
| 3121 | QDomNodePrivate *n = namedItemNS(arg->namespaceURI, arg->name); | - | ||||||||||||||||||||||||
| 3122 | // We take a reference | - | ||||||||||||||||||||||||
| 3123 | arg->ref.ref(); | - | ||||||||||||||||||||||||
| 3124 | map.insertMulti(arg->nodeName(), arg); | - | ||||||||||||||||||||||||
| 3125 | return n; never executed: return n; | 0 | ||||||||||||||||||||||||
| 3126 | } else { | - | ||||||||||||||||||||||||
| 3127 | // ### check the following code if it is ok | - | ||||||||||||||||||||||||
| 3128 | return setNamedItem(arg); never executed: return setNamedItem(arg); | 0 | ||||||||||||||||||||||||
| 3129 | } | - | ||||||||||||||||||||||||
| 3130 | } | - | ||||||||||||||||||||||||
| 3131 | - | |||||||||||||||||||||||||
| 3132 | QDomNodePrivate* QDomNamedNodeMapPrivate::removeNamedItem(const QString& name) | - | ||||||||||||||||||||||||
| 3133 | { | - | ||||||||||||||||||||||||
| 3134 | if (readonly)
| 0 | ||||||||||||||||||||||||
| 3135 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3136 | - | |||||||||||||||||||||||||
| 3137 | QDomNodePrivate* p = namedItem(name); | - | ||||||||||||||||||||||||
| 3138 | if (p == 0)
| 0 | ||||||||||||||||||||||||
| 3139 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3140 | if (appendToParent)
| 0 | ||||||||||||||||||||||||
| 3141 | return parent->removeChild(p); never executed: return parent->removeChild(p); | 0 | ||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||
| 3143 | map.remove(p->nodeName()); | - | ||||||||||||||||||||||||
| 3144 | // We took a reference, so we have to free one here | - | ||||||||||||||||||||||||
| 3145 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3146 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3147 | } | - | ||||||||||||||||||||||||
| 3148 | - | |||||||||||||||||||||||||
| 3149 | QDomNodePrivate* QDomNamedNodeMapPrivate::item(int index) const | - | ||||||||||||||||||||||||
| 3150 | { | - | ||||||||||||||||||||||||
| 3151 | if (index >= length() || index < 0)
| 0 | ||||||||||||||||||||||||
| 3152 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3153 | return *(map.constBegin() + index); never executed: return *(map.constBegin() + index); | 0 | ||||||||||||||||||||||||
| 3154 | } | - | ||||||||||||||||||||||||
| 3155 | - | |||||||||||||||||||||||||
| 3156 | int QDomNamedNodeMapPrivate::length() const | - | ||||||||||||||||||||||||
| 3157 | { | - | ||||||||||||||||||||||||
| 3158 | return map.count(); executed 26 times by 1 test: return map.count();Executed by:
| 26 | ||||||||||||||||||||||||
| 3159 | } | - | ||||||||||||||||||||||||
| 3160 | - | |||||||||||||||||||||||||
| 3161 | bool QDomNamedNodeMapPrivate::contains(const QString& name) const | - | ||||||||||||||||||||||||
| 3162 | { | - | ||||||||||||||||||||||||
| 3163 | return map.value(name) != 0; never executed: return map.value(name) != 0; | 0 | ||||||||||||||||||||||||
| 3164 | } | - | ||||||||||||||||||||||||
| 3165 | - | |||||||||||||||||||||||||
| 3166 | bool QDomNamedNodeMapPrivate::containsNS(const QString& nsURI, const QString & localName) const | - | ||||||||||||||||||||||||
| 3167 | { | - | ||||||||||||||||||||||||
| 3168 | return namedItemNS(nsURI, localName) != 0; never executed: return namedItemNS(nsURI, localName) != 0; | 0 | ||||||||||||||||||||||||
| 3169 | } | - | ||||||||||||||||||||||||
| 3170 | - | |||||||||||||||||||||||||
| 3171 | /************************************************************** | - | ||||||||||||||||||||||||
| 3172 | * | - | ||||||||||||||||||||||||
| 3173 | * QDomNamedNodeMap | - | ||||||||||||||||||||||||
| 3174 | * | - | ||||||||||||||||||||||||
| 3175 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3176 | - | |||||||||||||||||||||||||
| 3177 | #define IMPL ((QDomNamedNodeMapPrivate*)impl) | - | ||||||||||||||||||||||||
| 3178 | - | |||||||||||||||||||||||||
| 3179 | /*! | - | ||||||||||||||||||||||||
| 3180 | \class QDomNamedNodeMap | - | ||||||||||||||||||||||||
| 3181 | \reentrant | - | ||||||||||||||||||||||||
| 3182 | \brief The QDomNamedNodeMap class contains a collection of nodes | - | ||||||||||||||||||||||||
| 3183 | that can be accessed by name. | - | ||||||||||||||||||||||||
| 3184 | - | |||||||||||||||||||||||||
| 3185 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3186 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3187 | - | |||||||||||||||||||||||||
| 3188 | Note that QDomNamedNodeMap does not inherit from QDomNodeList. | - | ||||||||||||||||||||||||
| 3189 | QDomNamedNodeMaps do not provide any specific node ordering. | - | ||||||||||||||||||||||||
| 3190 | Although nodes in a QDomNamedNodeMap may be accessed by an ordinal | - | ||||||||||||||||||||||||
| 3191 | index, this is simply to allow a convenient enumeration of the | - | ||||||||||||||||||||||||
| 3192 | contents of a QDomNamedNodeMap, and does not imply that the DOM | - | ||||||||||||||||||||||||
| 3193 | specifies an ordering of the nodes. | - | ||||||||||||||||||||||||
| 3194 | - | |||||||||||||||||||||||||
| 3195 | The QDomNamedNodeMap is used in three places: | - | ||||||||||||||||||||||||
| 3196 | \list 1 | - | ||||||||||||||||||||||||
| 3197 | \li QDomDocumentType::entities() returns a map of all entities | - | ||||||||||||||||||||||||
| 3198 | described in the DTD. | - | ||||||||||||||||||||||||
| 3199 | \li QDomDocumentType::notations() returns a map of all notations | - | ||||||||||||||||||||||||
| 3200 | described in the DTD. | - | ||||||||||||||||||||||||
| 3201 | \li QDomNode::attributes() returns a map of all attributes of an | - | ||||||||||||||||||||||||
| 3202 | element. | - | ||||||||||||||||||||||||
| 3203 | \endlist | - | ||||||||||||||||||||||||
| 3204 | - | |||||||||||||||||||||||||
| 3205 | Items in the map are identified by the name which QDomNode::name() | - | ||||||||||||||||||||||||
| 3206 | returns. Nodes are retrieved using namedItem(), namedItemNS() or | - | ||||||||||||||||||||||||
| 3207 | item(). New nodes are inserted with setNamedItem() or | - | ||||||||||||||||||||||||
| 3208 | setNamedItemNS() and removed with removeNamedItem() or | - | ||||||||||||||||||||||||
| 3209 | removeNamedItemNS(). Use contains() to see if an item with the | - | ||||||||||||||||||||||||
| 3210 | given name is in the named node map. The number of items is | - | ||||||||||||||||||||||||
| 3211 | returned by length(). | - | ||||||||||||||||||||||||
| 3212 | - | |||||||||||||||||||||||||
| 3213 | Terminology: in this class we use "item" and "node" | - | ||||||||||||||||||||||||
| 3214 | interchangeably. | - | ||||||||||||||||||||||||
| 3215 | */ | - | ||||||||||||||||||||||||
| 3216 | - | |||||||||||||||||||||||||
| 3217 | /*! | - | ||||||||||||||||||||||||
| 3218 | Constructs an empty named node map. | - | ||||||||||||||||||||||||
| 3219 | */ | - | ||||||||||||||||||||||||
| 3220 | QDomNamedNodeMap::QDomNamedNodeMap() | - | ||||||||||||||||||||||||
| 3221 | { | - | ||||||||||||||||||||||||
| 3222 | impl = 0; | - | ||||||||||||||||||||||||
| 3223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3224 | - | |||||||||||||||||||||||||
| 3225 | /*! | - | ||||||||||||||||||||||||
| 3226 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 3227 | */ | - | ||||||||||||||||||||||||
| 3228 | QDomNamedNodeMap::QDomNamedNodeMap(const QDomNamedNodeMap &n) | - | ||||||||||||||||||||||||
| 3229 | { | - | ||||||||||||||||||||||||
| 3230 | impl = n.impl; | - | ||||||||||||||||||||||||
| 3231 | if (impl)
| 0 | ||||||||||||||||||||||||
| 3232 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3233 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3234 | - | |||||||||||||||||||||||||
| 3235 | QDomNamedNodeMap::QDomNamedNodeMap(QDomNamedNodeMapPrivate *n) | - | ||||||||||||||||||||||||
| 3236 | { | - | ||||||||||||||||||||||||
| 3237 | impl = n; | - | ||||||||||||||||||||||||
| 3238 | if (impl)
| 0 | ||||||||||||||||||||||||
| 3239 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3241 | - | |||||||||||||||||||||||||
| 3242 | /*! | - | ||||||||||||||||||||||||
| 3243 | Assigns \a n to this named node map. | - | ||||||||||||||||||||||||
| 3244 | */ | - | ||||||||||||||||||||||||
| 3245 | QDomNamedNodeMap& QDomNamedNodeMap::operator=(const QDomNamedNodeMap &n) | - | ||||||||||||||||||||||||
| 3246 | { | - | ||||||||||||||||||||||||
| 3247 | if (n.impl)
| 0 | ||||||||||||||||||||||||
| 3248 | n.impl->ref.ref(); never executed: n.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3249 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 3250 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 3251 | impl = n.impl; | - | ||||||||||||||||||||||||
| 3252 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 3253 | } | - | ||||||||||||||||||||||||
| 3254 | - | |||||||||||||||||||||||||
| 3255 | /*! | - | ||||||||||||||||||||||||
| 3256 | Returns \c true if \a n and this named node map are equal; otherwise | - | ||||||||||||||||||||||||
| 3257 | returns \c false. | - | ||||||||||||||||||||||||
| 3258 | */ | - | ||||||||||||||||||||||||
| 3259 | bool QDomNamedNodeMap::operator== (const QDomNamedNodeMap& n) const | - | ||||||||||||||||||||||||
| 3260 | { | - | ||||||||||||||||||||||||
| 3261 | return (impl == n.impl); never executed: return (impl == n.impl); | 0 | ||||||||||||||||||||||||
| 3262 | } | - | ||||||||||||||||||||||||
| 3263 | - | |||||||||||||||||||||||||
| 3264 | /*! | - | ||||||||||||||||||||||||
| 3265 | Returns \c true if \a n and this named node map are not equal; | - | ||||||||||||||||||||||||
| 3266 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 3267 | */ | - | ||||||||||||||||||||||||
| 3268 | bool QDomNamedNodeMap::operator!= (const QDomNamedNodeMap& n) const | - | ||||||||||||||||||||||||
| 3269 | { | - | ||||||||||||||||||||||||
| 3270 | return (impl != n.impl); never executed: return (impl != n.impl); | 0 | ||||||||||||||||||||||||
| 3271 | } | - | ||||||||||||||||||||||||
| 3272 | - | |||||||||||||||||||||||||
| 3273 | /*! | - | ||||||||||||||||||||||||
| 3274 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 3275 | */ | - | ||||||||||||||||||||||||
| 3276 | QDomNamedNodeMap::~QDomNamedNodeMap() | - | ||||||||||||||||||||||||
| 3277 | { | - | ||||||||||||||||||||||||
| 3278 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 3279 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 3280 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3281 | - | |||||||||||||||||||||||||
| 3282 | /*! | - | ||||||||||||||||||||||||
| 3283 | Returns the node called \a name. | - | ||||||||||||||||||||||||
| 3284 | - | |||||||||||||||||||||||||
| 3285 | If the named node map does not contain such a node, a | - | ||||||||||||||||||||||||
| 3286 | \l{QDomNode::isNull()}{null node} is returned. A node's name is | - | ||||||||||||||||||||||||
| 3287 | the name returned by QDomNode::nodeName(). | - | ||||||||||||||||||||||||
| 3288 | - | |||||||||||||||||||||||||
| 3289 | \sa setNamedItem(), namedItemNS() | - | ||||||||||||||||||||||||
| 3290 | */ | - | ||||||||||||||||||||||||
| 3291 | QDomNode QDomNamedNodeMap::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 3292 | { | - | ||||||||||||||||||||||||
| 3293 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3294 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3295 | return QDomNode(IMPL->namedItem(name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->namedItem(name)); | 0 | ||||||||||||||||||||||||
| 3296 | } | - | ||||||||||||||||||||||||
| 3297 | - | |||||||||||||||||||||||||
| 3298 | /*! | - | ||||||||||||||||||||||||
| 3299 | Inserts the node \a newNode into the named node map. The name used | - | ||||||||||||||||||||||||
| 3300 | by the map is the node name of \a newNode as returned by | - | ||||||||||||||||||||||||
| 3301 | QDomNode::nodeName(). | - | ||||||||||||||||||||||||
| 3302 | - | |||||||||||||||||||||||||
| 3303 | If the new node replaces an existing node, i.e. the map contains a | - | ||||||||||||||||||||||||
| 3304 | node with the same name, the replaced node is returned. | - | ||||||||||||||||||||||||
| 3305 | - | |||||||||||||||||||||||||
| 3306 | \sa namedItem(), removeNamedItem(), setNamedItemNS() | - | ||||||||||||||||||||||||
| 3307 | */ | - | ||||||||||||||||||||||||
| 3308 | QDomNode QDomNamedNodeMap::setNamedItem(const QDomNode& newNode) | - | ||||||||||||||||||||||||
| 3309 | { | - | ||||||||||||||||||||||||
| 3310 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3311 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3312 | return QDomNode(IMPL->setNamedItem((QDomNodePrivate*)newNode.impl)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->setNamedItem((QDomNodePrivate*)newNode.impl)); | 0 | ||||||||||||||||||||||||
| 3313 | } | - | ||||||||||||||||||||||||
| 3314 | - | |||||||||||||||||||||||||
| 3315 | /*! | - | ||||||||||||||||||||||||
| 3316 | Removes the node called \a name from the map. | - | ||||||||||||||||||||||||
| 3317 | - | |||||||||||||||||||||||||
| 3318 | The function returns the removed node or a | - | ||||||||||||||||||||||||
| 3319 | \l{QDomNode::isNull()}{null node} if the map did not contain a | - | ||||||||||||||||||||||||
| 3320 | node called \a name. | - | ||||||||||||||||||||||||
| 3321 | - | |||||||||||||||||||||||||
| 3322 | \sa setNamedItem(), namedItem(), removeNamedItemNS() | - | ||||||||||||||||||||||||
| 3323 | */ | - | ||||||||||||||||||||||||
| 3324 | QDomNode QDomNamedNodeMap::removeNamedItem(const QString& name) | - | ||||||||||||||||||||||||
| 3325 | { | - | ||||||||||||||||||||||||
| 3326 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3327 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3328 | return QDomNode(IMPL->removeNamedItem(name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->removeNamedItem(name)); | 0 | ||||||||||||||||||||||||
| 3329 | } | - | ||||||||||||||||||||||||
| 3330 | - | |||||||||||||||||||||||||
| 3331 | /*! | - | ||||||||||||||||||||||||
| 3332 | Retrieves the node at position \a index. | - | ||||||||||||||||||||||||
| 3333 | - | |||||||||||||||||||||||||
| 3334 | This can be used to iterate over the map. Note that the nodes in | - | ||||||||||||||||||||||||
| 3335 | the map are ordered arbitrarily. | - | ||||||||||||||||||||||||
| 3336 | - | |||||||||||||||||||||||||
| 3337 | \sa length() | - | ||||||||||||||||||||||||
| 3338 | */ | - | ||||||||||||||||||||||||
| 3339 | QDomNode QDomNamedNodeMap::item(int index) const | - | ||||||||||||||||||||||||
| 3340 | { | - | ||||||||||||||||||||||||
| 3341 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3342 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3343 | return QDomNode(IMPL->item(index)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->item(index)); | 0 | ||||||||||||||||||||||||
| 3344 | } | - | ||||||||||||||||||||||||
| 3345 | - | |||||||||||||||||||||||||
| 3346 | /*! | - | ||||||||||||||||||||||||
| 3347 | Returns the node associated with the local name \a localName and | - | ||||||||||||||||||||||||
| 3348 | the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 3349 | - | |||||||||||||||||||||||||
| 3350 | If the map does not contain such a node, | - | ||||||||||||||||||||||||
| 3351 | a \l{QDomNode::isNull()}{null node} is returned. | - | ||||||||||||||||||||||||
| 3352 | - | |||||||||||||||||||||||||
| 3353 | \sa setNamedItemNS(), namedItem() | - | ||||||||||||||||||||||||
| 3354 | */ | - | ||||||||||||||||||||||||
| 3355 | QDomNode QDomNamedNodeMap::namedItemNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 3356 | { | - | ||||||||||||||||||||||||
| 3357 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3358 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3359 | return QDomNode(IMPL->namedItemNS(nsURI, localName)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->namedItemNS(nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 3360 | } | - | ||||||||||||||||||||||||
| 3361 | - | |||||||||||||||||||||||||
| 3362 | /*! | - | ||||||||||||||||||||||||
| 3363 | Inserts the node \a newNode in the map. If a node with the same | - | ||||||||||||||||||||||||
| 3364 | namespace URI and the same local name already exists in the map, | - | ||||||||||||||||||||||||
| 3365 | it is replaced by \a newNode. If the new node replaces an existing | - | ||||||||||||||||||||||||
| 3366 | node, the replaced node is returned. | - | ||||||||||||||||||||||||
| 3367 | - | |||||||||||||||||||||||||
| 3368 | \sa namedItemNS(), removeNamedItemNS(), setNamedItem() | - | ||||||||||||||||||||||||
| 3369 | */ | - | ||||||||||||||||||||||||
| 3370 | QDomNode QDomNamedNodeMap::setNamedItemNS(const QDomNode& newNode) | - | ||||||||||||||||||||||||
| 3371 | { | - | ||||||||||||||||||||||||
| 3372 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3373 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3374 | return QDomNode(IMPL->setNamedItemNS((QDomNodePrivate*)newNode.impl)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->setNamedItemNS((QDomNodePrivate*)newNode.impl)); | 0 | ||||||||||||||||||||||||
| 3375 | } | - | ||||||||||||||||||||||||
| 3376 | - | |||||||||||||||||||||||||
| 3377 | /*! | - | ||||||||||||||||||||||||
| 3378 | Removes the node with the local name \a localName and the | - | ||||||||||||||||||||||||
| 3379 | namespace URI \a nsURI from the map. | - | ||||||||||||||||||||||||
| 3380 | - | |||||||||||||||||||||||||
| 3381 | The function returns the removed node or a | - | ||||||||||||||||||||||||
| 3382 | \l{QDomNode::isNull()}{null node} if the map did not contain a | - | ||||||||||||||||||||||||
| 3383 | node with the local name \a localName and the namespace URI \a | - | ||||||||||||||||||||||||
| 3384 | nsURI. | - | ||||||||||||||||||||||||
| 3385 | - | |||||||||||||||||||||||||
| 3386 | \sa setNamedItemNS(), namedItemNS(), removeNamedItem() | - | ||||||||||||||||||||||||
| 3387 | */ | - | ||||||||||||||||||||||||
| 3388 | QDomNode QDomNamedNodeMap::removeNamedItemNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 3389 | { | - | ||||||||||||||||||||||||
| 3390 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3391 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3392 | QDomNodePrivate *n = IMPL->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 3393 | if (!n)
| 0 | ||||||||||||||||||||||||
| 3394 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3395 | return QDomNode(IMPL->removeNamedItem(n->name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->removeNamedItem(n->name)); | 0 | ||||||||||||||||||||||||
| 3396 | } | - | ||||||||||||||||||||||||
| 3397 | - | |||||||||||||||||||||||||
| 3398 | /*! | - | ||||||||||||||||||||||||
| 3399 | Returns the number of nodes in the map. | - | ||||||||||||||||||||||||
| 3400 | - | |||||||||||||||||||||||||
| 3401 | \sa item() | - | ||||||||||||||||||||||||
| 3402 | */ | - | ||||||||||||||||||||||||
| 3403 | int QDomNamedNodeMap::length() const | - | ||||||||||||||||||||||||
| 3404 | { | - | ||||||||||||||||||||||||
| 3405 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3406 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3407 | return IMPL->length(); never executed: return ((QDomNamedNodeMapPrivate*)impl)->length(); | 0 | ||||||||||||||||||||||||
| 3408 | } | - | ||||||||||||||||||||||||
| 3409 | - | |||||||||||||||||||||||||
| 3410 | /*! | - | ||||||||||||||||||||||||
| 3411 | \fn bool QDomNamedNodeMap::isEmpty() const | - | ||||||||||||||||||||||||
| 3412 | - | |||||||||||||||||||||||||
| 3413 | Returns \c true if the map is empty; otherwise returns \c false. This function is | - | ||||||||||||||||||||||||
| 3414 | provided for Qt API consistency. | - | ||||||||||||||||||||||||
| 3415 | */ | - | ||||||||||||||||||||||||
| 3416 | - | |||||||||||||||||||||||||
| 3417 | /*! | - | ||||||||||||||||||||||||
| 3418 | \fn int QDomNamedNodeMap::count() const | - | ||||||||||||||||||||||||
| 3419 | - | |||||||||||||||||||||||||
| 3420 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 3421 | */ | - | ||||||||||||||||||||||||
| 3422 | - | |||||||||||||||||||||||||
| 3423 | /*! | - | ||||||||||||||||||||||||
| 3424 | \fn int QDomNamedNodeMap::size() const | - | ||||||||||||||||||||||||
| 3425 | - | |||||||||||||||||||||||||
| 3426 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 3427 | */ | - | ||||||||||||||||||||||||
| 3428 | - | |||||||||||||||||||||||||
| 3429 | /*! | - | ||||||||||||||||||||||||
| 3430 | Returns \c true if the map contains a node called \a name; otherwise | - | ||||||||||||||||||||||||
| 3431 | returns \c false. | - | ||||||||||||||||||||||||
| 3432 | - | |||||||||||||||||||||||||
| 3433 | \b{Note:} This function does not take the presence of namespaces into account. | - | ||||||||||||||||||||||||
| 3434 | Use namedItemNS() to test whether the map contains a node with a specific namespace | - | ||||||||||||||||||||||||
| 3435 | URI and name. | - | ||||||||||||||||||||||||
| 3436 | */ | - | ||||||||||||||||||||||||
| 3437 | bool QDomNamedNodeMap::contains(const QString& name) const | - | ||||||||||||||||||||||||
| 3438 | { | - | ||||||||||||||||||||||||
| 3439 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3440 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 3441 | return IMPL->contains(name); never executed: return ((QDomNamedNodeMapPrivate*)impl)->contains(name); | 0 | ||||||||||||||||||||||||
| 3442 | } | - | ||||||||||||||||||||||||
| 3443 | - | |||||||||||||||||||||||||
| 3444 | #undef IMPL | - | ||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||
| 3446 | /************************************************************** | - | ||||||||||||||||||||||||
| 3447 | * | - | ||||||||||||||||||||||||
| 3448 | * QDomDocumentTypePrivate | - | ||||||||||||||||||||||||
| 3449 | * | - | ||||||||||||||||||||||||
| 3450 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3451 | - | |||||||||||||||||||||||||
| 3452 | QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentPrivate* doc, QDomNodePrivate* parent) | - | ||||||||||||||||||||||||
| 3453 | : QDomNodePrivate(doc, parent) | - | ||||||||||||||||||||||||
| 3454 | { | - | ||||||||||||||||||||||||
| 3455 | init(); | - | ||||||||||||||||||||||||
| 3456 | } executed 488 times by 5 tests: end of blockExecuted by:
| 488 | ||||||||||||||||||||||||
| 3457 | - | |||||||||||||||||||||||||
| 3458 | QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3459 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3460 | { | - | ||||||||||||||||||||||||
| 3461 | init(); | - | ||||||||||||||||||||||||
| 3462 | // Refill the maps with our new children | - | ||||||||||||||||||||||||
| 3463 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 3464 | while (p) {
| 0 | ||||||||||||||||||||||||
| 3465 | if (p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3466 | // Don't use normal insert function since we would create infinite recursion | - | ||||||||||||||||||||||||
| 3467 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3468 | if (p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3469 | // Don't use normal insert function since we would create infinite recursion | - | ||||||||||||||||||||||||
| 3470 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3471 | p = p->next; | - | ||||||||||||||||||||||||
| 3472 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3473 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3474 | - | |||||||||||||||||||||||||
| 3475 | QDomDocumentTypePrivate::~QDomDocumentTypePrivate() | - | ||||||||||||||||||||||||
| 3476 | { | - | ||||||||||||||||||||||||
| 3477 | if (!entities->ref.deref())
| 0-488 | ||||||||||||||||||||||||
| 3478 | delete entities; executed 488 times by 5 tests: delete entities;Executed by:
| 488 | ||||||||||||||||||||||||
| 3479 | if (!notations->ref.deref())
| 0-488 | ||||||||||||||||||||||||
| 3480 | delete notations; executed 488 times by 5 tests: delete notations;Executed by:
| 488 | ||||||||||||||||||||||||
| 3481 | } executed 488 times by 5 tests: end of blockExecuted by:
| 488 | ||||||||||||||||||||||||
| 3482 | - | |||||||||||||||||||||||||
| 3483 | void QDomDocumentTypePrivate::init() | - | ||||||||||||||||||||||||
| 3484 | { | - | ||||||||||||||||||||||||
| 3485 | entities = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 3486 | QT_TRY { | - | ||||||||||||||||||||||||
| 3487 | notations = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 3488 | publicId.clear(); | - | ||||||||||||||||||||||||
| 3489 | systemId.clear(); | - | ||||||||||||||||||||||||
| 3490 | internalSubset.clear(); | - | ||||||||||||||||||||||||
| 3491 | - | |||||||||||||||||||||||||
| 3492 | entities->setAppendToParent(true); | - | ||||||||||||||||||||||||
| 3493 | notations->setAppendToParent(true); | - | ||||||||||||||||||||||||
| 3494 | } QT_CATCH(...) { executed 488 times by 5 tests: end of blockExecuted by:
dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3495 | delete entities; dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3496 | QT_RETHROW; dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3497 | } dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3498 | } | - | ||||||||||||||||||||||||
| 3499 | - | |||||||||||||||||||||||||
| 3500 | QDomNodePrivate* QDomDocumentTypePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3501 | { | - | ||||||||||||||||||||||||
| 3502 | QDomNodePrivate* p = new QDomDocumentTypePrivate(this, deep); | - | ||||||||||||||||||||||||
| 3503 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3504 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3505 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3506 | } | - | ||||||||||||||||||||||||
| 3507 | - | |||||||||||||||||||||||||
| 3508 | QDomNodePrivate* QDomDocumentTypePrivate::insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 3509 | { | - | ||||||||||||||||||||||||
| 3510 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3511 | QDomNodePrivate* p = QDomNodePrivate::insertBefore(newChild, refChild); | - | ||||||||||||||||||||||||
| 3512 | // Update the maps | - | ||||||||||||||||||||||||
| 3513 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3514 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3515 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3516 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3517 | - | |||||||||||||||||||||||||
| 3518 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3519 | } | - | ||||||||||||||||||||||||
| 3520 | - | |||||||||||||||||||||||||
| 3521 | QDomNodePrivate* QDomDocumentTypePrivate::insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 3522 | { | - | ||||||||||||||||||||||||
| 3523 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3524 | QDomNodePrivate* p = QDomNodePrivate::insertAfter(newChild, refChild); | - | ||||||||||||||||||||||||
| 3525 | // Update the maps | - | ||||||||||||||||||||||||
| 3526 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3527 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3528 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3529 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3530 | - | |||||||||||||||||||||||||
| 3531 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3532 | } | - | ||||||||||||||||||||||||
| 3533 | - | |||||||||||||||||||||||||
| 3534 | QDomNodePrivate* QDomDocumentTypePrivate::replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 3535 | { | - | ||||||||||||||||||||||||
| 3536 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3537 | QDomNodePrivate* p = QDomNodePrivate::replaceChild(newChild, oldChild); | - | ||||||||||||||||||||||||
| 3538 | // Update the maps | - | ||||||||||||||||||||||||
| 3539 | if (p) {
| 0 | ||||||||||||||||||||||||
| 3540 | if (oldChild && oldChild->isEntity())
| 0 | ||||||||||||||||||||||||
| 3541 | entities->map.remove(oldChild->nodeName()); never executed: entities->map.remove(oldChild->nodeName()); | 0 | ||||||||||||||||||||||||
| 3542 | else if (oldChild && oldChild->isNotation())
| 0 | ||||||||||||||||||||||||
| 3543 | notations->map.remove(oldChild->nodeName()); never executed: notations->map.remove(oldChild->nodeName()); | 0 | ||||||||||||||||||||||||
| 3544 | - | |||||||||||||||||||||||||
| 3545 | if (p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3546 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3547 | else if (p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3548 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3549 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3550 | - | |||||||||||||||||||||||||
| 3551 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3552 | } | - | ||||||||||||||||||||||||
| 3553 | - | |||||||||||||||||||||||||
| 3554 | QDomNodePrivate* QDomDocumentTypePrivate::removeChild(QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 3555 | { | - | ||||||||||||||||||||||||
| 3556 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3557 | QDomNodePrivate* p = QDomNodePrivate::removeChild( oldChild); | - | ||||||||||||||||||||||||
| 3558 | // Update the maps | - | ||||||||||||||||||||||||
| 3559 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3560 | entities->map.remove(p->nodeName()); never executed: entities->map.remove(p->nodeName()); | 0 | ||||||||||||||||||||||||
| 3561 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3562 | notations->map.remove(p ->nodeName()); never executed: notations->map.remove(p ->nodeName()); | 0 | ||||||||||||||||||||||||
| 3563 | - | |||||||||||||||||||||||||
| 3564 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3565 | } | - | ||||||||||||||||||||||||
| 3566 | - | |||||||||||||||||||||||||
| 3567 | QDomNodePrivate* QDomDocumentTypePrivate::appendChild(QDomNodePrivate* newChild) | - | ||||||||||||||||||||||||
| 3568 | { | - | ||||||||||||||||||||||||
| 3569 | return insertAfter(newChild, 0); never executed: return insertAfter(newChild, 0); | 0 | ||||||||||||||||||||||||
| 3570 | } | - | ||||||||||||||||||||||||
| 3571 | - | |||||||||||||||||||||||||
| 3572 | static QString quotedValue(const QString &data) | - | ||||||||||||||||||||||||
| 3573 | { | - | ||||||||||||||||||||||||
| 3574 | QChar quote = data.indexOf(QLatin1Char('\'')) == -1
| 0 | ||||||||||||||||||||||||
| 3575 | ? QLatin1Char('\'') | - | ||||||||||||||||||||||||
| 3576 | : QLatin1Char('"'); | - | ||||||||||||||||||||||||
| 3577 | return quote + data + quote; never executed: return quote + data + quote; | 0 | ||||||||||||||||||||||||
| 3578 | } | - | ||||||||||||||||||||||||
| 3579 | - | |||||||||||||||||||||||||
| 3580 | void QDomDocumentTypePrivate::save(QTextStream& s, int, int indent) const | - | ||||||||||||||||||||||||
| 3581 | { | - | ||||||||||||||||||||||||
| 3582 | if (name.isEmpty())
| 0-86 | ||||||||||||||||||||||||
| 3583 | return; executed 86 times by 2 tests: return;Executed by:
| 86 | ||||||||||||||||||||||||
| 3584 | - | |||||||||||||||||||||||||
| 3585 | s << "<!DOCTYPE " << name; | - | ||||||||||||||||||||||||
| 3586 | - | |||||||||||||||||||||||||
| 3587 | if (!publicId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3588 | s << " PUBLIC " << quotedValue(publicId); | - | ||||||||||||||||||||||||
| 3589 | if (!systemId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3590 | s << ' ' << quotedValue(systemId); | - | ||||||||||||||||||||||||
| 3591 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3592 | } else if (!systemId.isNull()) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3593 | s << " SYSTEM " << quotedValue(systemId); | - | ||||||||||||||||||||||||
| 3594 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3595 | - | |||||||||||||||||||||||||
| 3596 | if (entities->length()>0 || notations->length()>0) {
| 0 | ||||||||||||||||||||||||
| 3597 | s << " [" << endl; | - | ||||||||||||||||||||||||
| 3598 | - | |||||||||||||||||||||||||
| 3599 | QHash<QString, QDomNodePrivate *>::const_iterator it2 = notations->map.constBegin(); | - | ||||||||||||||||||||||||
| 3600 | for (; it2 != notations->map.constEnd(); ++it2)
| 0 | ||||||||||||||||||||||||
| 3601 | (*it2)->save(s, 0, indent); never executed: (*it2)->save(s, 0, indent); | 0 | ||||||||||||||||||||||||
| 3602 | - | |||||||||||||||||||||||||
| 3603 | QHash<QString, QDomNodePrivate *>::const_iterator it = entities->map.constBegin(); | - | ||||||||||||||||||||||||
| 3604 | for (; it != entities->map.constEnd(); ++it)
| 0 | ||||||||||||||||||||||||
| 3605 | (*it)->save(s, 0, indent); never executed: (*it)->save(s, 0, indent); | 0 | ||||||||||||||||||||||||
| 3606 | - | |||||||||||||||||||||||||
| 3607 | s << ']'; | - | ||||||||||||||||||||||||
| 3608 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3609 | - | |||||||||||||||||||||||||
| 3610 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 3611 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3612 | - | |||||||||||||||||||||||||
| 3613 | /************************************************************** | - | ||||||||||||||||||||||||
| 3614 | * | - | ||||||||||||||||||||||||
| 3615 | * QDomDocumentType | - | ||||||||||||||||||||||||
| 3616 | * | - | ||||||||||||||||||||||||
| 3617 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3618 | - | |||||||||||||||||||||||||
| 3619 | #define IMPL ((QDomDocumentTypePrivate*)impl) | - | ||||||||||||||||||||||||
| 3620 | - | |||||||||||||||||||||||||
| 3621 | /*! | - | ||||||||||||||||||||||||
| 3622 | \class QDomDocumentType | - | ||||||||||||||||||||||||
| 3623 | \reentrant | - | ||||||||||||||||||||||||
| 3624 | \brief The QDomDocumentType class is the representation of the DTD | - | ||||||||||||||||||||||||
| 3625 | in the document tree. | - | ||||||||||||||||||||||||
| 3626 | - | |||||||||||||||||||||||||
| 3627 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3628 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3629 | - | |||||||||||||||||||||||||
| 3630 | The QDomDocumentType class allows read-only access to some of the | - | ||||||||||||||||||||||||
| 3631 | data structures in the DTD: it can return a map of all entities() | - | ||||||||||||||||||||||||
| 3632 | and notations(). In addition the function name() returns the name | - | ||||||||||||||||||||||||
| 3633 | of the document type as specified in the <!DOCTYPE name> | - | ||||||||||||||||||||||||
| 3634 | tag. This class also provides the publicId(), systemId() and | - | ||||||||||||||||||||||||
| 3635 | internalSubset() functions. | - | ||||||||||||||||||||||||
| 3636 | - | |||||||||||||||||||||||||
| 3637 | \sa QDomDocument | - | ||||||||||||||||||||||||
| 3638 | */ | - | ||||||||||||||||||||||||
| 3639 | - | |||||||||||||||||||||||||
| 3640 | /*! | - | ||||||||||||||||||||||||
| 3641 | Creates an empty QDomDocumentType object. | - | ||||||||||||||||||||||||
| 3642 | */ | - | ||||||||||||||||||||||||
| 3643 | QDomDocumentType::QDomDocumentType() : QDomNode() | - | ||||||||||||||||||||||||
| 3644 | { | - | ||||||||||||||||||||||||
| 3645 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3646 | - | |||||||||||||||||||||||||
| 3647 | /*! | - | ||||||||||||||||||||||||
| 3648 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 3649 | - | |||||||||||||||||||||||||
| 3650 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3651 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3652 | cloneNode(). | - | ||||||||||||||||||||||||
| 3653 | */ | - | ||||||||||||||||||||||||
| 3654 | QDomDocumentType::QDomDocumentType(const QDomDocumentType& n) | - | ||||||||||||||||||||||||
| 3655 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3656 | { | - | ||||||||||||||||||||||||
| 3657 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3658 | - | |||||||||||||||||||||||||
| 3659 | QDomDocumentType::QDomDocumentType(QDomDocumentTypePrivate* n) | - | ||||||||||||||||||||||||
| 3660 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3661 | { | - | ||||||||||||||||||||||||
| 3662 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3663 | - | |||||||||||||||||||||||||
| 3664 | /*! | - | ||||||||||||||||||||||||
| 3665 | Assigns \a n to this document type. | - | ||||||||||||||||||||||||
| 3666 | - | |||||||||||||||||||||||||
| 3667 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3668 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3669 | cloneNode(). | - | ||||||||||||||||||||||||
| 3670 | */ | - | ||||||||||||||||||||||||
| 3671 | QDomDocumentType& QDomDocumentType::operator= (const QDomDocumentType& n) | - | ||||||||||||||||||||||||
| 3672 | { | - | ||||||||||||||||||||||||
| 3673 | return (QDomDocumentType&) QDomNode::operator=(n); never executed: return (QDomDocumentType&) QDomNode::operator=(n); | 0 | ||||||||||||||||||||||||
| 3674 | } | - | ||||||||||||||||||||||||
| 3675 | - | |||||||||||||||||||||||||
| 3676 | /*! | - | ||||||||||||||||||||||||
| 3677 | Returns the name of the document type as specified in the | - | ||||||||||||||||||||||||
| 3678 | <!DOCTYPE name> tag. | - | ||||||||||||||||||||||||
| 3679 | - | |||||||||||||||||||||||||
| 3680 | \sa nodeName() | - | ||||||||||||||||||||||||
| 3681 | */ | - | ||||||||||||||||||||||||
| 3682 | QString QDomDocumentType::name() const | - | ||||||||||||||||||||||||
| 3683 | { | - | ||||||||||||||||||||||||
| 3684 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3685 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3686 | return IMPL->nodeName(); never executed: return ((QDomDocumentTypePrivate*)impl)->nodeName(); | 0 | ||||||||||||||||||||||||
| 3687 | } | - | ||||||||||||||||||||||||
| 3688 | - | |||||||||||||||||||||||||
| 3689 | /*! | - | ||||||||||||||||||||||||
| 3690 | Returns a map of all entities described in the DTD. | - | ||||||||||||||||||||||||
| 3691 | */ | - | ||||||||||||||||||||||||
| 3692 | QDomNamedNodeMap QDomDocumentType::entities() const | - | ||||||||||||||||||||||||
| 3693 | { | - | ||||||||||||||||||||||||
| 3694 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3695 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 3696 | return QDomNamedNodeMap(IMPL->entities); never executed: return QDomNamedNodeMap(((QDomDocumentTypePrivate*)impl)->entities); | 0 | ||||||||||||||||||||||||
| 3697 | } | - | ||||||||||||||||||||||||
| 3698 | - | |||||||||||||||||||||||||
| 3699 | /*! | - | ||||||||||||||||||||||||
| 3700 | Returns a map of all notations described in the DTD. | - | ||||||||||||||||||||||||
| 3701 | */ | - | ||||||||||||||||||||||||
| 3702 | QDomNamedNodeMap QDomDocumentType::notations() const | - | ||||||||||||||||||||||||
| 3703 | { | - | ||||||||||||||||||||||||
| 3704 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3705 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 3706 | return QDomNamedNodeMap(IMPL->notations); never executed: return QDomNamedNodeMap(((QDomDocumentTypePrivate*)impl)->notations); | 0 | ||||||||||||||||||||||||
| 3707 | } | - | ||||||||||||||||||||||||
| 3708 | - | |||||||||||||||||||||||||
| 3709 | /*! | - | ||||||||||||||||||||||||
| 3710 | Returns the public identifier of the external DTD subset or | - | ||||||||||||||||||||||||
| 3711 | an empty string if there is no public identifier. | - | ||||||||||||||||||||||||
| 3712 | - | |||||||||||||||||||||||||
| 3713 | \sa systemId(), internalSubset(), QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 3714 | */ | - | ||||||||||||||||||||||||
| 3715 | QString QDomDocumentType::publicId() const | - | ||||||||||||||||||||||||
| 3716 | { | - | ||||||||||||||||||||||||
| 3717 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3718 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3719 | return IMPL->publicId; never executed: return ((QDomDocumentTypePrivate*)impl)->publicId; | 0 | ||||||||||||||||||||||||
| 3720 | } | - | ||||||||||||||||||||||||
| 3721 | - | |||||||||||||||||||||||||
| 3722 | /*! | - | ||||||||||||||||||||||||
| 3723 | Returns the system identifier of the external DTD subset or | - | ||||||||||||||||||||||||
| 3724 | an empty string if there is no system identifier. | - | ||||||||||||||||||||||||
| 3725 | - | |||||||||||||||||||||||||
| 3726 | \sa publicId(), internalSubset(), QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 3727 | */ | - | ||||||||||||||||||||||||
| 3728 | QString QDomDocumentType::systemId() const | - | ||||||||||||||||||||||||
| 3729 | { | - | ||||||||||||||||||||||||
| 3730 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3731 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3732 | return IMPL->systemId; never executed: return ((QDomDocumentTypePrivate*)impl)->systemId; | 0 | ||||||||||||||||||||||||
| 3733 | } | - | ||||||||||||||||||||||||
| 3734 | - | |||||||||||||||||||||||||
| 3735 | /*! | - | ||||||||||||||||||||||||
| 3736 | Returns the internal subset of the document type or an empty | - | ||||||||||||||||||||||||
| 3737 | string if there is no internal subset. | - | ||||||||||||||||||||||||
| 3738 | - | |||||||||||||||||||||||||
| 3739 | \sa publicId(), systemId() | - | ||||||||||||||||||||||||
| 3740 | */ | - | ||||||||||||||||||||||||
| 3741 | QString QDomDocumentType::internalSubset() const | - | ||||||||||||||||||||||||
| 3742 | { | - | ||||||||||||||||||||||||
| 3743 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3744 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3745 | return IMPL->internalSubset; never executed: return ((QDomDocumentTypePrivate*)impl)->internalSubset; | 0 | ||||||||||||||||||||||||
| 3746 | } | - | ||||||||||||||||||||||||
| 3747 | - | |||||||||||||||||||||||||
| 3748 | /* | - | ||||||||||||||||||||||||
| 3749 | Are these needed at all? The only difference when removing these | - | ||||||||||||||||||||||||
| 3750 | two methods in all subclasses is that we'd get a different type | - | ||||||||||||||||||||||||
| 3751 | for null nodes. | - | ||||||||||||||||||||||||
| 3752 | */ | - | ||||||||||||||||||||||||
| 3753 | - | |||||||||||||||||||||||||
| 3754 | /*! | - | ||||||||||||||||||||||||
| 3755 | \fn QDomNode::NodeType QDomDocumentType::nodeType() const | - | ||||||||||||||||||||||||
| 3756 | - | |||||||||||||||||||||||||
| 3757 | Returns \c DocumentTypeNode. | - | ||||||||||||||||||||||||
| 3758 | - | |||||||||||||||||||||||||
| 3759 | \sa isDocumentType(), QDomNode::toDocumentType() | - | ||||||||||||||||||||||||
| 3760 | */ | - | ||||||||||||||||||||||||
| 3761 | - | |||||||||||||||||||||||||
| 3762 | #undef IMPL | - | ||||||||||||||||||||||||
| 3763 | - | |||||||||||||||||||||||||
| 3764 | /************************************************************** | - | ||||||||||||||||||||||||
| 3765 | * | - | ||||||||||||||||||||||||
| 3766 | * QDomDocumentFragmentPrivate | - | ||||||||||||||||||||||||
| 3767 | * | - | ||||||||||||||||||||||||
| 3768 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3769 | - | |||||||||||||||||||||||||
| 3770 | QDomDocumentFragmentPrivate::QDomDocumentFragmentPrivate(QDomDocumentPrivate* doc, QDomNodePrivate* parent) | - | ||||||||||||||||||||||||
| 3771 | : QDomNodePrivate(doc, parent) | - | ||||||||||||||||||||||||
| 3772 | { | - | ||||||||||||||||||||||||
| 3773 | name = QLatin1String("#document-fragment"); | - | ||||||||||||||||||||||||
| 3774 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3775 | - | |||||||||||||||||||||||||
| 3776 | QDomDocumentFragmentPrivate::QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3777 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3778 | { | - | ||||||||||||||||||||||||
| 3779 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3780 | - | |||||||||||||||||||||||||
| 3781 | QDomNodePrivate* QDomDocumentFragmentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3782 | { | - | ||||||||||||||||||||||||
| 3783 | QDomNodePrivate* p = new QDomDocumentFragmentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 3784 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3785 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3786 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3787 | } | - | ||||||||||||||||||||||||
| 3788 | - | |||||||||||||||||||||||||
| 3789 | /************************************************************** | - | ||||||||||||||||||||||||
| 3790 | * | - | ||||||||||||||||||||||||
| 3791 | * QDomDocumentFragment | - | ||||||||||||||||||||||||
| 3792 | * | - | ||||||||||||||||||||||||
| 3793 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3794 | - | |||||||||||||||||||||||||
| 3795 | /*! | - | ||||||||||||||||||||||||
| 3796 | \class QDomDocumentFragment | - | ||||||||||||||||||||||||
| 3797 | \reentrant | - | ||||||||||||||||||||||||
| 3798 | \brief The QDomDocumentFragment class is a tree of QDomNodes which is not usually a complete QDomDocument. | - | ||||||||||||||||||||||||
| 3799 | - | |||||||||||||||||||||||||
| 3800 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3801 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3802 | - | |||||||||||||||||||||||||
| 3803 | If you want to do complex tree operations it is useful to have a | - | ||||||||||||||||||||||||
| 3804 | lightweight class to store nodes and their relations. | - | ||||||||||||||||||||||||
| 3805 | QDomDocumentFragment stores a subtree of a document which does not | - | ||||||||||||||||||||||||
| 3806 | necessarily represent a well-formed XML document. | - | ||||||||||||||||||||||||
| 3807 | - | |||||||||||||||||||||||||
| 3808 | QDomDocumentFragment is also useful if you want to group several | - | ||||||||||||||||||||||||
| 3809 | nodes in a list and insert them all together as children of some | - | ||||||||||||||||||||||||
| 3810 | node. In these cases QDomDocumentFragment can be used as a | - | ||||||||||||||||||||||||
| 3811 | temporary container for this list of children. | - | ||||||||||||||||||||||||
| 3812 | - | |||||||||||||||||||||||||
| 3813 | The most important feature of QDomDocumentFragment is that it is | - | ||||||||||||||||||||||||
| 3814 | treated in a special way by QDomNode::insertAfter(), | - | ||||||||||||||||||||||||
| 3815 | QDomNode::insertBefore(), QDomNode::replaceChild() and | - | ||||||||||||||||||||||||
| 3816 | QDomNode::appendChild(): instead of inserting the fragment itself, all | - | ||||||||||||||||||||||||
| 3817 | the fragment's children are inserted. | - | ||||||||||||||||||||||||
| 3818 | */ | - | ||||||||||||||||||||||||
| 3819 | - | |||||||||||||||||||||||||
| 3820 | /*! | - | ||||||||||||||||||||||||
| 3821 | Constructs an empty document fragment. | - | ||||||||||||||||||||||||
| 3822 | */ | - | ||||||||||||||||||||||||
| 3823 | QDomDocumentFragment::QDomDocumentFragment() | - | ||||||||||||||||||||||||
| 3824 | { | - | ||||||||||||||||||||||||
| 3825 | } | - | ||||||||||||||||||||||||
| 3826 | - | |||||||||||||||||||||||||
| 3827 | QDomDocumentFragment::QDomDocumentFragment(QDomDocumentFragmentPrivate* n) | - | ||||||||||||||||||||||||
| 3828 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3829 | { | - | ||||||||||||||||||||||||
| 3830 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3831 | - | |||||||||||||||||||||||||
| 3832 | /*! | - | ||||||||||||||||||||||||
| 3833 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 3834 | - | |||||||||||||||||||||||||
| 3835 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3836 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3837 | cloneNode(). | - | ||||||||||||||||||||||||
| 3838 | */ | - | ||||||||||||||||||||||||
| 3839 | QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment& x) | - | ||||||||||||||||||||||||
| 3840 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 3841 | { | - | ||||||||||||||||||||||||
| 3842 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3843 | - | |||||||||||||||||||||||||
| 3844 | /*! | - | ||||||||||||||||||||||||
| 3845 | Assigns \a x to this DOM document fragment. | - | ||||||||||||||||||||||||
| 3846 | - | |||||||||||||||||||||||||
| 3847 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3848 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3849 | cloneNode(). | - | ||||||||||||||||||||||||
| 3850 | */ | - | ||||||||||||||||||||||||
| 3851 | QDomDocumentFragment& QDomDocumentFragment::operator= (const QDomDocumentFragment& x) | - | ||||||||||||||||||||||||
| 3852 | { | - | ||||||||||||||||||||||||
| 3853 | return (QDomDocumentFragment&) QDomNode::operator=(x); never executed: return (QDomDocumentFragment&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 3854 | } | - | ||||||||||||||||||||||||
| 3855 | - | |||||||||||||||||||||||||
| 3856 | /*! | - | ||||||||||||||||||||||||
| 3857 | \fn QDomNode::NodeType QDomDocumentFragment::nodeType() const | - | ||||||||||||||||||||||||
| 3858 | - | |||||||||||||||||||||||||
| 3859 | Returns \c DocumentFragment. | - | ||||||||||||||||||||||||
| 3860 | - | |||||||||||||||||||||||||
| 3861 | \sa isDocumentFragment(), QDomNode::toDocumentFragment() | - | ||||||||||||||||||||||||
| 3862 | */ | - | ||||||||||||||||||||||||
| 3863 | - | |||||||||||||||||||||||||
| 3864 | /************************************************************** | - | ||||||||||||||||||||||||
| 3865 | * | - | ||||||||||||||||||||||||
| 3866 | * QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 3867 | * | - | ||||||||||||||||||||||||
| 3868 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3869 | - | |||||||||||||||||||||||||
| 3870 | QDomCharacterDataPrivate::QDomCharacterDataPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 3871 | const QString& data) | - | ||||||||||||||||||||||||
| 3872 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 3873 | { | - | ||||||||||||||||||||||||
| 3874 | value = data; | - | ||||||||||||||||||||||||
| 3875 | name = QLatin1String("#character-data"); | - | ||||||||||||||||||||||||
| 3876 | } executed 993 times by 5 tests: end of blockExecuted by:
| 993 | ||||||||||||||||||||||||
| 3877 | - | |||||||||||||||||||||||||
| 3878 | QDomCharacterDataPrivate::QDomCharacterDataPrivate(QDomCharacterDataPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3879 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3880 | { | - | ||||||||||||||||||||||||
| 3881 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3882 | - | |||||||||||||||||||||||||
| 3883 | QDomNodePrivate* QDomCharacterDataPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3884 | { | - | ||||||||||||||||||||||||
| 3885 | QDomNodePrivate* p = new QDomCharacterDataPrivate(this, deep); | - | ||||||||||||||||||||||||
| 3886 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3887 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3888 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3889 | } | - | ||||||||||||||||||||||||
| 3890 | - | |||||||||||||||||||||||||
| 3891 | int QDomCharacterDataPrivate::dataLength() const | - | ||||||||||||||||||||||||
| 3892 | { | - | ||||||||||||||||||||||||
| 3893 | return value.length(); never executed: return value.length(); | 0 | ||||||||||||||||||||||||
| 3894 | } | - | ||||||||||||||||||||||||
| 3895 | - | |||||||||||||||||||||||||
| 3896 | QString QDomCharacterDataPrivate::substringData(unsigned long offset, unsigned long n) const | - | ||||||||||||||||||||||||
| 3897 | { | - | ||||||||||||||||||||||||
| 3898 | return value.mid(offset, n); never executed: return value.mid(offset, n); | 0 | ||||||||||||||||||||||||
| 3899 | } | - | ||||||||||||||||||||||||
| 3900 | - | |||||||||||||||||||||||||
| 3901 | void QDomCharacterDataPrivate::insertData(unsigned long offset, const QString& arg) | - | ||||||||||||||||||||||||
| 3902 | { | - | ||||||||||||||||||||||||
| 3903 | value.insert(offset, arg); | - | ||||||||||||||||||||||||
| 3904 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3905 | - | |||||||||||||||||||||||||
| 3906 | void QDomCharacterDataPrivate::deleteData(unsigned long offset, unsigned long n) | - | ||||||||||||||||||||||||
| 3907 | { | - | ||||||||||||||||||||||||
| 3908 | value.remove(offset, n); | - | ||||||||||||||||||||||||
| 3909 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3910 | - | |||||||||||||||||||||||||
| 3911 | void QDomCharacterDataPrivate::replaceData(unsigned long offset, unsigned long n, const QString& arg) | - | ||||||||||||||||||||||||
| 3912 | { | - | ||||||||||||||||||||||||
| 3913 | value.replace(offset, n, arg); | - | ||||||||||||||||||||||||
| 3914 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3915 | - | |||||||||||||||||||||||||
| 3916 | void QDomCharacterDataPrivate::appendData(const QString& arg) | - | ||||||||||||||||||||||||
| 3917 | { | - | ||||||||||||||||||||||||
| 3918 | value += arg; | - | ||||||||||||||||||||||||
| 3919 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3920 | - | |||||||||||||||||||||||||
| 3921 | /************************************************************** | - | ||||||||||||||||||||||||
| 3922 | * | - | ||||||||||||||||||||||||
| 3923 | * QDomCharacterData | - | ||||||||||||||||||||||||
| 3924 | * | - | ||||||||||||||||||||||||
| 3925 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3926 | - | |||||||||||||||||||||||||
| 3927 | #define IMPL ((QDomCharacterDataPrivate*)impl) | - | ||||||||||||||||||||||||
| 3928 | - | |||||||||||||||||||||||||
| 3929 | /*! | - | ||||||||||||||||||||||||
| 3930 | \class QDomCharacterData | - | ||||||||||||||||||||||||
| 3931 | \reentrant | - | ||||||||||||||||||||||||
| 3932 | \brief The QDomCharacterData class represents a generic string in the DOM. | - | ||||||||||||||||||||||||
| 3933 | - | |||||||||||||||||||||||||
| 3934 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3935 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3936 | - | |||||||||||||||||||||||||
| 3937 | Character data as used in XML specifies a generic data string. | - | ||||||||||||||||||||||||
| 3938 | More specialized versions of this class are QDomText, QDomComment | - | ||||||||||||||||||||||||
| 3939 | and QDomCDATASection. | - | ||||||||||||||||||||||||
| 3940 | - | |||||||||||||||||||||||||
| 3941 | The data string is set with setData() and retrieved with data(). | - | ||||||||||||||||||||||||
| 3942 | You can retrieve a portion of the data string using | - | ||||||||||||||||||||||||
| 3943 | substringData(). Extra data can be appended with appendData(), or | - | ||||||||||||||||||||||||
| 3944 | inserted with insertData(). Portions of the data string can be | - | ||||||||||||||||||||||||
| 3945 | deleted with deleteData() or replaced with replaceData(). The | - | ||||||||||||||||||||||||
| 3946 | length of the data string is returned by length(). | - | ||||||||||||||||||||||||
| 3947 | - | |||||||||||||||||||||||||
| 3948 | The node type of the node containing this character data is | - | ||||||||||||||||||||||||
| 3949 | returned by nodeType(). | - | ||||||||||||||||||||||||
| 3950 | - | |||||||||||||||||||||||||
| 3951 | \sa QDomText, QDomComment, QDomCDATASection | - | ||||||||||||||||||||||||
| 3952 | */ | - | ||||||||||||||||||||||||
| 3953 | - | |||||||||||||||||||||||||
| 3954 | /*! | - | ||||||||||||||||||||||||
| 3955 | Constructs an empty character data object. | - | ||||||||||||||||||||||||
| 3956 | */ | - | ||||||||||||||||||||||||
| 3957 | QDomCharacterData::QDomCharacterData() | - | ||||||||||||||||||||||||
| 3958 | { | - | ||||||||||||||||||||||||
| 3959 | } | - | ||||||||||||||||||||||||
| 3960 | - | |||||||||||||||||||||||||
| 3961 | /*! | - | ||||||||||||||||||||||||
| 3962 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 3963 | - | |||||||||||||||||||||||||
| 3964 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3965 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3966 | cloneNode(). | - | ||||||||||||||||||||||||
| 3967 | */ | - | ||||||||||||||||||||||||
| 3968 | QDomCharacterData::QDomCharacterData(const QDomCharacterData& x) | - | ||||||||||||||||||||||||
| 3969 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 3970 | { | - | ||||||||||||||||||||||||
| 3971 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3972 | - | |||||||||||||||||||||||||
| 3973 | QDomCharacterData::QDomCharacterData(QDomCharacterDataPrivate* n) | - | ||||||||||||||||||||||||
| 3974 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3975 | { | - | ||||||||||||||||||||||||
| 3976 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3977 | - | |||||||||||||||||||||||||
| 3978 | /*! | - | ||||||||||||||||||||||||
| 3979 | Assigns \a x to this character data. | - | ||||||||||||||||||||||||
| 3980 | - | |||||||||||||||||||||||||
| 3981 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3982 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3983 | cloneNode(). | - | ||||||||||||||||||||||||
| 3984 | */ | - | ||||||||||||||||||||||||
| 3985 | QDomCharacterData& QDomCharacterData::operator= (const QDomCharacterData& x) | - | ||||||||||||||||||||||||
| 3986 | { | - | ||||||||||||||||||||||||
| 3987 | return (QDomCharacterData&) QDomNode::operator=(x); never executed: return (QDomCharacterData&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 3988 | } | - | ||||||||||||||||||||||||
| 3989 | - | |||||||||||||||||||||||||
| 3990 | /*! | - | ||||||||||||||||||||||||
| 3991 | Returns the string stored in this object. | - | ||||||||||||||||||||||||
| 3992 | - | |||||||||||||||||||||||||
| 3993 | If the node is a \l{isNull()}{null node}, it will return | - | ||||||||||||||||||||||||
| 3994 | an empty string. | - | ||||||||||||||||||||||||
| 3995 | */ | - | ||||||||||||||||||||||||
| 3996 | QString QDomCharacterData::data() const | - | ||||||||||||||||||||||||
| 3997 | { | - | ||||||||||||||||||||||||
| 3998 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3999 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4000 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4001 | } | - | ||||||||||||||||||||||||
| 4002 | - | |||||||||||||||||||||||||
| 4003 | /*! | - | ||||||||||||||||||||||||
| 4004 | Sets this object's string to \a v. | - | ||||||||||||||||||||||||
| 4005 | */ | - | ||||||||||||||||||||||||
| 4006 | void QDomCharacterData::setData(const QString& v) | - | ||||||||||||||||||||||||
| 4007 | { | - | ||||||||||||||||||||||||
| 4008 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4009 | impl->setNodeValue(v); never executed: impl->setNodeValue(v); | 0 | ||||||||||||||||||||||||
| 4010 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4011 | - | |||||||||||||||||||||||||
| 4012 | /*! | - | ||||||||||||||||||||||||
| 4013 | Returns the length of the stored string. | - | ||||||||||||||||||||||||
| 4014 | */ | - | ||||||||||||||||||||||||
| 4015 | int QDomCharacterData::length() const | - | ||||||||||||||||||||||||
| 4016 | { | - | ||||||||||||||||||||||||
| 4017 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4018 | return IMPL->dataLength(); never executed: return ((QDomCharacterDataPrivate*)impl)->dataLength(); | 0 | ||||||||||||||||||||||||
| 4019 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 4020 | } | - | ||||||||||||||||||||||||
| 4021 | - | |||||||||||||||||||||||||
| 4022 | /*! | - | ||||||||||||||||||||||||
| 4023 | Returns the substring of length \a count from position \a offset. | - | ||||||||||||||||||||||||
| 4024 | */ | - | ||||||||||||||||||||||||
| 4025 | QString QDomCharacterData::substringData(unsigned long offset, unsigned long count) | - | ||||||||||||||||||||||||
| 4026 | { | - | ||||||||||||||||||||||||
| 4027 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4028 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4029 | return IMPL->substringData(offset, count); never executed: return ((QDomCharacterDataPrivate*)impl)->substringData(offset, count); | 0 | ||||||||||||||||||||||||
| 4030 | } | - | ||||||||||||||||||||||||
| 4031 | - | |||||||||||||||||||||||||
| 4032 | /*! | - | ||||||||||||||||||||||||
| 4033 | Appends the string \a arg to the stored string. | - | ||||||||||||||||||||||||
| 4034 | */ | - | ||||||||||||||||||||||||
| 4035 | void QDomCharacterData::appendData(const QString& arg) | - | ||||||||||||||||||||||||
| 4036 | { | - | ||||||||||||||||||||||||
| 4037 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4038 | IMPL->appendData(arg); never executed: ((QDomCharacterDataPrivate*)impl)->appendData(arg); | 0 | ||||||||||||||||||||||||
| 4039 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4040 | - | |||||||||||||||||||||||||
| 4041 | /*! | - | ||||||||||||||||||||||||
| 4042 | Inserts the string \a arg into the stored string at position \a offset. | - | ||||||||||||||||||||||||
| 4043 | */ | - | ||||||||||||||||||||||||
| 4044 | void QDomCharacterData::insertData(unsigned long offset, const QString& arg) | - | ||||||||||||||||||||||||
| 4045 | { | - | ||||||||||||||||||||||||
| 4046 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4047 | IMPL->insertData(offset, arg); never executed: ((QDomCharacterDataPrivate*)impl)->insertData(offset, arg); | 0 | ||||||||||||||||||||||||
| 4048 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4049 | - | |||||||||||||||||||||||||
| 4050 | /*! | - | ||||||||||||||||||||||||
| 4051 | Deletes a substring of length \a count from position \a offset. | - | ||||||||||||||||||||||||
| 4052 | */ | - | ||||||||||||||||||||||||
| 4053 | void QDomCharacterData::deleteData(unsigned long offset, unsigned long count) | - | ||||||||||||||||||||||||
| 4054 | { | - | ||||||||||||||||||||||||
| 4055 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4056 | IMPL->deleteData(offset, count); never executed: ((QDomCharacterDataPrivate*)impl)->deleteData(offset, count); | 0 | ||||||||||||||||||||||||
| 4057 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4058 | - | |||||||||||||||||||||||||
| 4059 | /*! | - | ||||||||||||||||||||||||
| 4060 | Replaces the substring of length \a count starting at position \a | - | ||||||||||||||||||||||||
| 4061 | offset with the string \a arg. | - | ||||||||||||||||||||||||
| 4062 | */ | - | ||||||||||||||||||||||||
| 4063 | void QDomCharacterData::replaceData(unsigned long offset, unsigned long count, const QString& arg) | - | ||||||||||||||||||||||||
| 4064 | { | - | ||||||||||||||||||||||||
| 4065 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4066 | IMPL->replaceData(offset, count, arg); never executed: ((QDomCharacterDataPrivate*)impl)->replaceData(offset, count, arg); | 0 | ||||||||||||||||||||||||
| 4067 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4068 | - | |||||||||||||||||||||||||
| 4069 | /*! | - | ||||||||||||||||||||||||
| 4070 | Returns the type of node this object refers to (i.e. \c TextNode, | - | ||||||||||||||||||||||||
| 4071 | \c CDATASectionNode, \c CommentNode or \c CharacterDataNode). For | - | ||||||||||||||||||||||||
| 4072 | a \l{isNull()}{null node}, returns \c CharacterDataNode. | - | ||||||||||||||||||||||||
| 4073 | */ | - | ||||||||||||||||||||||||
| 4074 | QDomNode::NodeType QDomCharacterData::nodeType() const | - | ||||||||||||||||||||||||
| 4075 | { | - | ||||||||||||||||||||||||
| 4076 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4077 | return CharacterDataNode; never executed: return CharacterDataNode; | 0 | ||||||||||||||||||||||||
| 4078 | return QDomNode::nodeType(); never executed: return QDomNode::nodeType(); | 0 | ||||||||||||||||||||||||
| 4079 | } | - | ||||||||||||||||||||||||
| 4080 | - | |||||||||||||||||||||||||
| 4081 | #undef IMPL | - | ||||||||||||||||||||||||
| 4082 | - | |||||||||||||||||||||||||
| 4083 | /************************************************************** | - | ||||||||||||||||||||||||
| 4084 | * | - | ||||||||||||||||||||||||
| 4085 | * QDomAttrPrivate | - | ||||||||||||||||||||||||
| 4086 | * | - | ||||||||||||||||||||||||
| 4087 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4088 | - | |||||||||||||||||||||||||
| 4089 | QDomAttrPrivate::QDomAttrPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& name_) | - | ||||||||||||||||||||||||
| 4090 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 4091 | { | - | ||||||||||||||||||||||||
| 4092 | name = name_; | - | ||||||||||||||||||||||||
| 4093 | m_specified = false; | - | ||||||||||||||||||||||||
| 4094 | } executed 865 times by 3 tests: end of blockExecuted by:
| 865 | ||||||||||||||||||||||||
| 4095 | - | |||||||||||||||||||||||||
| 4096 | QDomAttrPrivate::QDomAttrPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 4097 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4098 | { | - | ||||||||||||||||||||||||
| 4099 | qt_split_namespace(prefix, name, qName, !nsURI.isNull()); | - | ||||||||||||||||||||||||
| 4100 | namespaceURI = nsURI; | - | ||||||||||||||||||||||||
| 4101 | createdWithDom1Interface = false; | - | ||||||||||||||||||||||||
| 4102 | m_specified = false; | - | ||||||||||||||||||||||||
| 4103 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4104 | - | |||||||||||||||||||||||||
| 4105 | QDomAttrPrivate::QDomAttrPrivate(QDomAttrPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 4106 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 4107 | { | - | ||||||||||||||||||||||||
| 4108 | m_specified = n->specified(); | - | ||||||||||||||||||||||||
| 4109 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4110 | - | |||||||||||||||||||||||||
| 4111 | void QDomAttrPrivate::setNodeValue(const QString& v) | - | ||||||||||||||||||||||||
| 4112 | { | - | ||||||||||||||||||||||||
| 4113 | value = v; | - | ||||||||||||||||||||||||
| 4114 | QDomTextPrivate *t = new QDomTextPrivate(0, this, v); | - | ||||||||||||||||||||||||
| 4115 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 4116 | t->ref.deref(); | - | ||||||||||||||||||||||||
| 4117 | if (first) {
| 1-867 | ||||||||||||||||||||||||
| 4118 | delete removeChild(first); | - | ||||||||||||||||||||||||
| 4119 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 4120 | appendChild(t); | - | ||||||||||||||||||||||||
| 4121 | } executed 868 times by 4 tests: end of blockExecuted by:
| 868 | ||||||||||||||||||||||||
| 4122 | - | |||||||||||||||||||||||||
| 4123 | QDomNodePrivate* QDomAttrPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 4124 | { | - | ||||||||||||||||||||||||
| 4125 | QDomNodePrivate* p = new QDomAttrPrivate(this, deep); | - | ||||||||||||||||||||||||
| 4126 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 4127 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 4128 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 4129 | } | - | ||||||||||||||||||||||||
| 4130 | - | |||||||||||||||||||||||||
| 4131 | bool QDomAttrPrivate::specified() const | - | ||||||||||||||||||||||||
| 4132 | { | - | ||||||||||||||||||||||||
| 4133 | return m_specified; never executed: return m_specified; | 0 | ||||||||||||||||||||||||
| 4134 | } | - | ||||||||||||||||||||||||
| 4135 | - | |||||||||||||||||||||||||
| 4136 | /* \internal | - | ||||||||||||||||||||||||
| 4137 | Encode & escape \a str. Yes, it makes no sense to return a QString, | - | ||||||||||||||||||||||||
| 4138 | but is so for legacy reasons. | - | ||||||||||||||||||||||||
| 4139 | - | |||||||||||||||||||||||||
| 4140 | Remember that content produced should be able to roundtrip with 2.11 End-of-Line Handling | - | ||||||||||||||||||||||||
| 4141 | and 3.3.3 Attribute-Value Normalization. | - | ||||||||||||||||||||||||
| 4142 | - | |||||||||||||||||||||||||
| 4143 | If \a performAVN is true, characters will be escaped to survive Attribute Value Normalization. | - | ||||||||||||||||||||||||
| 4144 | If \a encodeEOLs is true, characters will be escaped to survive End-of-Line Handling. | - | ||||||||||||||||||||||||
| 4145 | */ | - | ||||||||||||||||||||||||
| 4146 | static QString encodeText(const QString &str, | - | ||||||||||||||||||||||||
| 4147 | QTextStream &s, | - | ||||||||||||||||||||||||
| 4148 | const bool encodeQuotes = true, | - | ||||||||||||||||||||||||
| 4149 | const bool performAVN = false, | - | ||||||||||||||||||||||||
| 4150 | const bool encodeEOLs = false) | - | ||||||||||||||||||||||||
| 4151 | { | - | ||||||||||||||||||||||||
| 4152 | #ifdef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 4153 | Q_UNUSED(s); | - | ||||||||||||||||||||||||
| 4154 | #else | - | ||||||||||||||||||||||||
| 4155 | const QTextCodec *const codec = s.codec(); | - | ||||||||||||||||||||||||
| 4156 | Q_ASSERT(codec); | - | ||||||||||||||||||||||||
| 4157 | #endif | - | ||||||||||||||||||||||||
| 4158 | QString retval(str); | - | ||||||||||||||||||||||||
| 4159 | int len = retval.length(); | - | ||||||||||||||||||||||||
| 4160 | int i = 0; | - | ||||||||||||||||||||||||
| 4161 | - | |||||||||||||||||||||||||
| 4162 | while (i < len) {
| 396-2468 | ||||||||||||||||||||||||
| 4163 | const QChar ati(retval.at(i)); | - | ||||||||||||||||||||||||
| 4164 | - | |||||||||||||||||||||||||
| 4165 | if (ati == QLatin1Char('<')) {
| 0-2468 | ||||||||||||||||||||||||
| 4166 | retval.replace(i, 1, QLatin1String("<")); | - | ||||||||||||||||||||||||
| 4167 | len += 3; | - | ||||||||||||||||||||||||
| 4168 | i += 4; | - | ||||||||||||||||||||||||
| 4169 | } else if (encodeQuotes && (ati == QLatin1Char('"'))) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4170 | retval.replace(i, 1, QLatin1String(""")); | - | ||||||||||||||||||||||||
| 4171 | len += 5; | - | ||||||||||||||||||||||||
| 4172 | i += 6; | - | ||||||||||||||||||||||||
| 4173 | } else if (ati == QLatin1Char('&')) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4174 | retval.replace(i, 1, QLatin1String("&")); | - | ||||||||||||||||||||||||
| 4175 | len += 4; | - | ||||||||||||||||||||||||
| 4176 | i += 5; | - | ||||||||||||||||||||||||
| 4177 | } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4178 | retval.replace(i, 1, QLatin1String(">")); | - | ||||||||||||||||||||||||
| 4179 | len += 3; | - | ||||||||||||||||||||||||
| 4180 | i += 4; | - | ||||||||||||||||||||||||
| 4181 | } else if (performAVN && never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4182 | (ati == QChar(0xA) ||
| 0-2468 | ||||||||||||||||||||||||
| 4183 | ati == QChar(0xD) ||
| 0-2468 | ||||||||||||||||||||||||
| 4184 | ati == QChar(0x9))) {
| 0-2468 | ||||||||||||||||||||||||
| 4185 | const QString replacement(QLatin1String("&#x") + QString::number(ati.unicode(), 16) + QLatin1Char(';')); | - | ||||||||||||||||||||||||
| 4186 | retval.replace(i, 1, replacement); | - | ||||||||||||||||||||||||
| 4187 | i += replacement.length(); | - | ||||||||||||||||||||||||
| 4188 | len += replacement.length() - 1; | - | ||||||||||||||||||||||||
| 4189 | } else if (encodeEOLs && ati == QChar(0xD)) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4190 | retval.replace(i, 1, QLatin1String("
")); // Replace a single 0xD with a ref for 0xD | - | ||||||||||||||||||||||||
| 4191 | len += 4; | - | ||||||||||||||||||||||||
| 4192 | i += 5; | - | ||||||||||||||||||||||||
| 4193 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4194 | #ifndef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 4195 | if(codec->canEncode(ati))
| 0-2468 | ||||||||||||||||||||||||
| 4196 | ++i; executed 2468 times by 2 tests: ++i;Executed by:
| 2468 | ||||||||||||||||||||||||
| 4197 | else | - | ||||||||||||||||||||||||
| 4198 | #endif | - | ||||||||||||||||||||||||
| 4199 | { | - | ||||||||||||||||||||||||
| 4200 | // We have to use a character reference to get it through. | - | ||||||||||||||||||||||||
| 4201 | const ushort codepoint(ati.unicode()); | - | ||||||||||||||||||||||||
| 4202 | const QString replacement(QLatin1String("&#x") + QString::number(codepoint, 16) + QLatin1Char(';')); | - | ||||||||||||||||||||||||
| 4203 | retval.replace(i, 1, replacement); | - | ||||||||||||||||||||||||
| 4204 | i += replacement.length(); | - | ||||||||||||||||||||||||
| 4205 | len += replacement.length() - 1; | - | ||||||||||||||||||||||||
| 4206 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4207 | } | - | ||||||||||||||||||||||||
| 4208 | } | - | ||||||||||||||||||||||||
| 4209 | - | |||||||||||||||||||||||||
| 4210 | return retval; executed 396 times by 2 tests: return retval;Executed by:
| 396 | ||||||||||||||||||||||||
| 4211 | } | - | ||||||||||||||||||||||||
| 4212 | - | |||||||||||||||||||||||||
| 4213 | void QDomAttrPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 4214 | { | - | ||||||||||||||||||||||||
| 4215 | if (namespaceURI.isNull()) {
| 0 | ||||||||||||||||||||||||
| 4216 | s << name << "=\"" << encodeText(value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4217 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4218 | s << prefix << ':' << name << "=\"" << encodeText(value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4219 | /* This is a fix for 138243, as good as it gets. | - | ||||||||||||||||||||||||
| 4220 | * | - | ||||||||||||||||||||||||
| 4221 | * QDomElementPrivate::save() output a namespace declaration if | - | ||||||||||||||||||||||||
| 4222 | * the element is in a namespace, no matter what. This function do as well, meaning | - | ||||||||||||||||||||||||
| 4223 | * that we get two identical namespace declaration if we don't have the if- | - | ||||||||||||||||||||||||
| 4224 | * statement below. | - | ||||||||||||||||||||||||
| 4225 | * | - | ||||||||||||||||||||||||
| 4226 | * This doesn't work when the parent element has the same prefix as us but | - | ||||||||||||||||||||||||
| 4227 | * a different namespace. However, this can only occur by the user modifying the element, | - | ||||||||||||||||||||||||
| 4228 | * and we don't do fixups by that anyway, and hence it's the user responsibility to not | - | ||||||||||||||||||||||||
| 4229 | * arrive in those situations. */ | - | ||||||||||||||||||||||||
| 4230 | if(!ownerNode ||
| 0 | ||||||||||||||||||||||||
| 4231 | ownerNode->prefix != prefix) {
| 0 | ||||||||||||||||||||||||
| 4232 | s << " xmlns:" << prefix << "=\"" << encodeText(namespaceURI, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4233 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4235 | } | - | ||||||||||||||||||||||||
| 4236 | - | |||||||||||||||||||||||||
| 4237 | /************************************************************** | - | ||||||||||||||||||||||||
| 4238 | * | - | ||||||||||||||||||||||||
| 4239 | * QDomAttr | - | ||||||||||||||||||||||||
| 4240 | * | - | ||||||||||||||||||||||||
| 4241 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4242 | - | |||||||||||||||||||||||||
| 4243 | #define IMPL ((QDomAttrPrivate*)impl) | - | ||||||||||||||||||||||||
| 4244 | - | |||||||||||||||||||||||||
| 4245 | /*! | - | ||||||||||||||||||||||||
| 4246 | \class QDomAttr | - | ||||||||||||||||||||||||
| 4247 | \reentrant | - | ||||||||||||||||||||||||
| 4248 | \brief The QDomAttr class represents one attribute of a QDomElement. | - | ||||||||||||||||||||||||
| 4249 | - | |||||||||||||||||||||||||
| 4250 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 4251 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 4252 | - | |||||||||||||||||||||||||
| 4253 | For example, the following piece of XML produces an element with | - | ||||||||||||||||||||||||
| 4254 | no children, but two attributes: | - | ||||||||||||||||||||||||
| 4255 | - | |||||||||||||||||||||||||
| 4256 | \snippet code/src_xml_dom_qdom.cpp 7 | - | ||||||||||||||||||||||||
| 4257 | - | |||||||||||||||||||||||||
| 4258 | You can access the attributes of an element with code like this: | - | ||||||||||||||||||||||||
| 4259 | - | |||||||||||||||||||||||||
| 4260 | \snippet code/src_xml_dom_qdom.cpp 8 | - | ||||||||||||||||||||||||
| 4261 | - | |||||||||||||||||||||||||
| 4262 | This example also shows that changing an attribute received from | - | ||||||||||||||||||||||||
| 4263 | an element changes the attribute of the element. If you do not | - | ||||||||||||||||||||||||
| 4264 | want to change the value of the element's attribute you must | - | ||||||||||||||||||||||||
| 4265 | use cloneNode() to get an independent copy of the attribute. | - | ||||||||||||||||||||||||
| 4266 | - | |||||||||||||||||||||||||
| 4267 | QDomAttr can return the name() and value() of an attribute. An | - | ||||||||||||||||||||||||
| 4268 | attribute's value is set with setValue(). If specified() returns | - | ||||||||||||||||||||||||
| 4269 | true the value was set with setValue(). The node this | - | ||||||||||||||||||||||||
| 4270 | attribute is attached to (if any) is returned by ownerElement(). | - | ||||||||||||||||||||||||
| 4271 | - | |||||||||||||||||||||||||
| 4272 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 4273 | \l{http://www.w3.org/TR/REC-DOM-Level-1/} and | - | ||||||||||||||||||||||||
| 4274 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}. | - | ||||||||||||||||||||||||
| 4275 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 4276 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 4277 | */ | - | ||||||||||||||||||||||||
| 4278 | - | |||||||||||||||||||||||||
| 4279 | - | |||||||||||||||||||||||||
| 4280 | /*! | - | ||||||||||||||||||||||||
| 4281 | Constructs an empty attribute. | - | ||||||||||||||||||||||||
| 4282 | */ | - | ||||||||||||||||||||||||
| 4283 | QDomAttr::QDomAttr() | - | ||||||||||||||||||||||||
| 4284 | { | - | ||||||||||||||||||||||||
| 4285 | } | - | ||||||||||||||||||||||||
| 4286 | - | |||||||||||||||||||||||||
| 4287 | /*! | - | ||||||||||||||||||||||||
| 4288 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 4289 | - | |||||||||||||||||||||||||
| 4290 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4291 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4292 | cloneNode(). | - | ||||||||||||||||||||||||
| 4293 | */ | - | ||||||||||||||||||||||||
| 4294 | QDomAttr::QDomAttr(const QDomAttr& x) | - | ||||||||||||||||||||||||
| 4295 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 4296 | { | - | ||||||||||||||||||||||||
| 4297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4298 | - | |||||||||||||||||||||||||
| 4299 | QDomAttr::QDomAttr(QDomAttrPrivate* n) | - | ||||||||||||||||||||||||
| 4300 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 4301 | { | - | ||||||||||||||||||||||||
| 4302 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4303 | - | |||||||||||||||||||||||||
| 4304 | /*! | - | ||||||||||||||||||||||||
| 4305 | Assigns \a x to this DOM attribute. | - | ||||||||||||||||||||||||
| 4306 | - | |||||||||||||||||||||||||
| 4307 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4308 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4309 | cloneNode(). | - | ||||||||||||||||||||||||
| 4310 | */ | - | ||||||||||||||||||||||||
| 4311 | QDomAttr& QDomAttr::operator= (const QDomAttr& x) | - | ||||||||||||||||||||||||
| 4312 | { | - | ||||||||||||||||||||||||
| 4313 | return (QDomAttr&) QDomNode::operator=(x); never executed: return (QDomAttr&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 4314 | } | - | ||||||||||||||||||||||||
| 4315 | - | |||||||||||||||||||||||||
| 4316 | /*! | - | ||||||||||||||||||||||||
| 4317 | Returns the attribute's name. | - | ||||||||||||||||||||||||
| 4318 | */ | - | ||||||||||||||||||||||||
| 4319 | QString QDomAttr::name() const | - | ||||||||||||||||||||||||
| 4320 | { | - | ||||||||||||||||||||||||
| 4321 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4322 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4323 | return impl->nodeName(); never executed: return impl->nodeName(); | 0 | ||||||||||||||||||||||||
| 4324 | } | - | ||||||||||||||||||||||||
| 4325 | - | |||||||||||||||||||||||||
| 4326 | /*! | - | ||||||||||||||||||||||||
| 4327 | Returns \c true if the attribute has been set by the user with setValue(). | - | ||||||||||||||||||||||||
| 4328 | Returns \c false if the value hasn't been specified or set. | - | ||||||||||||||||||||||||
| 4329 | - | |||||||||||||||||||||||||
| 4330 | \sa setValue() | - | ||||||||||||||||||||||||
| 4331 | */ | - | ||||||||||||||||||||||||
| 4332 | bool QDomAttr::specified() const | - | ||||||||||||||||||||||||
| 4333 | { | - | ||||||||||||||||||||||||
| 4334 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4335 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 4336 | return IMPL->specified(); never executed: return ((QDomAttrPrivate*)impl)->specified(); | 0 | ||||||||||||||||||||||||
| 4337 | } | - | ||||||||||||||||||||||||
| 4338 | - | |||||||||||||||||||||||||
| 4339 | /*! | - | ||||||||||||||||||||||||
| 4340 | Returns the element node this attribute is attached to or a | - | ||||||||||||||||||||||||
| 4341 | \l{QDomNode::isNull()}{null node} if this attribute is not | - | ||||||||||||||||||||||||
| 4342 | attached to any element. | - | ||||||||||||||||||||||||
| 4343 | */ | - | ||||||||||||||||||||||||
| 4344 | QDomElement QDomAttr::ownerElement() const | - | ||||||||||||||||||||||||
| 4345 | { | - | ||||||||||||||||||||||||
| 4346 | Q_ASSERT(impl->parent()); | - | ||||||||||||||||||||||||
| 4347 | if (!impl->parent()->isElement())
| 0 | ||||||||||||||||||||||||
| 4348 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 4349 | return QDomElement((QDomElementPrivate*)(impl->parent())); never executed: return QDomElement((QDomElementPrivate*)(impl->parent())); | 0 | ||||||||||||||||||||||||
| 4350 | } | - | ||||||||||||||||||||||||
| 4351 | - | |||||||||||||||||||||||||
| 4352 | /*! | - | ||||||||||||||||||||||||
| 4353 | Returns the value of the attribute or an empty string if the | - | ||||||||||||||||||||||||
| 4354 | attribute has not been specified. | - | ||||||||||||||||||||||||
| 4355 | - | |||||||||||||||||||||||||
| 4356 | \sa specified(), setValue() | - | ||||||||||||||||||||||||
| 4357 | */ | - | ||||||||||||||||||||||||
| 4358 | QString QDomAttr::value() const | - | ||||||||||||||||||||||||
| 4359 | { | - | ||||||||||||||||||||||||
| 4360 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4361 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4362 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4363 | } | - | ||||||||||||||||||||||||
| 4364 | - | |||||||||||||||||||||||||
| 4365 | /*! | - | ||||||||||||||||||||||||
| 4366 | Sets the attribute's value to \a v. | - | ||||||||||||||||||||||||
| 4367 | - | |||||||||||||||||||||||||
| 4368 | \sa value() | - | ||||||||||||||||||||||||
| 4369 | */ | - | ||||||||||||||||||||||||
| 4370 | void QDomAttr::setValue(const QString& v) | - | ||||||||||||||||||||||||
| 4371 | { | - | ||||||||||||||||||||||||
| 4372 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4373 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4374 | impl->setNodeValue(v); | - | ||||||||||||||||||||||||
| 4375 | IMPL->m_specified = true; | - | ||||||||||||||||||||||||
| 4376 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4377 | - | |||||||||||||||||||||||||
| 4378 | /*! | - | ||||||||||||||||||||||||
| 4379 | \fn QDomNode::NodeType QDomAttr::nodeType() const | - | ||||||||||||||||||||||||
| 4380 | - | |||||||||||||||||||||||||
| 4381 | Returns \l{QDomNode::NodeType}{AttributeNode}. | - | ||||||||||||||||||||||||
| 4382 | */ | - | ||||||||||||||||||||||||
| 4383 | - | |||||||||||||||||||||||||
| 4384 | #undef IMPL | - | ||||||||||||||||||||||||
| 4385 | - | |||||||||||||||||||||||||
| 4386 | /************************************************************** | - | ||||||||||||||||||||||||
| 4387 | * | - | ||||||||||||||||||||||||
| 4388 | * QDomElementPrivate | - | ||||||||||||||||||||||||
| 4389 | * | - | ||||||||||||||||||||||||
| 4390 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4391 | - | |||||||||||||||||||||||||
| 4392 | QDomElementPrivate::QDomElementPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 4393 | const QString& tagname) | - | ||||||||||||||||||||||||
| 4394 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4395 | { | - | ||||||||||||||||||||||||
| 4396 | name = tagname; | - | ||||||||||||||||||||||||
| 4397 | m_attr = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 4398 | } executed 1021 times by 4 tests: end of blockExecuted by:
| 1021 | ||||||||||||||||||||||||
| 4399 | - | |||||||||||||||||||||||||
| 4400 | QDomElementPrivate::QDomElementPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 4401 | const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 4402 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4403 | { | - | ||||||||||||||||||||||||
| 4404 | qt_split_namespace(prefix, name, qName, !nsURI.isNull()); | - | ||||||||||||||||||||||||
| 4405 | namespaceURI = nsURI; | - | ||||||||||||||||||||||||
| 4406 | createdWithDom1Interface = false; | - | ||||||||||||||||||||||||
| 4407 | m_attr = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 4408 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4409 | - | |||||||||||||||||||||||||
| 4410 | QDomElementPrivate::QDomElementPrivate(QDomElementPrivate* n, bool deep) : | - | ||||||||||||||||||||||||
| 4411 | QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 4412 | { | - | ||||||||||||||||||||||||
| 4413 | m_attr = n->m_attr->clone(this); | - | ||||||||||||||||||||||||
| 4414 | // Reference is down to 0, so we set it to 1 here. | - | ||||||||||||||||||||||||
| 4415 | m_attr->ref.ref(); | - | ||||||||||||||||||||||||
| 4416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4417 | - | |||||||||||||||||||||||||
| 4418 | QDomElementPrivate::~QDomElementPrivate() | - | ||||||||||||||||||||||||
| 4419 | { | - | ||||||||||||||||||||||||
| 4420 | if (!m_attr->ref.deref())
| 0-1023 | ||||||||||||||||||||||||
| 4421 | delete m_attr; executed 1023 times by 5 tests: delete m_attr;Executed by:
| 1023 | ||||||||||||||||||||||||
| 4422 | } executed 1023 times by 5 tests: end of blockExecuted by:
| 1023 | ||||||||||||||||||||||||
| 4423 | - | |||||||||||||||||||||||||
| 4424 | QDomNodePrivate* QDomElementPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 4425 | { | - | ||||||||||||||||||||||||
| 4426 | QDomNodePrivate* p = new QDomElementPrivate(this, deep); | - | ||||||||||||||||||||||||
| 4427 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 4428 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 4429 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 4430 | } | - | ||||||||||||||||||||||||
| 4431 | - | |||||||||||||||||||||||||
| 4432 | QString QDomElementPrivate::attribute(const QString& name_, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4433 | { | - | ||||||||||||||||||||||||
| 4434 | QDomNodePrivate* n = m_attr->namedItem(name_); | - | ||||||||||||||||||||||||
| 4435 | if (!n)
| 1-33 | ||||||||||||||||||||||||
| 4436 | return defValue; executed 1 time by 1 test: return defValue;Executed by:
| 1 | ||||||||||||||||||||||||
| 4437 | - | |||||||||||||||||||||||||
| 4438 | return n->nodeValue(); executed 33 times by 1 test: return n->nodeValue();Executed by:
| 33 | ||||||||||||||||||||||||
| 4439 | } | - | ||||||||||||||||||||||||
| 4440 | - | |||||||||||||||||||||||||
| 4441 | QString QDomElementPrivate::attributeNS(const QString& nsURI, const QString& localName, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4442 | { | - | ||||||||||||||||||||||||
| 4443 | QDomNodePrivate* n = m_attr->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 4444 | if (!n)
| 0 | ||||||||||||||||||||||||
| 4445 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4446 | - | |||||||||||||||||||||||||
| 4447 | return n->nodeValue(); never executed: return n->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4448 | } | - | ||||||||||||||||||||||||
| 4449 | - | |||||||||||||||||||||||||
| 4450 | void QDomElementPrivate::setAttribute(const QString& aname, const QString& newValue) | - | ||||||||||||||||||||||||
| 4451 | { | - | ||||||||||||||||||||||||
| 4452 | QDomNodePrivate* n = m_attr->namedItem(aname); | - | ||||||||||||||||||||||||
| 4453 | if (!n) {
| 1-865 | ||||||||||||||||||||||||
| 4454 | n = new QDomAttrPrivate(ownerDocument(), this, aname); | - | ||||||||||||||||||||||||
| 4455 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4456 | - | |||||||||||||||||||||||||
| 4457 | // Referencing is done by the map, so we set the reference counter back | - | ||||||||||||||||||||||||
| 4458 | // to 0 here. This is ok since we created the QDomAttrPrivate. | - | ||||||||||||||||||||||||
| 4459 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 4460 | m_attr->setNamedItem(n); | - | ||||||||||||||||||||||||
| 4461 | } else { executed 865 times by 3 tests: end of blockExecuted by:
| 865 | ||||||||||||||||||||||||
| 4462 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4463 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 4464 | } | - | ||||||||||||||||||||||||
| 4465 | - | |||||||||||||||||||||||||
| 4466 | void QDomElementPrivate::setAttributeNS(const QString& nsURI, const QString& qName, const QString& newValue) | - | ||||||||||||||||||||||||
| 4467 | { | - | ||||||||||||||||||||||||
| 4468 | QString prefix, localName; | - | ||||||||||||||||||||||||
| 4469 | qt_split_namespace(prefix, localName, qName, true); | - | ||||||||||||||||||||||||
| 4470 | QDomNodePrivate* n = m_attr->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 4471 | if (!n) {
| 0-2 | ||||||||||||||||||||||||
| 4472 | n = new QDomAttrPrivate(ownerDocument(), this, nsURI, qName); | - | ||||||||||||||||||||||||
| 4473 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4474 | - | |||||||||||||||||||||||||
| 4475 | // Referencing is done by the map, so we set the reference counter back | - | ||||||||||||||||||||||||
| 4476 | // to 0 here. This is ok since we created the QDomAttrPrivate. | - | ||||||||||||||||||||||||
| 4477 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 4478 | m_attr->setNamedItem(n); | - | ||||||||||||||||||||||||
| 4479 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4480 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4481 | n->prefix = prefix; | - | ||||||||||||||||||||||||
| 4482 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4483 | } | - | ||||||||||||||||||||||||
| 4484 | - | |||||||||||||||||||||||||
| 4485 | void QDomElementPrivate::removeAttribute(const QString& aname) | - | ||||||||||||||||||||||||
| 4486 | { | - | ||||||||||||||||||||||||
| 4487 | QDomNodePrivate* p = m_attr->removeNamedItem(aname); | - | ||||||||||||||||||||||||
| 4488 | if (p && p->ref.load() == 0)
| 0 | ||||||||||||||||||||||||
| 4489 | delete p; never executed: delete p; | 0 | ||||||||||||||||||||||||
| 4490 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4491 | - | |||||||||||||||||||||||||
| 4492 | QDomAttrPrivate* QDomElementPrivate::attributeNode(const QString& aname) | - | ||||||||||||||||||||||||
| 4493 | { | - | ||||||||||||||||||||||||
| 4494 | return (QDomAttrPrivate*)m_attr->namedItem(aname); never executed: return (QDomAttrPrivate*)m_attr->namedItem(aname); | 0 | ||||||||||||||||||||||||
| 4495 | } | - | ||||||||||||||||||||||||
| 4496 | - | |||||||||||||||||||||||||
| 4497 | QDomAttrPrivate* QDomElementPrivate::attributeNodeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 4498 | { | - | ||||||||||||||||||||||||
| 4499 | return (QDomAttrPrivate*)m_attr->namedItemNS(nsURI, localName); never executed: return (QDomAttrPrivate*)m_attr->namedItemNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 4500 | } | - | ||||||||||||||||||||||||
| 4501 | - | |||||||||||||||||||||||||
| 4502 | QDomAttrPrivate* QDomElementPrivate::setAttributeNode(QDomAttrPrivate* newAttr) | - | ||||||||||||||||||||||||
| 4503 | { | - | ||||||||||||||||||||||||
| 4504 | QDomNodePrivate* n = m_attr->namedItem(newAttr->nodeName()); | - | ||||||||||||||||||||||||
| 4505 | - | |||||||||||||||||||||||||
| 4506 | // Referencing is done by the maps | - | ||||||||||||||||||||||||
| 4507 | m_attr->setNamedItem(newAttr); | - | ||||||||||||||||||||||||
| 4508 | - | |||||||||||||||||||||||||
| 4509 | newAttr->setParent(this); | - | ||||||||||||||||||||||||
| 4510 | - | |||||||||||||||||||||||||
| 4511 | return (QDomAttrPrivate*)n; never executed: return (QDomAttrPrivate*)n; | 0 | ||||||||||||||||||||||||
| 4512 | } | - | ||||||||||||||||||||||||
| 4513 | - | |||||||||||||||||||||||||
| 4514 | QDomAttrPrivate* QDomElementPrivate::setAttributeNodeNS(QDomAttrPrivate* newAttr) | - | ||||||||||||||||||||||||
| 4515 | { | - | ||||||||||||||||||||||||
| 4516 | QDomNodePrivate* n = 0; | - | ||||||||||||||||||||||||
| 4517 | if (!newAttr->prefix.isNull())
| 0 | ||||||||||||||||||||||||
| 4518 | n = m_attr->namedItemNS(newAttr->namespaceURI, newAttr->name); never executed: n = m_attr->namedItemNS(newAttr->namespaceURI, newAttr->name); | 0 | ||||||||||||||||||||||||
| 4519 | - | |||||||||||||||||||||||||
| 4520 | // Referencing is done by the maps | - | ||||||||||||||||||||||||
| 4521 | m_attr->setNamedItem(newAttr); | - | ||||||||||||||||||||||||
| 4522 | - | |||||||||||||||||||||||||
| 4523 | return (QDomAttrPrivate*)n; never executed: return (QDomAttrPrivate*)n; | 0 | ||||||||||||||||||||||||
| 4524 | } | - | ||||||||||||||||||||||||
| 4525 | - | |||||||||||||||||||||||||
| 4526 | QDomAttrPrivate* QDomElementPrivate::removeAttributeNode(QDomAttrPrivate* oldAttr) | - | ||||||||||||||||||||||||
| 4527 | { | - | ||||||||||||||||||||||||
| 4528 | return (QDomAttrPrivate*)m_attr->removeNamedItem(oldAttr->nodeName()); never executed: return (QDomAttrPrivate*)m_attr->removeNamedItem(oldAttr->nodeName()); | 0 | ||||||||||||||||||||||||
| 4529 | } | - | ||||||||||||||||||||||||
| 4530 | - | |||||||||||||||||||||||||
| 4531 | bool QDomElementPrivate::hasAttribute(const QString& aname) | - | ||||||||||||||||||||||||
| 4532 | { | - | ||||||||||||||||||||||||
| 4533 | return m_attr->contains(aname); never executed: return m_attr->contains(aname); | 0 | ||||||||||||||||||||||||
| 4534 | } | - | ||||||||||||||||||||||||
| 4535 | - | |||||||||||||||||||||||||
| 4536 | bool QDomElementPrivate::hasAttributeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 4537 | { | - | ||||||||||||||||||||||||
| 4538 | return m_attr->containsNS(nsURI, localName); never executed: return m_attr->containsNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 4539 | } | - | ||||||||||||||||||||||||
| 4540 | - | |||||||||||||||||||||||||
| 4541 | QString QDomElementPrivate::text() | - | ||||||||||||||||||||||||
| 4542 | { | - | ||||||||||||||||||||||||
| 4543 | QString t(QLatin1String("")); | - | ||||||||||||||||||||||||
| 4544 | - | |||||||||||||||||||||||||
| 4545 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 4546 | while (p) {
| 0 | ||||||||||||||||||||||||
| 4547 | if (p->isText() || p->isCDATASection())
| 0 | ||||||||||||||||||||||||
| 4548 | t += p->nodeValue(); never executed: t += p->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4549 | else if (p->isElement())
| 0 | ||||||||||||||||||||||||
| 4550 | t += ((QDomElementPrivate*)p)->text(); never executed: t += ((QDomElementPrivate*)p)->text(); | 0 | ||||||||||||||||||||||||
| 4551 | p = p->next; | - | ||||||||||||||||||||||||
| 4552 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4553 | - | |||||||||||||||||||||||||
| 4554 | return t; never executed: return t; | 0 | ||||||||||||||||||||||||
| 4555 | } | - | ||||||||||||||||||||||||
| 4556 | - | |||||||||||||||||||||||||
| 4557 | void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 4558 | { | - | ||||||||||||||||||||||||
| 4559 | if (!(prev && prev->isText()))
| 0-180 | ||||||||||||||||||||||||
| 4560 | s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); executed 246 times by 2 tests: s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' '));Executed by:
| 246 | ||||||||||||||||||||||||
| 4561 | - | |||||||||||||||||||||||||
| 4562 | QString qName(name); | - | ||||||||||||||||||||||||
| 4563 | QString nsDecl(QLatin1String("")); | - | ||||||||||||||||||||||||
| 4564 | if (!namespaceURI.isNull()) {
| 0-246 | ||||||||||||||||||||||||
| 4565 | /** ### | - | ||||||||||||||||||||||||
| 4566 | * | - | ||||||||||||||||||||||||
| 4567 | * If we still have QDom, optimize this so that we only declare namespaces that are not | - | ||||||||||||||||||||||||
| 4568 | * yet declared. We loose default namespace mappings, so maybe we should rather store | - | ||||||||||||||||||||||||
| 4569 | * the information that we get from startPrefixMapping()/endPrefixMapping() and use them. | - | ||||||||||||||||||||||||
| 4570 | * Modifications becomes more complex then, however. | - | ||||||||||||||||||||||||
| 4571 | * | - | ||||||||||||||||||||||||
| 4572 | * We cannot do this in a patch release because it would require too invasive changes, and | - | ||||||||||||||||||||||||
| 4573 | * hence possibly behavioral changes. | - | ||||||||||||||||||||||||
| 4574 | */ | - | ||||||||||||||||||||||||
| 4575 | if (prefix.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 4576 | nsDecl = QLatin1String(" xmlns"); | - | ||||||||||||||||||||||||
| 4577 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4578 | qName = prefix + QLatin1Char(':') + name; | - | ||||||||||||||||||||||||
| 4579 | nsDecl = QLatin1String(" xmlns:") + prefix; | - | ||||||||||||||||||||||||
| 4580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4581 | nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1Char('\"'); | - | ||||||||||||||||||||||||
| 4582 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4583 | s << '<' << qName << nsDecl; | - | ||||||||||||||||||||||||
| 4584 | - | |||||||||||||||||||||||||
| 4585 | QSet<QString> outputtedPrefixes; | - | ||||||||||||||||||||||||
| 4586 | - | |||||||||||||||||||||||||
| 4587 | /* Write out attributes. */ | - | ||||||||||||||||||||||||
| 4588 | if (!m_attr->map.isEmpty()) {
| 0-246 | ||||||||||||||||||||||||
| 4589 | QHash<QString, QDomNodePrivate *>::const_iterator it = m_attr->map.constBegin(); | - | ||||||||||||||||||||||||
| 4590 | for (; it != m_attr->map.constEnd(); ++it) {
| 246-394 | ||||||||||||||||||||||||
| 4591 | s << ' '; | - | ||||||||||||||||||||||||
| 4592 | if (it.value()->namespaceURI.isNull()) {
| 2-392 | ||||||||||||||||||||||||
| 4593 | s << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4594 | } else { executed 392 times by 1 test: end of blockExecuted by:
| 392 | ||||||||||||||||||||||||
| 4595 | s << it.value()->prefix << ':' << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4596 | /* This is a fix for 138243, as good as it gets. | - | ||||||||||||||||||||||||
| 4597 | * | - | ||||||||||||||||||||||||
| 4598 | * QDomElementPrivate::save() output a namespace declaration if | - | ||||||||||||||||||||||||
| 4599 | * the element is in a namespace, no matter what. This function do as well, meaning | - | ||||||||||||||||||||||||
| 4600 | * that we get two identical namespace declaration if we don't have the if- | - | ||||||||||||||||||||||||
| 4601 | * statement below. | - | ||||||||||||||||||||||||
| 4602 | * | - | ||||||||||||||||||||||||
| 4603 | * This doesn't work when the parent element has the same prefix as us but | - | ||||||||||||||||||||||||
| 4604 | * a different namespace. However, this can only occur by the user modifying the element, | - | ||||||||||||||||||||||||
| 4605 | * and we don't do fixups by that anyway, and hence it's the user responsibility to not | - | ||||||||||||||||||||||||
| 4606 | * arrive in those situations. */ | - | ||||||||||||||||||||||||
| 4607 | if((!it.value()->ownerNode ||
| 0-2 | ||||||||||||||||||||||||
| 4608 | it.value()->ownerNode->prefix != it.value()->prefix) &&
| 0-2 | ||||||||||||||||||||||||
| 4609 | !outputtedPrefixes.contains(it.value()->prefix)) {
| 0-2 | ||||||||||||||||||||||||
| 4610 | s << " xmlns:" << it.value()->prefix << "=\"" << encodeText(it.value()->namespaceURI, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4611 | outputtedPrefixes.insert(it.value()->prefix); | - | ||||||||||||||||||||||||
| 4612 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4613 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4614 | } | - | ||||||||||||||||||||||||
| 4615 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4616 | - | |||||||||||||||||||||||||
| 4617 | if (last) {
| 94-152 | ||||||||||||||||||||||||
| 4618 | // has child nodes | - | ||||||||||||||||||||||||
| 4619 | if (first->isText())
| 0-94 | ||||||||||||||||||||||||
| 4620 | s << '>'; never executed: s << '>'; | 0 | ||||||||||||||||||||||||
| 4621 | else { | - | ||||||||||||||||||||||||
| 4622 | s << '>'; | - | ||||||||||||||||||||||||
| 4623 | - | |||||||||||||||||||||||||
| 4624 | /* -1 disables new lines. */ | - | ||||||||||||||||||||||||
| 4625 | if (indent != -1)
| 0-94 | ||||||||||||||||||||||||
| 4626 | s << endl; executed 94 times by 1 test: s << endl;Executed by:
| 94 | ||||||||||||||||||||||||
| 4627 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 4628 | QDomNodePrivate::save(s, depth + 1, indent); if (!last->isText())
| 0-94 | ||||||||||||||||||||||||
| 4629 | s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); executed 94 times by 1 test: s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' '));Executed by:
| 94 | ||||||||||||||||||||||||
| 4630 | - | |||||||||||||||||||||||||
| 4631 | s << "</" << qName << '>'; | - | ||||||||||||||||||||||||
| 4632 | } else { executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 4633 | s << "/>"; | - | ||||||||||||||||||||||||
| 4634 | } executed 152 times by 2 tests: end of blockExecuted by:
| 152 | ||||||||||||||||||||||||
| 4635 | if (!(next && next->isText())) {
| 0-180 | ||||||||||||||||||||||||
| 4636 | /* -1 disables new lines. */ | - | ||||||||||||||||||||||||
| 4637 | if (indent != -1)
| 0-246 | ||||||||||||||||||||||||
| 4638 | s << endl; executed 246 times by 2 tests: s << endl;Executed by:
| 246 | ||||||||||||||||||||||||
| 4639 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4640 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4641 | - | |||||||||||||||||||||||||
| 4642 | /************************************************************** | - | ||||||||||||||||||||||||
| 4643 | * | - | ||||||||||||||||||||||||
| 4644 | * QDomElement | - | ||||||||||||||||||||||||
| 4645 | * | - | ||||||||||||||||||||||||
| 4646 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4647 | - | |||||||||||||||||||||||||
| 4648 | #define IMPL ((QDomElementPrivate*)impl) | - | ||||||||||||||||||||||||
| 4649 | - | |||||||||||||||||||||||||
| 4650 | /*! | - | ||||||||||||||||||||||||
| 4651 | \class QDomElement | - | ||||||||||||||||||||||||
| 4652 | \reentrant | - | ||||||||||||||||||||||||
| 4653 | \brief The QDomElement class represents one element in the DOM tree. | - | ||||||||||||||||||||||||
| 4654 | - | |||||||||||||||||||||||||
| 4655 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 4656 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 4657 | - | |||||||||||||||||||||||||
| 4658 | Elements have a tagName() and zero or more attributes associated | - | ||||||||||||||||||||||||
| 4659 | with them. The tag name can be changed with setTagName(). | - | ||||||||||||||||||||||||
| 4660 | - | |||||||||||||||||||||||||
| 4661 | Element attributes are represented by QDomAttr objects that can | - | ||||||||||||||||||||||||
| 4662 | be queried using the attribute() and attributeNode() functions. | - | ||||||||||||||||||||||||
| 4663 | You can set attributes with the setAttribute() and | - | ||||||||||||||||||||||||
| 4664 | setAttributeNode() functions. Attributes can be removed with | - | ||||||||||||||||||||||||
| 4665 | removeAttribute(). There are namespace-aware equivalents to these | - | ||||||||||||||||||||||||
| 4666 | functions, i.e. setAttributeNS(), setAttributeNodeNS() and | - | ||||||||||||||||||||||||
| 4667 | removeAttributeNS(). | - | ||||||||||||||||||||||||
| 4668 | - | |||||||||||||||||||||||||
| 4669 | If you want to access the text of a node use text(), e.g. | - | ||||||||||||||||||||||||
| 4670 | - | |||||||||||||||||||||||||
| 4671 | \snippet code/src_xml_dom_qdom.cpp 9 | - | ||||||||||||||||||||||||
| 4672 | - | |||||||||||||||||||||||||
| 4673 | The text() function operates recursively to find the text (since | - | ||||||||||||||||||||||||
| 4674 | not all elements contain text). If you want to find all the text | - | ||||||||||||||||||||||||
| 4675 | in all of a node's children, iterate over the children looking for | - | ||||||||||||||||||||||||
| 4676 | QDomText nodes, e.g. | - | ||||||||||||||||||||||||
| 4677 | - | |||||||||||||||||||||||||
| 4678 | \snippet code/src_xml_dom_qdom.cpp 10 | - | ||||||||||||||||||||||||
| 4679 | - | |||||||||||||||||||||||||
| 4680 | Note that we attempt to convert each node to a text node and use | - | ||||||||||||||||||||||||
| 4681 | text() rather than using firstChild().toText().data() or | - | ||||||||||||||||||||||||
| 4682 | n.toText().data() directly on the node, because the node may not | - | ||||||||||||||||||||||||
| 4683 | be a text element. | - | ||||||||||||||||||||||||
| 4684 | - | |||||||||||||||||||||||||
| 4685 | You can get a list of all the decendents of an element which have | - | ||||||||||||||||||||||||
| 4686 | a specified tag name with elementsByTagName() or | - | ||||||||||||||||||||||||
| 4687 | elementsByTagNameNS(). | - | ||||||||||||||||||||||||
| 4688 | - | |||||||||||||||||||||||||
| 4689 | To browse the elements of a dom document use firstChildElement(), lastChildElement(), | - | ||||||||||||||||||||||||
| 4690 | nextSiblingElement() and previousSiblingElement(). For example, to iterate over all | - | ||||||||||||||||||||||||
| 4691 | child elements called "entry" in a root element called "database", you can use: | - | ||||||||||||||||||||||||
| 4692 | - | |||||||||||||||||||||||||
| 4693 | \snippet code/src_xml_dom_qdom.cpp 11 | - | ||||||||||||||||||||||||
| 4694 | - | |||||||||||||||||||||||||
| 4695 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 4696 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 4697 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 4698 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 4699 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 4700 | */ | - | ||||||||||||||||||||||||
| 4701 | - | |||||||||||||||||||||||||
| 4702 | /*! | - | ||||||||||||||||||||||||
| 4703 | Constructs an empty element. Use the QDomDocument::createElement() | - | ||||||||||||||||||||||||
| 4704 | function to construct elements with content. | - | ||||||||||||||||||||||||
| 4705 | */ | - | ||||||||||||||||||||||||
| 4706 | QDomElement::QDomElement() | - | ||||||||||||||||||||||||
| 4707 | : QDomNode() | - | ||||||||||||||||||||||||
| 4708 | { | - | ||||||||||||||||||||||||
| 4709 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 4710 | - | |||||||||||||||||||||||||
| 4711 | /*! | - | ||||||||||||||||||||||||
| 4712 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 4713 | - | |||||||||||||||||||||||||
| 4714 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4715 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4716 | cloneNode(). | - | ||||||||||||||||||||||||
| 4717 | */ | - | ||||||||||||||||||||||||
| 4718 | QDomElement::QDomElement(const QDomElement& x) | - | ||||||||||||||||||||||||
| 4719 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 4720 | { | - | ||||||||||||||||||||||||
| 4721 | } executed 96 times by 1 test: end of blockExecuted by:
| 96 | ||||||||||||||||||||||||
| 4722 | - | |||||||||||||||||||||||||
| 4723 | QDomElement::QDomElement(QDomElementPrivate* n) | - | ||||||||||||||||||||||||
| 4724 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 4725 | { | - | ||||||||||||||||||||||||
| 4726 | } executed 256 times by 1 test: end of blockExecuted by:
| 256 | ||||||||||||||||||||||||
| 4727 | - | |||||||||||||||||||||||||
| 4728 | /*! | - | ||||||||||||||||||||||||
| 4729 | Assigns \a x to this DOM element. | - | ||||||||||||||||||||||||
| 4730 | - | |||||||||||||||||||||||||
| 4731 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4732 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4733 | cloneNode(). | - | ||||||||||||||||||||||||
| 4734 | */ | - | ||||||||||||||||||||||||
| 4735 | QDomElement& QDomElement::operator= (const QDomElement& x) | - | ||||||||||||||||||||||||
| 4736 | { | - | ||||||||||||||||||||||||
| 4737 | return (QDomElement&) QDomNode::operator=(x); executed 71 times by 1 test: return (QDomElement&) QDomNode::operator=(x);Executed by:
| 71 | ||||||||||||||||||||||||
| 4738 | } | - | ||||||||||||||||||||||||
| 4739 | - | |||||||||||||||||||||||||
| 4740 | /*! | - | ||||||||||||||||||||||||
| 4741 | \fn QDomNode::NodeType QDomElement::nodeType() const | - | ||||||||||||||||||||||||
| 4742 | - | |||||||||||||||||||||||||
| 4743 | Returns \c ElementNode. | - | ||||||||||||||||||||||||
| 4744 | */ | - | ||||||||||||||||||||||||
| 4745 | - | |||||||||||||||||||||||||
| 4746 | /*! | - | ||||||||||||||||||||||||
| 4747 | Sets this element's tag name to \a name. | - | ||||||||||||||||||||||||
| 4748 | - | |||||||||||||||||||||||||
| 4749 | \sa tagName() | - | ||||||||||||||||||||||||
| 4750 | */ | - | ||||||||||||||||||||||||
| 4751 | void QDomElement::setTagName(const QString& name) | - | ||||||||||||||||||||||||
| 4752 | { | - | ||||||||||||||||||||||||
| 4753 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4754 | impl->name = name; never executed: impl->name = name; | 0 | ||||||||||||||||||||||||
| 4755 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4756 | - | |||||||||||||||||||||||||
| 4757 | /*! | - | ||||||||||||||||||||||||
| 4758 | Returns the tag name of this element. For an XML element like this: | - | ||||||||||||||||||||||||
| 4759 | - | |||||||||||||||||||||||||
| 4760 | \snippet code/src_xml_dom_qdom.cpp 12 | - | ||||||||||||||||||||||||
| 4761 | - | |||||||||||||||||||||||||
| 4762 | the tagname would return "img". | - | ||||||||||||||||||||||||
| 4763 | - | |||||||||||||||||||||||||
| 4764 | \sa setTagName() | - | ||||||||||||||||||||||||
| 4765 | */ | - | ||||||||||||||||||||||||
| 4766 | QString QDomElement::tagName() const | - | ||||||||||||||||||||||||
| 4767 | { | - | ||||||||||||||||||||||||
| 4768 | if (!impl)
| 0-197 | ||||||||||||||||||||||||
| 4769 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4770 | return impl->nodeName(); executed 197 times by 1 test: return impl->nodeName();Executed by:
| 197 | ||||||||||||||||||||||||
| 4771 | } | - | ||||||||||||||||||||||||
| 4772 | - | |||||||||||||||||||||||||
| 4773 | - | |||||||||||||||||||||||||
| 4774 | /*! | - | ||||||||||||||||||||||||
| 4775 | Returns a QDomNamedNodeMap containing all this element's attributes. | - | ||||||||||||||||||||||||
| 4776 | - | |||||||||||||||||||||||||
| 4777 | \sa attribute(), setAttribute(), attributeNode(), setAttributeNode() | - | ||||||||||||||||||||||||
| 4778 | */ | - | ||||||||||||||||||||||||
| 4779 | QDomNamedNodeMap QDomElement::attributes() const | - | ||||||||||||||||||||||||
| 4780 | { | - | ||||||||||||||||||||||||
| 4781 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4782 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 4783 | return QDomNamedNodeMap(IMPL->attributes()); never executed: return QDomNamedNodeMap(((QDomElementPrivate*)impl)->attributes()); | 0 | ||||||||||||||||||||||||
| 4784 | } | - | ||||||||||||||||||||||||
| 4785 | - | |||||||||||||||||||||||||
| 4786 | /*! | - | ||||||||||||||||||||||||
| 4787 | Returns the attribute called \a name. If the attribute does not | - | ||||||||||||||||||||||||
| 4788 | exist \a defValue is returned. | - | ||||||||||||||||||||||||
| 4789 | - | |||||||||||||||||||||||||
| 4790 | \sa setAttribute(), attributeNode(), setAttributeNode(), attributeNS() | - | ||||||||||||||||||||||||
| 4791 | */ | - | ||||||||||||||||||||||||
| 4792 | QString QDomElement::attribute(const QString& name, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4793 | { | - | ||||||||||||||||||||||||
| 4794 | if (!impl)
| 0-34 | ||||||||||||||||||||||||
| 4795 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4796 | return IMPL->attribute(name, defValue); executed 34 times by 1 test: return ((QDomElementPrivate*)impl)->attribute(name, defValue);Executed by:
| 34 | ||||||||||||||||||||||||
| 4797 | } | - | ||||||||||||||||||||||||
| 4798 | - | |||||||||||||||||||||||||
| 4799 | /*! | - | ||||||||||||||||||||||||
| 4800 | Adds an attribute called \a name with value \a value. If an | - | ||||||||||||||||||||||||
| 4801 | attribute with the same name exists, its value is replaced by \a | - | ||||||||||||||||||||||||
| 4802 | value. | - | ||||||||||||||||||||||||
| 4803 | - | |||||||||||||||||||||||||
| 4804 | \sa attribute(), setAttributeNode(), setAttributeNS() | - | ||||||||||||||||||||||||
| 4805 | */ | - | ||||||||||||||||||||||||
| 4806 | void QDomElement::setAttribute(const QString& name, const QString& value) | - | ||||||||||||||||||||||||
| 4807 | { | - | ||||||||||||||||||||||||
| 4808 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4809 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4810 | IMPL->setAttribute(name, value); | - | ||||||||||||||||||||||||
| 4811 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4812 | - | |||||||||||||||||||||||||
| 4813 | /*! | - | ||||||||||||||||||||||||
| 4814 | \fn void QDomElement::setAttribute(const QString& name, int value) | - | ||||||||||||||||||||||||
| 4815 | - | |||||||||||||||||||||||||
| 4816 | \overload | - | ||||||||||||||||||||||||
| 4817 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4818 | */ | - | ||||||||||||||||||||||||
| 4819 | - | |||||||||||||||||||||||||
| 4820 | /*! | - | ||||||||||||||||||||||||
| 4821 | \fn void QDomElement::setAttribute(const QString& name, uint value) | - | ||||||||||||||||||||||||
| 4822 | - | |||||||||||||||||||||||||
| 4823 | \overload | - | ||||||||||||||||||||||||
| 4824 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4825 | */ | - | ||||||||||||||||||||||||
| 4826 | - | |||||||||||||||||||||||||
| 4827 | /*! | - | ||||||||||||||||||||||||
| 4828 | \overload | - | ||||||||||||||||||||||||
| 4829 | - | |||||||||||||||||||||||||
| 4830 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4831 | */ | - | ||||||||||||||||||||||||
| 4832 | void QDomElement::setAttribute(const QString& name, qlonglong value) | - | ||||||||||||||||||||||||
| 4833 | { | - | ||||||||||||||||||||||||
| 4834 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4835 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4836 | QString x; | - | ||||||||||||||||||||||||
| 4837 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4838 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4840 | - | |||||||||||||||||||||||||
| 4841 | /*! | - | ||||||||||||||||||||||||
| 4842 | \overload | - | ||||||||||||||||||||||||
| 4843 | - | |||||||||||||||||||||||||
| 4844 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4845 | */ | - | ||||||||||||||||||||||||
| 4846 | void QDomElement::setAttribute(const QString& name, qulonglong value) | - | ||||||||||||||||||||||||
| 4847 | { | - | ||||||||||||||||||||||||
| 4848 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4849 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4850 | QString x; | - | ||||||||||||||||||||||||
| 4851 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4852 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4853 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4854 | - | |||||||||||||||||||||||||
| 4855 | /*! | - | ||||||||||||||||||||||||
| 4856 | \overload | - | ||||||||||||||||||||||||
| 4857 | - | |||||||||||||||||||||||||
| 4858 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4859 | */ | - | ||||||||||||||||||||||||
| 4860 | void QDomElement::setAttribute(const QString& name, float value) | - | ||||||||||||||||||||||||
| 4861 | { | - | ||||||||||||||||||||||||
| 4862 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4863 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4864 | QString x; | - | ||||||||||||||||||||||||
| 4865 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4866 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4867 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4868 | - | |||||||||||||||||||||||||
| 4869 | /*! | - | ||||||||||||||||||||||||
| 4870 | \overload | - | ||||||||||||||||||||||||
| 4871 | - | |||||||||||||||||||||||||
| 4872 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4873 | */ | - | ||||||||||||||||||||||||
| 4874 | void QDomElement::setAttribute(const QString& name, double value) | - | ||||||||||||||||||||||||
| 4875 | { | - | ||||||||||||||||||||||||
| 4876 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4877 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4878 | QString x; | - | ||||||||||||||||||||||||
| 4879 | char buf[256]; | - | ||||||||||||||||||||||||
| 4880 | int count = qsnprintf(buf, sizeof(buf), "%.16g", value); | - | ||||||||||||||||||||||||
| 4881 | if (count > 0)
| 0 | ||||||||||||||||||||||||
| 4882 | x = QString::fromLatin1(buf, count); never executed: x = QString::fromLatin1(buf, count); | 0 | ||||||||||||||||||||||||
| 4883 | else | - | ||||||||||||||||||||||||
| 4884 | x.setNum(value); // Fallback never executed: x.setNum(value); | 0 | ||||||||||||||||||||||||
| 4885 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4886 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4887 | - | |||||||||||||||||||||||||
| 4888 | /*! | - | ||||||||||||||||||||||||
| 4889 | Removes the attribute called name \a name from this element. | - | ||||||||||||||||||||||||
| 4890 | - | |||||||||||||||||||||||||
| 4891 | \sa setAttribute(), attribute(), removeAttributeNS() | - | ||||||||||||||||||||||||
| 4892 | */ | - | ||||||||||||||||||||||||
| 4893 | void QDomElement::removeAttribute(const QString& name) | - | ||||||||||||||||||||||||
| 4894 | { | - | ||||||||||||||||||||||||
| 4895 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4896 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4897 | IMPL->removeAttribute(name); | - | ||||||||||||||||||||||||
| 4898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4899 | - | |||||||||||||||||||||||||
| 4900 | /*! | - | ||||||||||||||||||||||||
| 4901 | Returns the QDomAttr object that corresponds to the attribute | - | ||||||||||||||||||||||||
| 4902 | called \a name. If no such attribute exists a | - | ||||||||||||||||||||||||
| 4903 | \l{QDomNode::isNull()}{null attribute} is returned. | - | ||||||||||||||||||||||||
| 4904 | - | |||||||||||||||||||||||||
| 4905 | \sa setAttributeNode(), attribute(), setAttribute(), attributeNodeNS() | - | ||||||||||||||||||||||||
| 4906 | */ | - | ||||||||||||||||||||||||
| 4907 | QDomAttr QDomElement::attributeNode(const QString& name) | - | ||||||||||||||||||||||||
| 4908 | { | - | ||||||||||||||||||||||||
| 4909 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4910 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4911 | return QDomAttr(IMPL->attributeNode(name)); never executed: return QDomAttr(((QDomElementPrivate*)impl)->attributeNode(name)); | 0 | ||||||||||||||||||||||||
| 4912 | } | - | ||||||||||||||||||||||||
| 4913 | - | |||||||||||||||||||||||||
| 4914 | /*! | - | ||||||||||||||||||||||||
| 4915 | Adds the attribute \a newAttr to this element. | - | ||||||||||||||||||||||||
| 4916 | - | |||||||||||||||||||||||||
| 4917 | If the element has another attribute that has the same name as \a | - | ||||||||||||||||||||||||
| 4918 | newAttr, this function replaces that attribute and returns it; | - | ||||||||||||||||||||||||
| 4919 | otherwise the function returns a | - | ||||||||||||||||||||||||
| 4920 | \l{QDomNode::isNull()}{null attribute}. | - | ||||||||||||||||||||||||
| 4921 | - | |||||||||||||||||||||||||
| 4922 | \sa attributeNode(), setAttribute(), setAttributeNodeNS() | - | ||||||||||||||||||||||||
| 4923 | */ | - | ||||||||||||||||||||||||
| 4924 | QDomAttr QDomElement::setAttributeNode(const QDomAttr& newAttr) | - | ||||||||||||||||||||||||
| 4925 | { | - | ||||||||||||||||||||||||
| 4926 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4927 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4928 | return QDomAttr(IMPL->setAttributeNode(((QDomAttrPrivate*)newAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->setAttributeNode(((QDomAttrPrivate*)newAttr.impl))); | 0 | ||||||||||||||||||||||||
| 4929 | } | - | ||||||||||||||||||||||||
| 4930 | - | |||||||||||||||||||||||||
| 4931 | /*! | - | ||||||||||||||||||||||||
| 4932 | Removes the attribute \a oldAttr from the element and returns it. | - | ||||||||||||||||||||||||
| 4933 | - | |||||||||||||||||||||||||
| 4934 | \sa attributeNode(), setAttributeNode() | - | ||||||||||||||||||||||||
| 4935 | */ | - | ||||||||||||||||||||||||
| 4936 | QDomAttr QDomElement::removeAttributeNode(const QDomAttr& oldAttr) | - | ||||||||||||||||||||||||
| 4937 | { | - | ||||||||||||||||||||||||
| 4938 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4939 | return QDomAttr(); // ### should this return oldAttr? never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4940 | return QDomAttr(IMPL->removeAttributeNode(((QDomAttrPrivate*)oldAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->removeAttributeNode(((QDomAttrPrivate*)oldAttr.impl))); | 0 | ||||||||||||||||||||||||
| 4941 | } | - | ||||||||||||||||||||||||
| 4942 | - | |||||||||||||||||||||||||
| 4943 | /*! | - | ||||||||||||||||||||||||
| 4944 | Returns a QDomNodeList containing all descendants of this element | - | ||||||||||||||||||||||||
| 4945 | named \a tagname encountered during a preorder traversal of the | - | ||||||||||||||||||||||||
| 4946 | element subtree with this element as its root. The order of the | - | ||||||||||||||||||||||||
| 4947 | elements in the returned list is the order they are encountered | - | ||||||||||||||||||||||||
| 4948 | during the preorder traversal. | - | ||||||||||||||||||||||||
| 4949 | - | |||||||||||||||||||||||||
| 4950 | \sa elementsByTagNameNS(), QDomDocument::elementsByTagName() | - | ||||||||||||||||||||||||
| 4951 | */ | - | ||||||||||||||||||||||||
| 4952 | QDomNodeList QDomElement::elementsByTagName(const QString& tagname) const | - | ||||||||||||||||||||||||
| 4953 | { | - | ||||||||||||||||||||||||
| 4954 | return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); | 0 | ||||||||||||||||||||||||
| 4955 | } | - | ||||||||||||||||||||||||
| 4956 | - | |||||||||||||||||||||||||
| 4957 | /*! | - | ||||||||||||||||||||||||
| 4958 | Returns \c true if this element has an attribute called \a name; | - | ||||||||||||||||||||||||
| 4959 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 4960 | - | |||||||||||||||||||||||||
| 4961 | \b{Note:} This function does not take the presence of namespaces | - | ||||||||||||||||||||||||
| 4962 | into account. As a result, the specified name will be tested | - | ||||||||||||||||||||||||
| 4963 | against fully-qualified attribute names that include any namespace | - | ||||||||||||||||||||||||
| 4964 | prefixes that may be present. | - | ||||||||||||||||||||||||
| 4965 | - | |||||||||||||||||||||||||
| 4966 | Use hasAttributeNS() to explicitly test for attributes with specific | - | ||||||||||||||||||||||||
| 4967 | namespaces and names. | - | ||||||||||||||||||||||||
| 4968 | */ | - | ||||||||||||||||||||||||
| 4969 | bool QDomElement::hasAttribute(const QString& name) const | - | ||||||||||||||||||||||||
| 4970 | { | - | ||||||||||||||||||||||||
| 4971 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4972 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 4973 | return IMPL->hasAttribute(name); never executed: return ((QDomElementPrivate*)impl)->hasAttribute(name); | 0 | ||||||||||||||||||||||||
| 4974 | } | - | ||||||||||||||||||||||||
| 4975 | - | |||||||||||||||||||||||||
| 4976 | /*! | - | ||||||||||||||||||||||||
| 4977 | Returns the attribute with the local name \a localName and the | - | ||||||||||||||||||||||||
| 4978 | namespace URI \a nsURI. If the attribute does not exist \a | - | ||||||||||||||||||||||||
| 4979 | defValue is returned. | - | ||||||||||||||||||||||||
| 4980 | - | |||||||||||||||||||||||||
| 4981 | \sa setAttributeNS(), attributeNodeNS(), setAttributeNodeNS(), attribute() | - | ||||||||||||||||||||||||
| 4982 | */ | - | ||||||||||||||||||||||||
| 4983 | QString QDomElement::attributeNS(const QString nsURI, const QString& localName, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4984 | { | - | ||||||||||||||||||||||||
| 4985 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4986 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4987 | return IMPL->attributeNS(nsURI, localName, defValue); never executed: return ((QDomElementPrivate*)impl)->attributeNS(nsURI, localName, defValue); | 0 | ||||||||||||||||||||||||
| 4988 | } | - | ||||||||||||||||||||||||
| 4989 | - | |||||||||||||||||||||||||
| 4990 | /*! | - | ||||||||||||||||||||||||
| 4991 | Adds an attribute with the qualified name \a qName and the | - | ||||||||||||||||||||||||
| 4992 | namespace URI \a nsURI with the value \a value. If an attribute | - | ||||||||||||||||||||||||
| 4993 | with the same local name and namespace URI exists, its prefix is | - | ||||||||||||||||||||||||
| 4994 | replaced by the prefix of \a qName and its value is repaced by \a | - | ||||||||||||||||||||||||
| 4995 | value. | - | ||||||||||||||||||||||||
| 4996 | - | |||||||||||||||||||||||||
| 4997 | Although \a qName is the qualified name, the local name is used to | - | ||||||||||||||||||||||||
| 4998 | decide if an existing attribute's value should be replaced. | - | ||||||||||||||||||||||||
| 4999 | - | |||||||||||||||||||||||||
| 5000 | \sa attributeNS(), setAttributeNodeNS(), setAttribute() | - | ||||||||||||||||||||||||
| 5001 | */ | - | ||||||||||||||||||||||||
| 5002 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, const QString& value) | - | ||||||||||||||||||||||||
| 5003 | { | - | ||||||||||||||||||||||||
| 5004 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5005 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5006 | IMPL->setAttributeNS(nsURI, qName, value); | - | ||||||||||||||||||||||||
| 5007 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5008 | - | |||||||||||||||||||||||||
| 5009 | /*! | - | ||||||||||||||||||||||||
| 5010 | \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, int value) | - | ||||||||||||||||||||||||
| 5011 | - | |||||||||||||||||||||||||
| 5012 | \overload | - | ||||||||||||||||||||||||
| 5013 | */ | - | ||||||||||||||||||||||||
| 5014 | - | |||||||||||||||||||||||||
| 5015 | /*! | - | ||||||||||||||||||||||||
| 5016 | \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, uint value) | - | ||||||||||||||||||||||||
| 5017 | - | |||||||||||||||||||||||||
| 5018 | \overload | - | ||||||||||||||||||||||||
| 5019 | */ | - | ||||||||||||||||||||||||
| 5020 | - | |||||||||||||||||||||||||
| 5021 | /*! | - | ||||||||||||||||||||||||
| 5022 | \overload | - | ||||||||||||||||||||||||
| 5023 | */ | - | ||||||||||||||||||||||||
| 5024 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qlonglong value) | - | ||||||||||||||||||||||||
| 5025 | { | - | ||||||||||||||||||||||||
| 5026 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5027 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5028 | QString x; | - | ||||||||||||||||||||||||
| 5029 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5030 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5031 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5032 | - | |||||||||||||||||||||||||
| 5033 | /*! | - | ||||||||||||||||||||||||
| 5034 | \overload | - | ||||||||||||||||||||||||
| 5035 | */ | - | ||||||||||||||||||||||||
| 5036 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qulonglong value) | - | ||||||||||||||||||||||||
| 5037 | { | - | ||||||||||||||||||||||||
| 5038 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5039 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5040 | QString x; | - | ||||||||||||||||||||||||
| 5041 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5042 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5043 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5044 | - | |||||||||||||||||||||||||
| 5045 | /*! | - | ||||||||||||||||||||||||
| 5046 | \overload | - | ||||||||||||||||||||||||
| 5047 | */ | - | ||||||||||||||||||||||||
| 5048 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, double value) | - | ||||||||||||||||||||||||
| 5049 | { | - | ||||||||||||||||||||||||
| 5050 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5051 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5052 | QString x; | - | ||||||||||||||||||||||||
| 5053 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5054 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5055 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5056 | - | |||||||||||||||||||||||||
| 5057 | /*! | - | ||||||||||||||||||||||||
| 5058 | Removes the attribute with the local name \a localName and the | - | ||||||||||||||||||||||||
| 5059 | namespace URI \a nsURI from this element. | - | ||||||||||||||||||||||||
| 5060 | - | |||||||||||||||||||||||||
| 5061 | \sa setAttributeNS(), attributeNS(), removeAttribute() | - | ||||||||||||||||||||||||
| 5062 | */ | - | ||||||||||||||||||||||||
| 5063 | void QDomElement::removeAttributeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 5064 | { | - | ||||||||||||||||||||||||
| 5065 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5066 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5067 | QDomNodePrivate *n = IMPL->attributeNodeNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 5068 | if (!n)
| 0 | ||||||||||||||||||||||||
| 5069 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5070 | IMPL->removeAttribute(n->nodeName()); | - | ||||||||||||||||||||||||
| 5071 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5072 | - | |||||||||||||||||||||||||
| 5073 | /*! | - | ||||||||||||||||||||||||
| 5074 | Returns the QDomAttr object that corresponds to the attribute | - | ||||||||||||||||||||||||
| 5075 | with the local name \a localName and the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 5076 | If no such attribute exists a \l{QDomNode::isNull()}{null | - | ||||||||||||||||||||||||
| 5077 | attribute} is returned. | - | ||||||||||||||||||||||||
| 5078 | - | |||||||||||||||||||||||||
| 5079 | \sa setAttributeNode(), attribute(), setAttribute() | - | ||||||||||||||||||||||||
| 5080 | */ | - | ||||||||||||||||||||||||
| 5081 | QDomAttr QDomElement::attributeNodeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 5082 | { | - | ||||||||||||||||||||||||
| 5083 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5084 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 5085 | return QDomAttr(IMPL->attributeNodeNS(nsURI, localName)); never executed: return QDomAttr(((QDomElementPrivate*)impl)->attributeNodeNS(nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 5086 | } | - | ||||||||||||||||||||||||
| 5087 | - | |||||||||||||||||||||||||
| 5088 | /*! | - | ||||||||||||||||||||||||
| 5089 | Adds the attribute \a newAttr to this element. | - | ||||||||||||||||||||||||
| 5090 | - | |||||||||||||||||||||||||
| 5091 | If the element has another attribute that has the same local name | - | ||||||||||||||||||||||||
| 5092 | and namespace URI as \a newAttr, this function replaces that | - | ||||||||||||||||||||||||
| 5093 | attribute and returns it; otherwise the function returns a | - | ||||||||||||||||||||||||
| 5094 | \l{QDomNode::isNull()}{null attribute}. | - | ||||||||||||||||||||||||
| 5095 | - | |||||||||||||||||||||||||
| 5096 | \sa attributeNodeNS(), setAttributeNS(), setAttributeNode() | - | ||||||||||||||||||||||||
| 5097 | */ | - | ||||||||||||||||||||||||
| 5098 | QDomAttr QDomElement::setAttributeNodeNS(const QDomAttr& newAttr) | - | ||||||||||||||||||||||||
| 5099 | { | - | ||||||||||||||||||||||||
| 5100 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5101 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 5102 | return QDomAttr(IMPL->setAttributeNodeNS(((QDomAttrPrivate*)newAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->setAttributeNodeNS(((QDomAttrPrivate*)newAttr.impl))); | 0 | ||||||||||||||||||||||||
| 5103 | } | - | ||||||||||||||||||||||||
| 5104 | - | |||||||||||||||||||||||||
| 5105 | /*! | - | ||||||||||||||||||||||||
| 5106 | Returns a QDomNodeList containing all descendants of this element | - | ||||||||||||||||||||||||
| 5107 | with local name \a localName and namespace URI \a nsURI encountered | - | ||||||||||||||||||||||||
| 5108 | during a preorder traversal of the element subtree with this element | - | ||||||||||||||||||||||||
| 5109 | as its root. The order of the elements in the returned list is the | - | ||||||||||||||||||||||||
| 5110 | order they are encountered during the preorder traversal. | - | ||||||||||||||||||||||||
| 5111 | - | |||||||||||||||||||||||||
| 5112 | \sa elementsByTagName(), QDomDocument::elementsByTagNameNS() | - | ||||||||||||||||||||||||
| 5113 | */ | - | ||||||||||||||||||||||||
| 5114 | QDomNodeList QDomElement::elementsByTagNameNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 5115 | { | - | ||||||||||||||||||||||||
| 5116 | return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 5117 | } | - | ||||||||||||||||||||||||
| 5118 | - | |||||||||||||||||||||||||
| 5119 | /*! | - | ||||||||||||||||||||||||
| 5120 | Returns \c true if this element has an attribute with the local name | - | ||||||||||||||||||||||||
| 5121 | \a localName and the namespace URI \a nsURI; otherwise returns | - | ||||||||||||||||||||||||
| 5122 | false. | - | ||||||||||||||||||||||||
| 5123 | */ | - | ||||||||||||||||||||||||
| 5124 | bool QDomElement::hasAttributeNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 5125 | { | - | ||||||||||||||||||||||||
| 5126 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5127 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 5128 | return IMPL->hasAttributeNS(nsURI, localName); never executed: return ((QDomElementPrivate*)impl)->hasAttributeNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 5129 | } | - | ||||||||||||||||||||||||
| 5130 | - | |||||||||||||||||||||||||
| 5131 | /*! | - | ||||||||||||||||||||||||
| 5132 | Returns the element's text or an empty string. | - | ||||||||||||||||||||||||
| 5133 | - | |||||||||||||||||||||||||
| 5134 | Example: | - | ||||||||||||||||||||||||
| 5135 | \snippet code/src_xml_dom_qdom.cpp 13 | - | ||||||||||||||||||||||||
| 5136 | - | |||||||||||||||||||||||||
| 5137 | The function text() of the QDomElement for the \c{<h1>} tag, | - | ||||||||||||||||||||||||
| 5138 | will return the following text: | - | ||||||||||||||||||||||||
| 5139 | - | |||||||||||||||||||||||||
| 5140 | \snippet code/src_xml_dom_qdom.cpp 14 | - | ||||||||||||||||||||||||
| 5141 | - | |||||||||||||||||||||||||
| 5142 | Comments are ignored by this function. It only evaluates QDomText | - | ||||||||||||||||||||||||
| 5143 | and QDomCDATASection objects. | - | ||||||||||||||||||||||||
| 5144 | */ | - | ||||||||||||||||||||||||
| 5145 | QString QDomElement::text() const | - | ||||||||||||||||||||||||
| 5146 | { | - | ||||||||||||||||||||||||
| 5147 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5148 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5149 | return IMPL->text(); never executed: return ((QDomElementPrivate*)impl)->text(); | 0 | ||||||||||||||||||||||||
| 5150 | } | - | ||||||||||||||||||||||||
| 5151 | - | |||||||||||||||||||||||||
| 5152 | #undef IMPL | - | ||||||||||||||||||||||||
| 5153 | - | |||||||||||||||||||||||||
| 5154 | /************************************************************** | - | ||||||||||||||||||||||||
| 5155 | * | - | ||||||||||||||||||||||||
| 5156 | * QDomTextPrivate | - | ||||||||||||||||||||||||
| 5157 | * | - | ||||||||||||||||||||||||
| 5158 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5159 | - | |||||||||||||||||||||||||
| 5160 | QDomTextPrivate::QDomTextPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& val) | - | ||||||||||||||||||||||||
| 5161 | : QDomCharacterDataPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5162 | { | - | ||||||||||||||||||||||||
| 5163 | name = QLatin1String("#text"); | - | ||||||||||||||||||||||||
| 5164 | } executed 993 times by 5 tests: end of blockExecuted by:
| 993 | ||||||||||||||||||||||||
| 5165 | - | |||||||||||||||||||||||||
| 5166 | QDomTextPrivate::QDomTextPrivate(QDomTextPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5167 | : QDomCharacterDataPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5168 | { | - | ||||||||||||||||||||||||
| 5169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5170 | - | |||||||||||||||||||||||||
| 5171 | QDomNodePrivate* QDomTextPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5172 | { | - | ||||||||||||||||||||||||
| 5173 | QDomNodePrivate* p = new QDomTextPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5174 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5175 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5176 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5177 | } | - | ||||||||||||||||||||||||
| 5178 | - | |||||||||||||||||||||||||
| 5179 | QDomTextPrivate* QDomTextPrivate::splitText(int offset) | - | ||||||||||||||||||||||||
| 5180 | { | - | ||||||||||||||||||||||||
| 5181 | if (!parent()) {
| 0 | ||||||||||||||||||||||||
| 5182 | qWarning("QDomText::splitText The node has no parent. So I can not split"); | - | ||||||||||||||||||||||||
| 5183 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 5184 | } | - | ||||||||||||||||||||||||
| 5185 | - | |||||||||||||||||||||||||
| 5186 | QDomTextPrivate* t = new QDomTextPrivate(ownerDocument(), 0, value.mid(offset)); | - | ||||||||||||||||||||||||
| 5187 | value.truncate(offset); | - | ||||||||||||||||||||||||
| 5188 | - | |||||||||||||||||||||||||
| 5189 | parent()->insertAfter(t, this); | - | ||||||||||||||||||||||||
| 5190 | - | |||||||||||||||||||||||||
| 5191 | return t; never executed: return t; | 0 | ||||||||||||||||||||||||
| 5192 | } | - | ||||||||||||||||||||||||
| 5193 | - | |||||||||||||||||||||||||
| 5194 | void QDomTextPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5195 | { | - | ||||||||||||||||||||||||
| 5196 | QDomTextPrivate *that = const_cast<QDomTextPrivate*>(this); | - | ||||||||||||||||||||||||
| 5197 | s << encodeText(value, s, !(that->parent() && that->parent()->isElement()), false, true); | - | ||||||||||||||||||||||||
| 5198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5199 | - | |||||||||||||||||||||||||
| 5200 | /************************************************************** | - | ||||||||||||||||||||||||
| 5201 | * | - | ||||||||||||||||||||||||
| 5202 | * QDomText | - | ||||||||||||||||||||||||
| 5203 | * | - | ||||||||||||||||||||||||
| 5204 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5205 | - | |||||||||||||||||||||||||
| 5206 | #define IMPL ((QDomTextPrivate*)impl) | - | ||||||||||||||||||||||||
| 5207 | - | |||||||||||||||||||||||||
| 5208 | /*! | - | ||||||||||||||||||||||||
| 5209 | \class QDomText | - | ||||||||||||||||||||||||
| 5210 | \reentrant | - | ||||||||||||||||||||||||
| 5211 | \brief The QDomText class represents text data in the parsed XML document. | - | ||||||||||||||||||||||||
| 5212 | - | |||||||||||||||||||||||||
| 5213 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5214 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5215 | - | |||||||||||||||||||||||||
| 5216 | You can split the text in a QDomText object over two QDomText | - | ||||||||||||||||||||||||
| 5217 | objecs with splitText(). | - | ||||||||||||||||||||||||
| 5218 | - | |||||||||||||||||||||||||
| 5219 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5220 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5221 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5222 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5223 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5224 | */ | - | ||||||||||||||||||||||||
| 5225 | - | |||||||||||||||||||||||||
| 5226 | /*! | - | ||||||||||||||||||||||||
| 5227 | Constructs an empty QDomText object. | - | ||||||||||||||||||||||||
| 5228 | - | |||||||||||||||||||||||||
| 5229 | To construct a QDomText with content, use QDomDocument::createTextNode(). | - | ||||||||||||||||||||||||
| 5230 | */ | - | ||||||||||||||||||||||||
| 5231 | QDomText::QDomText() | - | ||||||||||||||||||||||||
| 5232 | : QDomCharacterData() | - | ||||||||||||||||||||||||
| 5233 | { | - | ||||||||||||||||||||||||
| 5234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5235 | - | |||||||||||||||||||||||||
| 5236 | /*! | - | ||||||||||||||||||||||||
| 5237 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5238 | - | |||||||||||||||||||||||||
| 5239 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5240 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5241 | cloneNode(). | - | ||||||||||||||||||||||||
| 5242 | */ | - | ||||||||||||||||||||||||
| 5243 | QDomText::QDomText(const QDomText& x) | - | ||||||||||||||||||||||||
| 5244 | : QDomCharacterData(x) | - | ||||||||||||||||||||||||
| 5245 | { | - | ||||||||||||||||||||||||
| 5246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5247 | - | |||||||||||||||||||||||||
| 5248 | QDomText::QDomText(QDomTextPrivate* n) | - | ||||||||||||||||||||||||
| 5249 | : QDomCharacterData(n) | - | ||||||||||||||||||||||||
| 5250 | { | - | ||||||||||||||||||||||||
| 5251 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5252 | - | |||||||||||||||||||||||||
| 5253 | /*! | - | ||||||||||||||||||||||||
| 5254 | Assigns \a x to this DOM text. | - | ||||||||||||||||||||||||
| 5255 | - | |||||||||||||||||||||||||
| 5256 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5257 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5258 | cloneNode(). | - | ||||||||||||||||||||||||
| 5259 | */ | - | ||||||||||||||||||||||||
| 5260 | QDomText& QDomText::operator= (const QDomText& x) | - | ||||||||||||||||||||||||
| 5261 | { | - | ||||||||||||||||||||||||
| 5262 | return (QDomText&) QDomNode::operator=(x); never executed: return (QDomText&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5263 | } | - | ||||||||||||||||||||||||
| 5264 | - | |||||||||||||||||||||||||
| 5265 | /*! | - | ||||||||||||||||||||||||
| 5266 | \fn QDomNode::NodeType QDomText::nodeType() const | - | ||||||||||||||||||||||||
| 5267 | - | |||||||||||||||||||||||||
| 5268 | Returns \c TextNode. | - | ||||||||||||||||||||||||
| 5269 | */ | - | ||||||||||||||||||||||||
| 5270 | - | |||||||||||||||||||||||||
| 5271 | /*! | - | ||||||||||||||||||||||||
| 5272 | Splits this DOM text object into two QDomText objects. This object | - | ||||||||||||||||||||||||
| 5273 | keeps its first \a offset characters and the second (newly | - | ||||||||||||||||||||||||
| 5274 | created) object is inserted into the document tree after this | - | ||||||||||||||||||||||||
| 5275 | object with the remaining characters. | - | ||||||||||||||||||||||||
| 5276 | - | |||||||||||||||||||||||||
| 5277 | The function returns the newly created object. | - | ||||||||||||||||||||||||
| 5278 | - | |||||||||||||||||||||||||
| 5279 | \sa QDomNode::normalize() | - | ||||||||||||||||||||||||
| 5280 | */ | - | ||||||||||||||||||||||||
| 5281 | QDomText QDomText::splitText(int offset) | - | ||||||||||||||||||||||||
| 5282 | { | - | ||||||||||||||||||||||||
| 5283 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5284 | return QDomText(); never executed: return QDomText(); | 0 | ||||||||||||||||||||||||
| 5285 | return QDomText(IMPL->splitText(offset)); never executed: return QDomText(((QDomTextPrivate*)impl)->splitText(offset)); | 0 | ||||||||||||||||||||||||
| 5286 | } | - | ||||||||||||||||||||||||
| 5287 | - | |||||||||||||||||||||||||
| 5288 | #undef IMPL | - | ||||||||||||||||||||||||
| 5289 | - | |||||||||||||||||||||||||
| 5290 | /************************************************************** | - | ||||||||||||||||||||||||
| 5291 | * | - | ||||||||||||||||||||||||
| 5292 | * QDomCommentPrivate | - | ||||||||||||||||||||||||
| 5293 | * | - | ||||||||||||||||||||||||
| 5294 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5295 | - | |||||||||||||||||||||||||
| 5296 | QDomCommentPrivate::QDomCommentPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& val) | - | ||||||||||||||||||||||||
| 5297 | : QDomCharacterDataPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5298 | { | - | ||||||||||||||||||||||||
| 5299 | name = QLatin1String("#comment"); | - | ||||||||||||||||||||||||
| 5300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5301 | - | |||||||||||||||||||||||||
| 5302 | QDomCommentPrivate::QDomCommentPrivate(QDomCommentPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5303 | : QDomCharacterDataPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5304 | { | - | ||||||||||||||||||||||||
| 5305 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5306 | - | |||||||||||||||||||||||||
| 5307 | - | |||||||||||||||||||||||||
| 5308 | QDomNodePrivate* QDomCommentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5309 | { | - | ||||||||||||||||||||||||
| 5310 | QDomNodePrivate* p = new QDomCommentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5311 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5312 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5313 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5314 | } | - | ||||||||||||||||||||||||
| 5315 | - | |||||||||||||||||||||||||
| 5316 | void QDomCommentPrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 5317 | { | - | ||||||||||||||||||||||||
| 5318 | /* We don't output whitespace if we would pollute a text node. */ | - | ||||||||||||||||||||||||
| 5319 | if (!(prev && prev->isText()))
| 0 | ||||||||||||||||||||||||
| 5320 | s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); never executed: s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); | 0 | ||||||||||||||||||||||||
| 5321 | - | |||||||||||||||||||||||||
| 5322 | s << "<!--" << value; | - | ||||||||||||||||||||||||
| 5323 | if (value.endsWith(QLatin1Char('-')))
| 0 | ||||||||||||||||||||||||
| 5324 | s << ' '; // Ensures that XML comment doesn't end with ---> never executed: s << ' '; | 0 | ||||||||||||||||||||||||
| 5325 | s << "-->"; | - | ||||||||||||||||||||||||
| 5326 | - | |||||||||||||||||||||||||
| 5327 | if (!(next && next->isText()))
| 0 | ||||||||||||||||||||||||
| 5328 | s << endl; never executed: s << endl; | 0 | ||||||||||||||||||||||||
| 5329 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5330 | - | |||||||||||||||||||||||||
| 5331 | /************************************************************** | - | ||||||||||||||||||||||||
| 5332 | * | - | ||||||||||||||||||||||||
| 5333 | * QDomComment | - | ||||||||||||||||||||||||
| 5334 | * | - | ||||||||||||||||||||||||
| 5335 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5336 | - | |||||||||||||||||||||||||
| 5337 | /*! | - | ||||||||||||||||||||||||
| 5338 | \class QDomComment | - | ||||||||||||||||||||||||
| 5339 | \reentrant | - | ||||||||||||||||||||||||
| 5340 | \brief The QDomComment class represents an XML comment. | - | ||||||||||||||||||||||||
| 5341 | - | |||||||||||||||||||||||||
| 5342 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5343 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5344 | - | |||||||||||||||||||||||||
| 5345 | A comment in the parsed XML such as this: | - | ||||||||||||||||||||||||
| 5346 | - | |||||||||||||||||||||||||
| 5347 | \snippet code/src_xml_dom_qdom.cpp 15 | - | ||||||||||||||||||||||||
| 5348 | - | |||||||||||||||||||||||||
| 5349 | is represented by QDomComment objects in the parsed Dom tree. | - | ||||||||||||||||||||||||
| 5350 | - | |||||||||||||||||||||||||
| 5351 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5352 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 5353 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5354 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5355 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5356 | */ | - | ||||||||||||||||||||||||
| 5357 | - | |||||||||||||||||||||||||
| 5358 | /*! | - | ||||||||||||||||||||||||
| 5359 | Constructs an empty comment. To construct a comment with content, | - | ||||||||||||||||||||||||
| 5360 | use the QDomDocument::createComment() function. | - | ||||||||||||||||||||||||
| 5361 | */ | - | ||||||||||||||||||||||||
| 5362 | QDomComment::QDomComment() | - | ||||||||||||||||||||||||
| 5363 | : QDomCharacterData() | - | ||||||||||||||||||||||||
| 5364 | { | - | ||||||||||||||||||||||||
| 5365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5366 | - | |||||||||||||||||||||||||
| 5367 | /*! | - | ||||||||||||||||||||||||
| 5368 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5369 | - | |||||||||||||||||||||||||
| 5370 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5371 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5372 | cloneNode(). | - | ||||||||||||||||||||||||
| 5373 | */ | - | ||||||||||||||||||||||||
| 5374 | QDomComment::QDomComment(const QDomComment& x) | - | ||||||||||||||||||||||||
| 5375 | : QDomCharacterData(x) | - | ||||||||||||||||||||||||
| 5376 | { | - | ||||||||||||||||||||||||
| 5377 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5378 | - | |||||||||||||||||||||||||
| 5379 | QDomComment::QDomComment(QDomCommentPrivate* n) | - | ||||||||||||||||||||||||
| 5380 | : QDomCharacterData(n) | - | ||||||||||||||||||||||||
| 5381 | { | - | ||||||||||||||||||||||||
| 5382 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5383 | - | |||||||||||||||||||||||||
| 5384 | /*! | - | ||||||||||||||||||||||||
| 5385 | Assigns \a x to this DOM comment. | - | ||||||||||||||||||||||||
| 5386 | - | |||||||||||||||||||||||||
| 5387 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5388 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5389 | cloneNode(). | - | ||||||||||||||||||||||||
| 5390 | */ | - | ||||||||||||||||||||||||
| 5391 | QDomComment& QDomComment::operator= (const QDomComment& x) | - | ||||||||||||||||||||||||
| 5392 | { | - | ||||||||||||||||||||||||
| 5393 | return (QDomComment&) QDomNode::operator=(x); never executed: return (QDomComment&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5394 | } | - | ||||||||||||||||||||||||
| 5395 | - | |||||||||||||||||||||||||
| 5396 | /*! | - | ||||||||||||||||||||||||
| 5397 | \fn QDomNode::NodeType QDomComment::nodeType() const | - | ||||||||||||||||||||||||
| 5398 | - | |||||||||||||||||||||||||
| 5399 | Returns \c CommentNode. | - | ||||||||||||||||||||||||
| 5400 | */ | - | ||||||||||||||||||||||||
| 5401 | - | |||||||||||||||||||||||||
| 5402 | /************************************************************** | - | ||||||||||||||||||||||||
| 5403 | * | - | ||||||||||||||||||||||||
| 5404 | * QDomCDATASectionPrivate | - | ||||||||||||||||||||||||
| 5405 | * | - | ||||||||||||||||||||||||
| 5406 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5407 | - | |||||||||||||||||||||||||
| 5408 | QDomCDATASectionPrivate::QDomCDATASectionPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5409 | const QString& val) | - | ||||||||||||||||||||||||
| 5410 | : QDomTextPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5411 | { | - | ||||||||||||||||||||||||
| 5412 | name = QLatin1String("#cdata-section"); | - | ||||||||||||||||||||||||
| 5413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5414 | - | |||||||||||||||||||||||||
| 5415 | QDomCDATASectionPrivate::QDomCDATASectionPrivate(QDomCDATASectionPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5416 | : QDomTextPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5417 | { | - | ||||||||||||||||||||||||
| 5418 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5419 | - | |||||||||||||||||||||||||
| 5420 | QDomNodePrivate* QDomCDATASectionPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5421 | { | - | ||||||||||||||||||||||||
| 5422 | QDomNodePrivate* p = new QDomCDATASectionPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5423 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5424 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5425 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5426 | } | - | ||||||||||||||||||||||||
| 5427 | - | |||||||||||||||||||||||||
| 5428 | void QDomCDATASectionPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5429 | { | - | ||||||||||||||||||||||||
| 5430 | // ### How do we escape "]]>" ? | - | ||||||||||||||||||||||||
| 5431 | // "]]>" is not allowed; so there should be none in value anyway | - | ||||||||||||||||||||||||
| 5432 | s << "<![CDATA[" << value << "]]>"; | - | ||||||||||||||||||||||||
| 5433 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5434 | - | |||||||||||||||||||||||||
| 5435 | /************************************************************** | - | ||||||||||||||||||||||||
| 5436 | * | - | ||||||||||||||||||||||||
| 5437 | * QDomCDATASection | - | ||||||||||||||||||||||||
| 5438 | * | - | ||||||||||||||||||||||||
| 5439 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5440 | - | |||||||||||||||||||||||||
| 5441 | /*! | - | ||||||||||||||||||||||||
| 5442 | \class QDomCDATASection | - | ||||||||||||||||||||||||
| 5443 | \reentrant | - | ||||||||||||||||||||||||
| 5444 | \brief The QDomCDATASection class represents an XML CDATA section. | - | ||||||||||||||||||||||||
| 5445 | - | |||||||||||||||||||||||||
| 5446 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5447 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5448 | - | |||||||||||||||||||||||||
| 5449 | CDATA sections are used to escape blocks of text containing | - | ||||||||||||||||||||||||
| 5450 | characters that would otherwise be regarded as markup. The only | - | ||||||||||||||||||||||||
| 5451 | delimiter that is recognized in a CDATA section is the "]]>" | - | ||||||||||||||||||||||||
| 5452 | string that terminates the CDATA section. CDATA sections cannot be | - | ||||||||||||||||||||||||
| 5453 | nested. Their primary purpose is for including material such as | - | ||||||||||||||||||||||||
| 5454 | XML fragments, without needing to escape all the delimiters. | - | ||||||||||||||||||||||||
| 5455 | - | |||||||||||||||||||||||||
| 5456 | Adjacent QDomCDATASection nodes are not merged by the | - | ||||||||||||||||||||||||
| 5457 | QDomNode::normalize() function. | - | ||||||||||||||||||||||||
| 5458 | - | |||||||||||||||||||||||||
| 5459 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5460 | \l{http://www.w3.org/TR/REC-DOM-Level-1/} and | - | ||||||||||||||||||||||||
| 5461 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}. | - | ||||||||||||||||||||||||
| 5462 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5463 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5464 | */ | - | ||||||||||||||||||||||||
| 5465 | - | |||||||||||||||||||||||||
| 5466 | /*! | - | ||||||||||||||||||||||||
| 5467 | Constructs an empty CDATA section. To create a CDATA section with | - | ||||||||||||||||||||||||
| 5468 | content, use the QDomDocument::createCDATASection() function. | - | ||||||||||||||||||||||||
| 5469 | */ | - | ||||||||||||||||||||||||
| 5470 | QDomCDATASection::QDomCDATASection() | - | ||||||||||||||||||||||||
| 5471 | : QDomText() | - | ||||||||||||||||||||||||
| 5472 | { | - | ||||||||||||||||||||||||
| 5473 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5474 | - | |||||||||||||||||||||||||
| 5475 | /*! | - | ||||||||||||||||||||||||
| 5476 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5477 | - | |||||||||||||||||||||||||
| 5478 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5479 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5480 | cloneNode(). | - | ||||||||||||||||||||||||
| 5481 | */ | - | ||||||||||||||||||||||||
| 5482 | QDomCDATASection::QDomCDATASection(const QDomCDATASection& x) | - | ||||||||||||||||||||||||
| 5483 | : QDomText(x) | - | ||||||||||||||||||||||||
| 5484 | { | - | ||||||||||||||||||||||||
| 5485 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5486 | - | |||||||||||||||||||||||||
| 5487 | QDomCDATASection::QDomCDATASection(QDomCDATASectionPrivate* n) | - | ||||||||||||||||||||||||
| 5488 | : QDomText(n) | - | ||||||||||||||||||||||||
| 5489 | { | - | ||||||||||||||||||||||||
| 5490 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5491 | - | |||||||||||||||||||||||||
| 5492 | /*! | - | ||||||||||||||||||||||||
| 5493 | Assigns \a x to this CDATA section. | - | ||||||||||||||||||||||||
| 5494 | - | |||||||||||||||||||||||||
| 5495 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5496 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5497 | cloneNode(). | - | ||||||||||||||||||||||||
| 5498 | */ | - | ||||||||||||||||||||||||
| 5499 | QDomCDATASection& QDomCDATASection::operator= (const QDomCDATASection& x) | - | ||||||||||||||||||||||||
| 5500 | { | - | ||||||||||||||||||||||||
| 5501 | return (QDomCDATASection&) QDomNode::operator=(x); never executed: return (QDomCDATASection&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5502 | } | - | ||||||||||||||||||||||||
| 5503 | - | |||||||||||||||||||||||||
| 5504 | /*! | - | ||||||||||||||||||||||||
| 5505 | \fn QDomNode::NodeType QDomCDATASection::nodeType() const | - | ||||||||||||||||||||||||
| 5506 | - | |||||||||||||||||||||||||
| 5507 | Returns \c CDATASection. | - | ||||||||||||||||||||||||
| 5508 | */ | - | ||||||||||||||||||||||||
| 5509 | - | |||||||||||||||||||||||||
| 5510 | /************************************************************** | - | ||||||||||||||||||||||||
| 5511 | * | - | ||||||||||||||||||||||||
| 5512 | * QDomNotationPrivate | - | ||||||||||||||||||||||||
| 5513 | * | - | ||||||||||||||||||||||||
| 5514 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5515 | - | |||||||||||||||||||||||||
| 5516 | QDomNotationPrivate::QDomNotationPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5517 | const QString& aname, | - | ||||||||||||||||||||||||
| 5518 | const QString& pub, const QString& sys) | - | ||||||||||||||||||||||||
| 5519 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5520 | { | - | ||||||||||||||||||||||||
| 5521 | name = aname; | - | ||||||||||||||||||||||||
| 5522 | m_pub = pub; | - | ||||||||||||||||||||||||
| 5523 | m_sys = sys; | - | ||||||||||||||||||||||||
| 5524 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5525 | - | |||||||||||||||||||||||||
| 5526 | QDomNotationPrivate::QDomNotationPrivate(QDomNotationPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5527 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5528 | { | - | ||||||||||||||||||||||||
| 5529 | m_sys = n->m_sys; | - | ||||||||||||||||||||||||
| 5530 | m_pub = n->m_pub; | - | ||||||||||||||||||||||||
| 5531 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5532 | - | |||||||||||||||||||||||||
| 5533 | QDomNodePrivate* QDomNotationPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5534 | { | - | ||||||||||||||||||||||||
| 5535 | QDomNodePrivate* p = new QDomNotationPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5536 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5537 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5538 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5539 | } | - | ||||||||||||||||||||||||
| 5540 | - | |||||||||||||||||||||||||
| 5541 | void QDomNotationPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5542 | { | - | ||||||||||||||||||||||||
| 5543 | s << "<!NOTATION " << name << ' '; | - | ||||||||||||||||||||||||
| 5544 | if (!m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5545 | s << "PUBLIC " << quotedValue(m_pub); | - | ||||||||||||||||||||||||
| 5546 | if (!m_sys.isNull())
| 0 | ||||||||||||||||||||||||
| 5547 | s << ' ' << quotedValue(m_sys); never executed: s << ' ' << quotedValue(m_sys); | 0 | ||||||||||||||||||||||||
| 5548 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5549 | s << "SYSTEM " << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5550 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5551 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 5552 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5553 | - | |||||||||||||||||||||||||
| 5554 | /************************************************************** | - | ||||||||||||||||||||||||
| 5555 | * | - | ||||||||||||||||||||||||
| 5556 | * QDomNotation | - | ||||||||||||||||||||||||
| 5557 | * | - | ||||||||||||||||||||||||
| 5558 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5559 | - | |||||||||||||||||||||||||
| 5560 | #define IMPL ((QDomNotationPrivate*)impl) | - | ||||||||||||||||||||||||
| 5561 | - | |||||||||||||||||||||||||
| 5562 | /*! | - | ||||||||||||||||||||||||
| 5563 | \class QDomNotation | - | ||||||||||||||||||||||||
| 5564 | \reentrant | - | ||||||||||||||||||||||||
| 5565 | \brief The QDomNotation class represents an XML notation. | - | ||||||||||||||||||||||||
| 5566 | - | |||||||||||||||||||||||||
| 5567 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5568 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5569 | - | |||||||||||||||||||||||||
| 5570 | A notation either declares, by name, the format of an unparsed | - | ||||||||||||||||||||||||
| 5571 | entity (see section 4.7 of the XML 1.0 specification), or is used | - | ||||||||||||||||||||||||
| 5572 | for formal declaration of processing instruction targets (see | - | ||||||||||||||||||||||||
| 5573 | section 2.6 of the XML 1.0 specification). | - | ||||||||||||||||||||||||
| 5574 | - | |||||||||||||||||||||||||
| 5575 | DOM does not support editing notation nodes; they are therefore | - | ||||||||||||||||||||||||
| 5576 | read-only. | - | ||||||||||||||||||||||||
| 5577 | - | |||||||||||||||||||||||||
| 5578 | A notation node does not have any parent. | - | ||||||||||||||||||||||||
| 5579 | - | |||||||||||||||||||||||||
| 5580 | You can retrieve the publicId() and systemId() from a notation | - | ||||||||||||||||||||||||
| 5581 | node. | - | ||||||||||||||||||||||||
| 5582 | - | |||||||||||||||||||||||||
| 5583 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5584 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5585 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5586 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5587 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5588 | */ | - | ||||||||||||||||||||||||
| 5589 | - | |||||||||||||||||||||||||
| 5590 | - | |||||||||||||||||||||||||
| 5591 | /*! | - | ||||||||||||||||||||||||
| 5592 | Constructor. | - | ||||||||||||||||||||||||
| 5593 | */ | - | ||||||||||||||||||||||||
| 5594 | QDomNotation::QDomNotation() | - | ||||||||||||||||||||||||
| 5595 | : QDomNode() | - | ||||||||||||||||||||||||
| 5596 | { | - | ||||||||||||||||||||||||
| 5597 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5598 | - | |||||||||||||||||||||||||
| 5599 | /*! | - | ||||||||||||||||||||||||
| 5600 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5601 | - | |||||||||||||||||||||||||
| 5602 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5603 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5604 | cloneNode(). | - | ||||||||||||||||||||||||
| 5605 | */ | - | ||||||||||||||||||||||||
| 5606 | QDomNotation::QDomNotation(const QDomNotation& x) | - | ||||||||||||||||||||||||
| 5607 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5608 | { | - | ||||||||||||||||||||||||
| 5609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5610 | - | |||||||||||||||||||||||||
| 5611 | QDomNotation::QDomNotation(QDomNotationPrivate* n) | - | ||||||||||||||||||||||||
| 5612 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5613 | { | - | ||||||||||||||||||||||||
| 5614 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5615 | - | |||||||||||||||||||||||||
| 5616 | /*! | - | ||||||||||||||||||||||||
| 5617 | Assigns \a x to this DOM notation. | - | ||||||||||||||||||||||||
| 5618 | - | |||||||||||||||||||||||||
| 5619 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5620 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5621 | cloneNode(). | - | ||||||||||||||||||||||||
| 5622 | */ | - | ||||||||||||||||||||||||
| 5623 | QDomNotation& QDomNotation::operator= (const QDomNotation& x) | - | ||||||||||||||||||||||||
| 5624 | { | - | ||||||||||||||||||||||||
| 5625 | return (QDomNotation&) QDomNode::operator=(x); never executed: return (QDomNotation&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5626 | } | - | ||||||||||||||||||||||||
| 5627 | - | |||||||||||||||||||||||||
| 5628 | /*! | - | ||||||||||||||||||||||||
| 5629 | \fn QDomNode::NodeType QDomNotation::nodeType() const | - | ||||||||||||||||||||||||
| 5630 | - | |||||||||||||||||||||||||
| 5631 | Returns \c NotationNode. | - | ||||||||||||||||||||||||
| 5632 | */ | - | ||||||||||||||||||||||||
| 5633 | - | |||||||||||||||||||||||||
| 5634 | /*! | - | ||||||||||||||||||||||||
| 5635 | Returns the public identifier of this notation. | - | ||||||||||||||||||||||||
| 5636 | */ | - | ||||||||||||||||||||||||
| 5637 | QString QDomNotation::publicId() const | - | ||||||||||||||||||||||||
| 5638 | { | - | ||||||||||||||||||||||||
| 5639 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5640 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5641 | return IMPL->m_pub; never executed: return ((QDomNotationPrivate*)impl)->m_pub; | 0 | ||||||||||||||||||||||||
| 5642 | } | - | ||||||||||||||||||||||||
| 5643 | - | |||||||||||||||||||||||||
| 5644 | /*! | - | ||||||||||||||||||||||||
| 5645 | Returns the system identifier of this notation. | - | ||||||||||||||||||||||||
| 5646 | */ | - | ||||||||||||||||||||||||
| 5647 | QString QDomNotation::systemId() const | - | ||||||||||||||||||||||||
| 5648 | { | - | ||||||||||||||||||||||||
| 5649 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5650 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5651 | return IMPL->m_sys; never executed: return ((QDomNotationPrivate*)impl)->m_sys; | 0 | ||||||||||||||||||||||||
| 5652 | } | - | ||||||||||||||||||||||||
| 5653 | - | |||||||||||||||||||||||||
| 5654 | #undef IMPL | - | ||||||||||||||||||||||||
| 5655 | - | |||||||||||||||||||||||||
| 5656 | /************************************************************** | - | ||||||||||||||||||||||||
| 5657 | * | - | ||||||||||||||||||||||||
| 5658 | * QDomEntityPrivate | - | ||||||||||||||||||||||||
| 5659 | * | - | ||||||||||||||||||||||||
| 5660 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5661 | - | |||||||||||||||||||||||||
| 5662 | QDomEntityPrivate::QDomEntityPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5663 | const QString& aname, | - | ||||||||||||||||||||||||
| 5664 | const QString& pub, const QString& sys, const QString& notation) | - | ||||||||||||||||||||||||
| 5665 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5666 | { | - | ||||||||||||||||||||||||
| 5667 | name = aname; | - | ||||||||||||||||||||||||
| 5668 | m_pub = pub; | - | ||||||||||||||||||||||||
| 5669 | m_sys = sys; | - | ||||||||||||||||||||||||
| 5670 | m_notationName = notation; | - | ||||||||||||||||||||||||
| 5671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5672 | - | |||||||||||||||||||||||||
| 5673 | QDomEntityPrivate::QDomEntityPrivate(QDomEntityPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5674 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5675 | { | - | ||||||||||||||||||||||||
| 5676 | m_sys = n->m_sys; | - | ||||||||||||||||||||||||
| 5677 | m_pub = n->m_pub; | - | ||||||||||||||||||||||||
| 5678 | m_notationName = n->m_notationName; | - | ||||||||||||||||||||||||
| 5679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5680 | - | |||||||||||||||||||||||||
| 5681 | QDomNodePrivate* QDomEntityPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5682 | { | - | ||||||||||||||||||||||||
| 5683 | QDomNodePrivate* p = new QDomEntityPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5684 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5685 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5686 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5687 | } | - | ||||||||||||||||||||||||
| 5688 | - | |||||||||||||||||||||||||
| 5689 | /* | - | ||||||||||||||||||||||||
| 5690 | Encode an entity value upon saving. | - | ||||||||||||||||||||||||
| 5691 | */ | - | ||||||||||||||||||||||||
| 5692 | static QByteArray encodeEntity(const QByteArray& str) | - | ||||||||||||||||||||||||
| 5693 | { | - | ||||||||||||||||||||||||
| 5694 | QByteArray tmp(str); | - | ||||||||||||||||||||||||
| 5695 | int len = tmp.size(); | - | ||||||||||||||||||||||||
| 5696 | int i = 0; | - | ||||||||||||||||||||||||
| 5697 | const char* d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5698 | while (i < len) {
| 0 | ||||||||||||||||||||||||
| 5699 | if (d[i] == '%'){
| 0 | ||||||||||||||||||||||||
| 5700 | tmp.replace(i, 1, "<"); | - | ||||||||||||||||||||||||
| 5701 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5702 | len += 4; | - | ||||||||||||||||||||||||
| 5703 | i += 5; | - | ||||||||||||||||||||||||
| 5704 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5705 | else if (d[i] == '"') {
| 0 | ||||||||||||||||||||||||
| 5706 | tmp.replace(i, 1, """); | - | ||||||||||||||||||||||||
| 5707 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5708 | len += 4; | - | ||||||||||||||||||||||||
| 5709 | i += 5; | - | ||||||||||||||||||||||||
| 5710 | } else if (d[i] == '&' && i + 1 < len && d[i+1] == '#') { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 5711 | // Don't encode < or " or &custom;. | - | ||||||||||||||||||||||||
| 5712 | // Only encode character references | - | ||||||||||||||||||||||||
| 5713 | tmp.replace(i, 1, "&"); | - | ||||||||||||||||||||||||
| 5714 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5715 | len += 4; | - | ||||||||||||||||||||||||
| 5716 | i += 5; | - | ||||||||||||||||||||||||
| 5717 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5718 | ++i; | - | ||||||||||||||||||||||||
| 5719 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5720 | } | - | ||||||||||||||||||||||||
| 5721 | - | |||||||||||||||||||||||||
| 5722 | return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||
| 5723 | } | - | ||||||||||||||||||||||||
| 5724 | - | |||||||||||||||||||||||||
| 5725 | void QDomEntityPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5726 | { | - | ||||||||||||||||||||||||
| 5727 | QString _name = name; | - | ||||||||||||||||||||||||
| 5728 | if (_name.startsWith(QLatin1Char('%')))
| 0 | ||||||||||||||||||||||||
| 5729 | _name = QLatin1String("% ") + _name.mid(1); never executed: _name = QLatin1String("% ") + _name.mid(1); | 0 | ||||||||||||||||||||||||
| 5730 | - | |||||||||||||||||||||||||
| 5731 | if (m_sys.isNull() && m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5732 | s << "<!ENTITY " << _name << " \"" << encodeEntity(value.toUtf8()) << "\">" << endl; | - | ||||||||||||||||||||||||
| 5733 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5734 | s << "<!ENTITY " << _name << ' '; | - | ||||||||||||||||||||||||
| 5735 | if (m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5736 | s << "SYSTEM " << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5737 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5738 | s << "PUBLIC " << quotedValue(m_pub) << ' ' << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5739 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5740 | if (! m_notationName.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5741 | s << " NDATA " << m_notationName; | - | ||||||||||||||||||||||||
| 5742 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5743 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 5744 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5745 | } | - | ||||||||||||||||||||||||
| 5746 | - | |||||||||||||||||||||||||
| 5747 | /************************************************************** | - | ||||||||||||||||||||||||
| 5748 | * | - | ||||||||||||||||||||||||
| 5749 | * QDomEntity | - | ||||||||||||||||||||||||
| 5750 | * | - | ||||||||||||||||||||||||
| 5751 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5752 | - | |||||||||||||||||||||||||
| 5753 | #define IMPL ((QDomEntityPrivate*)impl) | - | ||||||||||||||||||||||||
| 5754 | - | |||||||||||||||||||||||||
| 5755 | /*! | - | ||||||||||||||||||||||||
| 5756 | \class QDomEntity | - | ||||||||||||||||||||||||
| 5757 | \reentrant | - | ||||||||||||||||||||||||
| 5758 | \brief The QDomEntity class represents an XML entity. | - | ||||||||||||||||||||||||
| 5759 | - | |||||||||||||||||||||||||
| 5760 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5761 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5762 | - | |||||||||||||||||||||||||
| 5763 | This class represents an entity in an XML document, either parsed | - | ||||||||||||||||||||||||
| 5764 | or unparsed. Note that this models the entity itself not the | - | ||||||||||||||||||||||||
| 5765 | entity declaration. | - | ||||||||||||||||||||||||
| 5766 | - | |||||||||||||||||||||||||
| 5767 | DOM does not support editing entity nodes; if a user wants to make | - | ||||||||||||||||||||||||
| 5768 | changes to the contents of an entity, every related | - | ||||||||||||||||||||||||
| 5769 | QDomEntityReference node must be replaced in the DOM tree by a | - | ||||||||||||||||||||||||
| 5770 | clone of the entity's contents, and then the desired changes must | - | ||||||||||||||||||||||||
| 5771 | be made to each of the clones instead. All the descendants of an | - | ||||||||||||||||||||||||
| 5772 | entity node are read-only. | - | ||||||||||||||||||||||||
| 5773 | - | |||||||||||||||||||||||||
| 5774 | An entity node does not have any parent. | - | ||||||||||||||||||||||||
| 5775 | - | |||||||||||||||||||||||||
| 5776 | You can access the entity's publicId(), systemId() and | - | ||||||||||||||||||||||||
| 5777 | notationName() when available. | - | ||||||||||||||||||||||||
| 5778 | - | |||||||||||||||||||||||||
| 5779 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5780 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5781 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5782 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5783 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5784 | */ | - | ||||||||||||||||||||||||
| 5785 | - | |||||||||||||||||||||||||
| 5786 | - | |||||||||||||||||||||||||
| 5787 | /*! | - | ||||||||||||||||||||||||
| 5788 | Constructs an empty entity. | - | ||||||||||||||||||||||||
| 5789 | */ | - | ||||||||||||||||||||||||
| 5790 | QDomEntity::QDomEntity() | - | ||||||||||||||||||||||||
| 5791 | : QDomNode() | - | ||||||||||||||||||||||||
| 5792 | { | - | ||||||||||||||||||||||||
| 5793 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5794 | - | |||||||||||||||||||||||||
| 5795 | - | |||||||||||||||||||||||||
| 5796 | /*! | - | ||||||||||||||||||||||||
| 5797 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5798 | - | |||||||||||||||||||||||||
| 5799 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5800 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5801 | cloneNode(). | - | ||||||||||||||||||||||||
| 5802 | */ | - | ||||||||||||||||||||||||
| 5803 | QDomEntity::QDomEntity(const QDomEntity& x) | - | ||||||||||||||||||||||||
| 5804 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5805 | { | - | ||||||||||||||||||||||||
| 5806 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5807 | - | |||||||||||||||||||||||||
| 5808 | QDomEntity::QDomEntity(QDomEntityPrivate* n) | - | ||||||||||||||||||||||||
| 5809 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5810 | { | - | ||||||||||||||||||||||||
| 5811 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5812 | - | |||||||||||||||||||||||||
| 5813 | /*! | - | ||||||||||||||||||||||||
| 5814 | Assigns \a x to this DOM entity. | - | ||||||||||||||||||||||||
| 5815 | - | |||||||||||||||||||||||||
| 5816 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5817 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5818 | cloneNode(). | - | ||||||||||||||||||||||||
| 5819 | */ | - | ||||||||||||||||||||||||
| 5820 | QDomEntity& QDomEntity::operator= (const QDomEntity& x) | - | ||||||||||||||||||||||||
| 5821 | { | - | ||||||||||||||||||||||||
| 5822 | return (QDomEntity&) QDomNode::operator=(x); never executed: return (QDomEntity&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5823 | } | - | ||||||||||||||||||||||||
| 5824 | - | |||||||||||||||||||||||||
| 5825 | /*! | - | ||||||||||||||||||||||||
| 5826 | \fn QDomNode::NodeType QDomEntity::nodeType() const | - | ||||||||||||||||||||||||
| 5827 | - | |||||||||||||||||||||||||
| 5828 | Returns \c EntityNode. | - | ||||||||||||||||||||||||
| 5829 | */ | - | ||||||||||||||||||||||||
| 5830 | - | |||||||||||||||||||||||||
| 5831 | /*! | - | ||||||||||||||||||||||||
| 5832 | Returns the public identifier associated with this entity. If the | - | ||||||||||||||||||||||||
| 5833 | public identifier was not specified an empty string is returned. | - | ||||||||||||||||||||||||
| 5834 | */ | - | ||||||||||||||||||||||||
| 5835 | QString QDomEntity::publicId() const | - | ||||||||||||||||||||||||
| 5836 | { | - | ||||||||||||||||||||||||
| 5837 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5838 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5839 | return IMPL->m_pub; never executed: return ((QDomEntityPrivate*)impl)->m_pub; | 0 | ||||||||||||||||||||||||
| 5840 | } | - | ||||||||||||||||||||||||
| 5841 | - | |||||||||||||||||||||||||
| 5842 | /*! | - | ||||||||||||||||||||||||
| 5843 | Returns the system identifier associated with this entity. If the | - | ||||||||||||||||||||||||
| 5844 | system identifier was not specified an empty string is returned. | - | ||||||||||||||||||||||||
| 5845 | */ | - | ||||||||||||||||||||||||
| 5846 | QString QDomEntity::systemId() const | - | ||||||||||||||||||||||||
| 5847 | { | - | ||||||||||||||||||||||||
| 5848 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5849 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5850 | return IMPL->m_sys; never executed: return ((QDomEntityPrivate*)impl)->m_sys; | 0 | ||||||||||||||||||||||||
| 5851 | } | - | ||||||||||||||||||||||||
| 5852 | - | |||||||||||||||||||||||||
| 5853 | /*! | - | ||||||||||||||||||||||||
| 5854 | For unparsed entities this function returns the name of the | - | ||||||||||||||||||||||||
| 5855 | notation for the entity. For parsed entities this function returns | - | ||||||||||||||||||||||||
| 5856 | an empty string. | - | ||||||||||||||||||||||||
| 5857 | */ | - | ||||||||||||||||||||||||
| 5858 | QString QDomEntity::notationName() const | - | ||||||||||||||||||||||||
| 5859 | { | - | ||||||||||||||||||||||||
| 5860 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5861 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5862 | return IMPL->m_notationName; never executed: return ((QDomEntityPrivate*)impl)->m_notationName; | 0 | ||||||||||||||||||||||||
| 5863 | } | - | ||||||||||||||||||||||||
| 5864 | - | |||||||||||||||||||||||||
| 5865 | #undef IMPL | - | ||||||||||||||||||||||||
| 5866 | - | |||||||||||||||||||||||||
| 5867 | /************************************************************** | - | ||||||||||||||||||||||||
| 5868 | * | - | ||||||||||||||||||||||||
| 5869 | * QDomEntityReferencePrivate | - | ||||||||||||||||||||||||
| 5870 | * | - | ||||||||||||||||||||||||
| 5871 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5872 | - | |||||||||||||||||||||||||
| 5873 | QDomEntityReferencePrivate::QDomEntityReferencePrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& aname) | - | ||||||||||||||||||||||||
| 5874 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5875 | { | - | ||||||||||||||||||||||||
| 5876 | name = aname; | - | ||||||||||||||||||||||||
| 5877 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5878 | - | |||||||||||||||||||||||||
| 5879 | QDomEntityReferencePrivate::QDomEntityReferencePrivate(QDomNodePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5880 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5881 | { | - | ||||||||||||||||||||||||
| 5882 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5883 | - | |||||||||||||||||||||||||
| 5884 | QDomNodePrivate* QDomEntityReferencePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5885 | { | - | ||||||||||||||||||||||||
| 5886 | QDomNodePrivate* p = new QDomEntityReferencePrivate(this, deep); | - | ||||||||||||||||||||||||
| 5887 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5888 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5889 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5890 | } | - | ||||||||||||||||||||||||
| 5891 | - | |||||||||||||||||||||||||
| 5892 | void QDomEntityReferencePrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5893 | { | - | ||||||||||||||||||||||||
| 5894 | s << '&' << name << ';'; | - | ||||||||||||||||||||||||
| 5895 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5896 | - | |||||||||||||||||||||||||
| 5897 | /************************************************************** | - | ||||||||||||||||||||||||
| 5898 | * | - | ||||||||||||||||||||||||
| 5899 | * QDomEntityReference | - | ||||||||||||||||||||||||
| 5900 | * | - | ||||||||||||||||||||||||
| 5901 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5902 | - | |||||||||||||||||||||||||
| 5903 | /*! | - | ||||||||||||||||||||||||
| 5904 | \class QDomEntityReference | - | ||||||||||||||||||||||||
| 5905 | \reentrant | - | ||||||||||||||||||||||||
| 5906 | \brief The QDomEntityReference class represents an XML entity reference. | - | ||||||||||||||||||||||||
| 5907 | - | |||||||||||||||||||||||||
| 5908 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5909 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5910 | - | |||||||||||||||||||||||||
| 5911 | A QDomEntityReference object may be inserted into the DOM tree | - | ||||||||||||||||||||||||
| 5912 | when an entity reference is in the source document, or when the | - | ||||||||||||||||||||||||
| 5913 | user wishes to insert an entity reference. | - | ||||||||||||||||||||||||
| 5914 | - | |||||||||||||||||||||||||
| 5915 | Note that character references and references to predefined | - | ||||||||||||||||||||||||
| 5916 | entities are expanded by the XML processor so that characters are | - | ||||||||||||||||||||||||
| 5917 | represented by their Unicode equivalent rather than by an entity | - | ||||||||||||||||||||||||
| 5918 | reference. | - | ||||||||||||||||||||||||
| 5919 | - | |||||||||||||||||||||||||
| 5920 | Moreover, the XML processor may completely expand references to | - | ||||||||||||||||||||||||
| 5921 | entities while building the DOM tree, instead of providing | - | ||||||||||||||||||||||||
| 5922 | QDomEntityReference objects. | - | ||||||||||||||||||||||||
| 5923 | - | |||||||||||||||||||||||||
| 5924 | If it does provide such objects, then for a given entity reference | - | ||||||||||||||||||||||||
| 5925 | node, it may be that there is no entity node representing the | - | ||||||||||||||||||||||||
| 5926 | referenced entity; but if such an entity exists, then the child | - | ||||||||||||||||||||||||
| 5927 | list of the entity reference node is the same as that of the | - | ||||||||||||||||||||||||
| 5928 | entity node. As with the entity node, all descendants of the | - | ||||||||||||||||||||||||
| 5929 | entity reference are read-only. | - | ||||||||||||||||||||||||
| 5930 | - | |||||||||||||||||||||||||
| 5931 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5932 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5933 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5934 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5935 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5936 | */ | - | ||||||||||||||||||||||||
| 5937 | - | |||||||||||||||||||||||||
| 5938 | /*! | - | ||||||||||||||||||||||||
| 5939 | Constructs an empty entity reference. Use | - | ||||||||||||||||||||||||
| 5940 | QDomDocument::createEntityReference() to create a entity reference | - | ||||||||||||||||||||||||
| 5941 | with content. | - | ||||||||||||||||||||||||
| 5942 | */ | - | ||||||||||||||||||||||||
| 5943 | QDomEntityReference::QDomEntityReference() | - | ||||||||||||||||||||||||
| 5944 | : QDomNode() | - | ||||||||||||||||||||||||
| 5945 | { | - | ||||||||||||||||||||||||
| 5946 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5947 | - | |||||||||||||||||||||||||
| 5948 | /*! | - | ||||||||||||||||||||||||
| 5949 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5950 | - | |||||||||||||||||||||||||
| 5951 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5952 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5953 | cloneNode(). | - | ||||||||||||||||||||||||
| 5954 | */ | - | ||||||||||||||||||||||||
| 5955 | QDomEntityReference::QDomEntityReference(const QDomEntityReference& x) | - | ||||||||||||||||||||||||
| 5956 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5957 | { | - | ||||||||||||||||||||||||
| 5958 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5959 | - | |||||||||||||||||||||||||
| 5960 | QDomEntityReference::QDomEntityReference(QDomEntityReferencePrivate* n) | - | ||||||||||||||||||||||||
| 5961 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5962 | { | - | ||||||||||||||||||||||||
| 5963 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5964 | - | |||||||||||||||||||||||||
| 5965 | /*! | - | ||||||||||||||||||||||||
| 5966 | Assigns \a x to this entity reference. | - | ||||||||||||||||||||||||
| 5967 | - | |||||||||||||||||||||||||
| 5968 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5969 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5970 | cloneNode(). | - | ||||||||||||||||||||||||
| 5971 | */ | - | ||||||||||||||||||||||||
| 5972 | QDomEntityReference& QDomEntityReference::operator= (const QDomEntityReference& x) | - | ||||||||||||||||||||||||
| 5973 | { | - | ||||||||||||||||||||||||
| 5974 | return (QDomEntityReference&) QDomNode::operator=(x); never executed: return (QDomEntityReference&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5975 | } | - | ||||||||||||||||||||||||
| 5976 | - | |||||||||||||||||||||||||
| 5977 | /*! | - | ||||||||||||||||||||||||
| 5978 | \fn QDomNode::NodeType QDomEntityReference::nodeType() const | - | ||||||||||||||||||||||||
| 5979 | - | |||||||||||||||||||||||||
| 5980 | Returns \c EntityReference. | - | ||||||||||||||||||||||||
| 5981 | */ | - | ||||||||||||||||||||||||
| 5982 | - | |||||||||||||||||||||||||
| 5983 | /************************************************************** | - | ||||||||||||||||||||||||
| 5984 | * | - | ||||||||||||||||||||||||
| 5985 | * QDomProcessingInstructionPrivate | - | ||||||||||||||||||||||||
| 5986 | * | - | ||||||||||||||||||||||||
| 5987 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5988 | - | |||||||||||||||||||||||||
| 5989 | QDomProcessingInstructionPrivate::QDomProcessingInstructionPrivate(QDomDocumentPrivate* d, | - | ||||||||||||||||||||||||
| 5990 | QDomNodePrivate* parent, const QString& target, const QString& data) | - | ||||||||||||||||||||||||
| 5991 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5992 | { | - | ||||||||||||||||||||||||
| 5993 | name = target; | - | ||||||||||||||||||||||||
| 5994 | value = data; | - | ||||||||||||||||||||||||
| 5995 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5996 | - | |||||||||||||||||||||||||
| 5997 | QDomProcessingInstructionPrivate::QDomProcessingInstructionPrivate(QDomProcessingInstructionPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5998 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5999 | { | - | ||||||||||||||||||||||||
| 6000 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6001 | - | |||||||||||||||||||||||||
| 6002 | - | |||||||||||||||||||||||||
| 6003 | QDomNodePrivate* QDomProcessingInstructionPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 6004 | { | - | ||||||||||||||||||||||||
| 6005 | QDomNodePrivate* p = new QDomProcessingInstructionPrivate(this, deep); | - | ||||||||||||||||||||||||
| 6006 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 6007 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6008 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6009 | } | - | ||||||||||||||||||||||||
| 6010 | - | |||||||||||||||||||||||||
| 6011 | void QDomProcessingInstructionPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 6012 | { | - | ||||||||||||||||||||||||
| 6013 | s << "<?" << name << ' ' << value << "?>" << endl; | - | ||||||||||||||||||||||||
| 6014 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6015 | - | |||||||||||||||||||||||||
| 6016 | /************************************************************** | - | ||||||||||||||||||||||||
| 6017 | * | - | ||||||||||||||||||||||||
| 6018 | * QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 6019 | * | - | ||||||||||||||||||||||||
| 6020 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6021 | - | |||||||||||||||||||||||||
| 6022 | /*! | - | ||||||||||||||||||||||||
| 6023 | \class QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 6024 | \reentrant | - | ||||||||||||||||||||||||
| 6025 | \brief The QDomProcessingInstruction class represents an XML processing | - | ||||||||||||||||||||||||
| 6026 | instruction. | - | ||||||||||||||||||||||||
| 6027 | - | |||||||||||||||||||||||||
| 6028 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 6029 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 6030 | - | |||||||||||||||||||||||||
| 6031 | Processing instructions are used in XML to keep processor-specific | - | ||||||||||||||||||||||||
| 6032 | information in the text of the document. | - | ||||||||||||||||||||||||
| 6033 | - | |||||||||||||||||||||||||
| 6034 | The XML declaration that appears at the top of an XML document, | - | ||||||||||||||||||||||||
| 6035 | typically \tt{<?xml version='1.0' encoding='UTF-8'?>}, is treated by QDom as a | - | ||||||||||||||||||||||||
| 6036 | processing instruction. This is unfortunate, since the XML declaration is | - | ||||||||||||||||||||||||
| 6037 | not a processing instruction; among other differences, it cannot be | - | ||||||||||||||||||||||||
| 6038 | inserted into a document anywhere but on the first line. | - | ||||||||||||||||||||||||
| 6039 | - | |||||||||||||||||||||||||
| 6040 | Do not use this function to create an xml declaration, since although it | - | ||||||||||||||||||||||||
| 6041 | has the same syntax as a processing instruction, it isn't, and might not | - | ||||||||||||||||||||||||
| 6042 | be treated by QDom as such. | - | ||||||||||||||||||||||||
| 6043 | - | |||||||||||||||||||||||||
| 6044 | The content of the processing instruction is retrieved with data() | - | ||||||||||||||||||||||||
| 6045 | and set with setData(). The processing instruction's target is | - | ||||||||||||||||||||||||
| 6046 | retrieved with target(). | - | ||||||||||||||||||||||||
| 6047 | - | |||||||||||||||||||||||||
| 6048 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 6049 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 6050 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 6051 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 6052 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 6053 | */ | - | ||||||||||||||||||||||||
| 6054 | - | |||||||||||||||||||||||||
| 6055 | /*! | - | ||||||||||||||||||||||||
| 6056 | Constructs an empty processing instruction. Use | - | ||||||||||||||||||||||||
| 6057 | QDomDocument::createProcessingInstruction() to create a processing | - | ||||||||||||||||||||||||
| 6058 | instruction with content. | - | ||||||||||||||||||||||||
| 6059 | */ | - | ||||||||||||||||||||||||
| 6060 | QDomProcessingInstruction::QDomProcessingInstruction() | - | ||||||||||||||||||||||||
| 6061 | : QDomNode() | - | ||||||||||||||||||||||||
| 6062 | { | - | ||||||||||||||||||||||||
| 6063 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6064 | - | |||||||||||||||||||||||||
| 6065 | /*! | - | ||||||||||||||||||||||||
| 6066 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 6067 | - | |||||||||||||||||||||||||
| 6068 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6069 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6070 | cloneNode(). | - | ||||||||||||||||||||||||
| 6071 | */ | - | ||||||||||||||||||||||||
| 6072 | QDomProcessingInstruction::QDomProcessingInstruction(const QDomProcessingInstruction& x) | - | ||||||||||||||||||||||||
| 6073 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6074 | { | - | ||||||||||||||||||||||||
| 6075 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6076 | - | |||||||||||||||||||||||||
| 6077 | QDomProcessingInstruction::QDomProcessingInstruction(QDomProcessingInstructionPrivate* n) | - | ||||||||||||||||||||||||
| 6078 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 6079 | { | - | ||||||||||||||||||||||||
| 6080 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6081 | - | |||||||||||||||||||||||||
| 6082 | /*! | - | ||||||||||||||||||||||||
| 6083 | Assigns \a x to this processing instruction. | - | ||||||||||||||||||||||||
| 6084 | - | |||||||||||||||||||||||||
| 6085 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6086 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6087 | cloneNode(). | - | ||||||||||||||||||||||||
| 6088 | */ | - | ||||||||||||||||||||||||
| 6089 | QDomProcessingInstruction& QDomProcessingInstruction::operator= (const QDomProcessingInstruction& x) | - | ||||||||||||||||||||||||
| 6090 | { | - | ||||||||||||||||||||||||
| 6091 | return (QDomProcessingInstruction&) QDomNode::operator=(x); never executed: return (QDomProcessingInstruction&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 6092 | } | - | ||||||||||||||||||||||||
| 6093 | - | |||||||||||||||||||||||||
| 6094 | /*! | - | ||||||||||||||||||||||||
| 6095 | \fn QDomNode::NodeType QDomProcessingInstruction::nodeType() const | - | ||||||||||||||||||||||||
| 6096 | - | |||||||||||||||||||||||||
| 6097 | Returns \c ProcessingInstructionNode. | - | ||||||||||||||||||||||||
| 6098 | */ | - | ||||||||||||||||||||||||
| 6099 | - | |||||||||||||||||||||||||
| 6100 | /*! | - | ||||||||||||||||||||||||
| 6101 | Returns the target of this processing instruction. | - | ||||||||||||||||||||||||
| 6102 | - | |||||||||||||||||||||||||
| 6103 | \sa data() | - | ||||||||||||||||||||||||
| 6104 | */ | - | ||||||||||||||||||||||||
| 6105 | QString QDomProcessingInstruction::target() const | - | ||||||||||||||||||||||||
| 6106 | { | - | ||||||||||||||||||||||||
| 6107 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6108 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 6109 | return impl->nodeName(); never executed: return impl->nodeName(); | 0 | ||||||||||||||||||||||||
| 6110 | } | - | ||||||||||||||||||||||||
| 6111 | - | |||||||||||||||||||||||||
| 6112 | /*! | - | ||||||||||||||||||||||||
| 6113 | Returns the content of this processing instruction. | - | ||||||||||||||||||||||||
| 6114 | - | |||||||||||||||||||||||||
| 6115 | \sa setData(), target() | - | ||||||||||||||||||||||||
| 6116 | */ | - | ||||||||||||||||||||||||
| 6117 | QString QDomProcessingInstruction::data() const | - | ||||||||||||||||||||||||
| 6118 | { | - | ||||||||||||||||||||||||
| 6119 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6120 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 6121 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 6122 | } | - | ||||||||||||||||||||||||
| 6123 | - | |||||||||||||||||||||||||
| 6124 | /*! | - | ||||||||||||||||||||||||
| 6125 | Sets the data contained in the processing instruction to \a d. | - | ||||||||||||||||||||||||
| 6126 | - | |||||||||||||||||||||||||
| 6127 | \sa data() | - | ||||||||||||||||||||||||
| 6128 | */ | - | ||||||||||||||||||||||||
| 6129 | void QDomProcessingInstruction::setData(const QString& d) | - | ||||||||||||||||||||||||
| 6130 | { | - | ||||||||||||||||||||||||
| 6131 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6132 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 6133 | impl->setNodeValue(d); | - | ||||||||||||||||||||||||
| 6134 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6135 | - | |||||||||||||||||||||||||
| 6136 | /************************************************************** | - | ||||||||||||||||||||||||
| 6137 | * | - | ||||||||||||||||||||||||
| 6138 | * QDomDocumentPrivate | - | ||||||||||||||||||||||||
| 6139 | * | - | ||||||||||||||||||||||||
| 6140 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6141 | - | |||||||||||||||||||||||||
| 6142 | QDomDocumentPrivate::QDomDocumentPrivate() | - | ||||||||||||||||||||||||
| 6143 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6144 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6145 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6146 | { | - | ||||||||||||||||||||||||
| 6147 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6148 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6149 | - | |||||||||||||||||||||||||
| 6150 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6151 | } executed 242 times by 4 tests: end of blockExecuted by:
| 242 | ||||||||||||||||||||||||
| 6152 | - | |||||||||||||||||||||||||
| 6153 | QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname) | - | ||||||||||||||||||||||||
| 6154 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6155 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6156 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6157 | { | - | ||||||||||||||||||||||||
| 6158 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6159 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6160 | type->name = aname; | - | ||||||||||||||||||||||||
| 6161 | - | |||||||||||||||||||||||||
| 6162 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6163 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 6164 | - | |||||||||||||||||||||||||
| 6165 | QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt) | - | ||||||||||||||||||||||||
| 6166 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6167 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6168 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6169 | { | - | ||||||||||||||||||||||||
| 6170 | if (dt != 0) {
| 0 | ||||||||||||||||||||||||
| 6171 | type = dt; | - | ||||||||||||||||||||||||
| 6172 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 6173 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6174 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6175 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6176 | - | |||||||||||||||||||||||||
| 6177 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6178 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6179 | - | |||||||||||||||||||||||||
| 6180 | QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 6181 | : QDomNodePrivate(n, deep), | - | ||||||||||||||||||||||||
| 6182 | impl(n->impl->clone()), | - | ||||||||||||||||||||||||
| 6183 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6184 | { | - | ||||||||||||||||||||||||
| 6185 | type = static_cast<QDomDocumentTypePrivate*>(n->type->cloneNode()); | - | ||||||||||||||||||||||||
| 6186 | type->setParent(this); | - | ||||||||||||||||||||||||
| 6187 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6188 | - | |||||||||||||||||||||||||
| 6189 | QDomDocumentPrivate::~QDomDocumentPrivate() | - | ||||||||||||||||||||||||
| 6190 | { | - | ||||||||||||||||||||||||
| 6191 | } | - | ||||||||||||||||||||||||
| 6192 | - | |||||||||||||||||||||||||
| 6193 | void QDomDocumentPrivate::clear() | - | ||||||||||||||||||||||||
| 6194 | { | - | ||||||||||||||||||||||||
| 6195 | impl.reset(); | - | ||||||||||||||||||||||||
| 6196 | type.reset(); | - | ||||||||||||||||||||||||
| 6197 | QDomNodePrivate::clear(); | - | ||||||||||||||||||||||||
| 6198 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 6199 | - | |||||||||||||||||||||||||
| 6200 | static void initializeReader(QXmlSimpleReader &reader, bool namespaceProcessing) | - | ||||||||||||||||||||||||
| 6201 | { | - | ||||||||||||||||||||||||
| 6202 | reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing); | - | ||||||||||||||||||||||||
| 6203 | reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), !namespaceProcessing); | - | ||||||||||||||||||||||||
| 6204 | reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false); // Shouldn't change in Qt 4 | - | ||||||||||||||||||||||||
| 6205 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 6206 | - | |||||||||||||||||||||||||
| 6207 | bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6208 | { | - | ||||||||||||||||||||||||
| 6209 | QXmlSimpleReader reader; | - | ||||||||||||||||||||||||
| 6210 | initializeReader(reader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6211 | return setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); executed 244 times by 5 tests: return setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn);Executed by:
| 244 | ||||||||||||||||||||||||
| 6212 | } | - | ||||||||||||||||||||||||
| 6213 | - | |||||||||||||||||||||||||
| 6214 | bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6215 | { | - | ||||||||||||||||||||||||
| 6216 | clear(); | - | ||||||||||||||||||||||||
| 6217 | impl = new QDomImplementationPrivate; | - | ||||||||||||||||||||||||
| 6218 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6219 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6220 | - | |||||||||||||||||||||||||
| 6221 | bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces"))
| 2-242 | ||||||||||||||||||||||||
| 6222 | && !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"));
| 0-2 | ||||||||||||||||||||||||
| 6223 | - | |||||||||||||||||||||||||
| 6224 | QDomHandler hnd(this, simpleReader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6225 | reader->setContentHandler(&hnd); | - | ||||||||||||||||||||||||
| 6226 | reader->setErrorHandler(&hnd); | - | ||||||||||||||||||||||||
| 6227 | reader->setLexicalHandler(&hnd); | - | ||||||||||||||||||||||||
| 6228 | reader->setDeclHandler(&hnd); | - | ||||||||||||||||||||||||
| 6229 | reader->setDTDHandler(&hnd); | - | ||||||||||||||||||||||||
| 6230 | - | |||||||||||||||||||||||||
| 6231 | if (!reader->parse(source)) {
| 0-244 | ||||||||||||||||||||||||
| 6232 | if (errorMsg)
| 0 | ||||||||||||||||||||||||
| 6233 | *errorMsg = hnd.errorMsg; never executed: *errorMsg = hnd.errorMsg; | 0 | ||||||||||||||||||||||||
| 6234 | if (errorLine)
| 0 | ||||||||||||||||||||||||
| 6235 | *errorLine = hnd.errorLine; never executed: *errorLine = hnd.errorLine; | 0 | ||||||||||||||||||||||||
| 6236 | if (errorColumn)
| 0 | ||||||||||||||||||||||||
| 6237 | *errorColumn = hnd.errorColumn; never executed: *errorColumn = hnd.errorColumn; | 0 | ||||||||||||||||||||||||
| 6238 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 6239 | } | - | ||||||||||||||||||||||||
| 6240 | - | |||||||||||||||||||||||||
| 6241 | return true; executed 244 times by 5 tests: return true;Executed by:
| 244 | ||||||||||||||||||||||||
| 6242 | } | - | ||||||||||||||||||||||||
| 6243 | - | |||||||||||||||||||||||||
| 6244 | QDomNodePrivate* QDomDocumentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 6245 | { | - | ||||||||||||||||||||||||
| 6246 | QDomNodePrivate *p = new QDomDocumentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 6247 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 6248 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6249 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6250 | } | - | ||||||||||||||||||||||||
| 6251 | - | |||||||||||||||||||||||||
| 6252 | QDomElementPrivate* QDomDocumentPrivate::documentElement() | - | ||||||||||||||||||||||||
| 6253 | { | - | ||||||||||||||||||||||||
| 6254 | QDomNodePrivate *p = first; | - | ||||||||||||||||||||||||
| 6255 | while (p && !p->isElement())
| 0-97 | ||||||||||||||||||||||||
| 6256 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 6257 | - | |||||||||||||||||||||||||
| 6258 | return static_cast<QDomElementPrivate *>(p); executed 97 times by 1 test: return static_cast<QDomElementPrivate *>(p);Executed by:
| 97 | ||||||||||||||||||||||||
| 6259 | } | - | ||||||||||||||||||||||||
| 6260 | - | |||||||||||||||||||||||||
| 6261 | QDomElementPrivate* QDomDocumentPrivate::createElement(const QString &tagName) | - | ||||||||||||||||||||||||
| 6262 | { | - | ||||||||||||||||||||||||
| 6263 | bool ok; | - | ||||||||||||||||||||||||
| 6264 | QString fixedName = fixedXmlName(tagName, &ok); | - | ||||||||||||||||||||||||
| 6265 | if (!ok)
| 0-1021 | ||||||||||||||||||||||||
| 6266 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6267 | - | |||||||||||||||||||||||||
| 6268 | QDomElementPrivate *e = new QDomElementPrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6269 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6270 | return e; executed 1021 times by 4 tests: return e;Executed by:
| 1021 | ||||||||||||||||||||||||
| 6271 | } | - | ||||||||||||||||||||||||
| 6272 | - | |||||||||||||||||||||||||
| 6273 | QDomElementPrivate* QDomDocumentPrivate::createElementNS(const QString &nsURI, const QString &qName) | - | ||||||||||||||||||||||||
| 6274 | { | - | ||||||||||||||||||||||||
| 6275 | bool ok; | - | ||||||||||||||||||||||||
| 6276 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 6277 | if (!ok)
| 0-2 | ||||||||||||||||||||||||
| 6278 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6279 | - | |||||||||||||||||||||||||
| 6280 | QDomElementPrivate *e = new QDomElementPrivate(this, 0, nsURI, fixedName); | - | ||||||||||||||||||||||||
| 6281 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6282 | return e; executed 2 times by 1 test: return e;Executed by:
| 2 | ||||||||||||||||||||||||
| 6283 | } | - | ||||||||||||||||||||||||
| 6284 | - | |||||||||||||||||||||||||
| 6285 | QDomDocumentFragmentPrivate* QDomDocumentPrivate::createDocumentFragment() | - | ||||||||||||||||||||||||
| 6286 | { | - | ||||||||||||||||||||||||
| 6287 | QDomDocumentFragmentPrivate *f = new QDomDocumentFragmentPrivate(this, (QDomNodePrivate*)0); | - | ||||||||||||||||||||||||
| 6288 | f->ref.deref(); | - | ||||||||||||||||||||||||
| 6289 | return f; never executed: return f; | 0 | ||||||||||||||||||||||||
| 6290 | } | - | ||||||||||||||||||||||||
| 6291 | - | |||||||||||||||||||||||||
| 6292 | QDomTextPrivate* QDomDocumentPrivate::createTextNode(const QString &data) | - | ||||||||||||||||||||||||
| 6293 | { | - | ||||||||||||||||||||||||
| 6294 | bool ok; | - | ||||||||||||||||||||||||
| 6295 | QString fixedData = fixedCharData(data, &ok); | - | ||||||||||||||||||||||||
| 6296 | if (!ok)
| 0-125 | ||||||||||||||||||||||||
| 6297 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6298 | - | |||||||||||||||||||||||||
| 6299 | QDomTextPrivate *t = new QDomTextPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6300 | t->ref.deref(); | - | ||||||||||||||||||||||||
| 6301 | return t; executed 125 times by 2 tests: return t;Executed by:
| 125 | ||||||||||||||||||||||||
| 6302 | } | - | ||||||||||||||||||||||||
| 6303 | - | |||||||||||||||||||||||||
| 6304 | QDomCommentPrivate* QDomDocumentPrivate::createComment(const QString &data) | - | ||||||||||||||||||||||||
| 6305 | { | - | ||||||||||||||||||||||||
| 6306 | bool ok; | - | ||||||||||||||||||||||||
| 6307 | QString fixedData = fixedComment(data, &ok); | - | ||||||||||||||||||||||||
| 6308 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6309 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6310 | - | |||||||||||||||||||||||||
| 6311 | QDomCommentPrivate *c = new QDomCommentPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6312 | c->ref.deref(); | - | ||||||||||||||||||||||||
| 6313 | return c; never executed: return c; | 0 | ||||||||||||||||||||||||
| 6314 | } | - | ||||||||||||||||||||||||
| 6315 | - | |||||||||||||||||||||||||
| 6316 | QDomCDATASectionPrivate* QDomDocumentPrivate::createCDATASection(const QString &data) | - | ||||||||||||||||||||||||
| 6317 | { | - | ||||||||||||||||||||||||
| 6318 | bool ok; | - | ||||||||||||||||||||||||
| 6319 | QString fixedData = fixedCDataSection(data, &ok); | - | ||||||||||||||||||||||||
| 6320 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6321 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6322 | - | |||||||||||||||||||||||||
| 6323 | QDomCDATASectionPrivate *c = new QDomCDATASectionPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6324 | c->ref.deref(); | - | ||||||||||||||||||||||||
| 6325 | return c; never executed: return c; | 0 | ||||||||||||||||||||||||
| 6326 | } | - | ||||||||||||||||||||||||
| 6327 | - | |||||||||||||||||||||||||
| 6328 | QDomProcessingInstructionPrivate* QDomDocumentPrivate::createProcessingInstruction(const QString &target, | - | ||||||||||||||||||||||||
| 6329 | const QString &data) | - | ||||||||||||||||||||||||
| 6330 | { | - | ||||||||||||||||||||||||
| 6331 | bool ok; | - | ||||||||||||||||||||||||
| 6332 | QString fixedData = fixedPIData(data, &ok); | - | ||||||||||||||||||||||||
| 6333 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6334 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6335 | // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) | - | ||||||||||||||||||||||||
| 6336 | QString fixedTarget = fixedXmlName(target, &ok); | - | ||||||||||||||||||||||||
| 6337 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6338 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6339 | - | |||||||||||||||||||||||||
| 6340 | QDomProcessingInstructionPrivate *p = new QDomProcessingInstructionPrivate(this, 0, fixedTarget, fixedData); | - | ||||||||||||||||||||||||
| 6341 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6342 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6343 | } | - | ||||||||||||||||||||||||
| 6344 | QDomAttrPrivate* QDomDocumentPrivate::createAttribute(const QString &aname) | - | ||||||||||||||||||||||||
| 6345 | { | - | ||||||||||||||||||||||||
| 6346 | bool ok; | - | ||||||||||||||||||||||||
| 6347 | QString fixedName = fixedXmlName(aname, &ok); | - | ||||||||||||||||||||||||
| 6348 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6349 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6350 | - | |||||||||||||||||||||||||
| 6351 | QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6352 | a->ref.deref(); | - | ||||||||||||||||||||||||
| 6353 | return a; never executed: return a; | 0 | ||||||||||||||||||||||||
| 6354 | } | - | ||||||||||||||||||||||||
| 6355 | - | |||||||||||||||||||||||||
| 6356 | QDomAttrPrivate* QDomDocumentPrivate::createAttributeNS(const QString &nsURI, const QString &qName) | - | ||||||||||||||||||||||||
| 6357 | { | - | ||||||||||||||||||||||||
| 6358 | bool ok; | - | ||||||||||||||||||||||||
| 6359 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 6360 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6361 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6362 | - | |||||||||||||||||||||||||
| 6363 | QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, nsURI, fixedName); | - | ||||||||||||||||||||||||
| 6364 | a->ref.deref(); | - | ||||||||||||||||||||||||
| 6365 | return a; never executed: return a; | 0 | ||||||||||||||||||||||||
| 6366 | } | - | ||||||||||||||||||||||||
| 6367 | - | |||||||||||||||||||||||||
| 6368 | QDomEntityReferencePrivate* QDomDocumentPrivate::createEntityReference(const QString &aname) | - | ||||||||||||||||||||||||
| 6369 | { | - | ||||||||||||||||||||||||
| 6370 | bool ok; | - | ||||||||||||||||||||||||
| 6371 | QString fixedName = fixedXmlName(aname, &ok); | - | ||||||||||||||||||||||||
| 6372 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6373 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6374 | - | |||||||||||||||||||||||||
| 6375 | QDomEntityReferencePrivate *e = new QDomEntityReferencePrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6376 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6377 | return e; never executed: return e; | 0 | ||||||||||||||||||||||||
| 6378 | } | - | ||||||||||||||||||||||||
| 6379 | - | |||||||||||||||||||||||||
| 6380 | QDomNodePrivate* QDomDocumentPrivate::importNode(QDomNodePrivate *importedNode, bool deep) | - | ||||||||||||||||||||||||
| 6381 | { | - | ||||||||||||||||||||||||
| 6382 | QDomNodePrivate *node = 0; | - | ||||||||||||||||||||||||
| 6383 | switch (importedNode->nodeType()) { | - | ||||||||||||||||||||||||
| 6384 | case QDomNode::AttributeNode: never executed: case QDomNode::AttributeNode: | 0 | ||||||||||||||||||||||||
| 6385 | node = new QDomAttrPrivate((QDomAttrPrivate*)importedNode, true); | - | ||||||||||||||||||||||||
| 6386 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6387 | case QDomNode::DocumentFragmentNode: never executed: case QDomNode::DocumentFragmentNode: | 0 | ||||||||||||||||||||||||
| 6388 | node = new QDomDocumentFragmentPrivate((QDomDocumentFragmentPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6389 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6390 | case QDomNode::ElementNode: never executed: case QDomNode::ElementNode: | 0 | ||||||||||||||||||||||||
| 6391 | node = new QDomElementPrivate((QDomElementPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6392 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6393 | case QDomNode::EntityNode: never executed: case QDomNode::EntityNode: | 0 | ||||||||||||||||||||||||
| 6394 | node = new QDomEntityPrivate((QDomEntityPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6395 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6396 | case QDomNode::EntityReferenceNode: never executed: case QDomNode::EntityReferenceNode: | 0 | ||||||||||||||||||||||||
| 6397 | node = new QDomEntityReferencePrivate((QDomEntityReferencePrivate*)importedNode, false); | - | ||||||||||||||||||||||||
| 6398 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6399 | case QDomNode::NotationNode: never executed: case QDomNode::NotationNode: | 0 | ||||||||||||||||||||||||
| 6400 | node = new QDomNotationPrivate((QDomNotationPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6402 | case QDomNode::ProcessingInstructionNode: never executed: case QDomNode::ProcessingInstructionNode: | 0 | ||||||||||||||||||||||||
| 6403 | node = new QDomProcessingInstructionPrivate((QDomProcessingInstructionPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6404 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6405 | case QDomNode::TextNode: never executed: case QDomNode::TextNode: | 0 | ||||||||||||||||||||||||
| 6406 | node = new QDomTextPrivate((QDomTextPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6407 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6408 | case QDomNode::CDATASectionNode: never executed: case QDomNode::CDATASectionNode: | 0 | ||||||||||||||||||||||||
| 6409 | node = new QDomCDATASectionPrivate((QDomCDATASectionPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6410 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6411 | case QDomNode::CommentNode: never executed: case QDomNode::CommentNode: | 0 | ||||||||||||||||||||||||
| 6412 | node = new QDomCommentPrivate((QDomCommentPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6413 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6414 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 6415 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6416 | } | - | ||||||||||||||||||||||||
| 6417 | if (node) {
| 0 | ||||||||||||||||||||||||
| 6418 | node->setOwnerDocument(this); | - | ||||||||||||||||||||||||
| 6419 | // The QDomNode constructor increases the refcount, so deref first to | - | ||||||||||||||||||||||||
| 6420 | // keep refcount balanced. | - | ||||||||||||||||||||||||
| 6421 | node->ref.deref(); | - | ||||||||||||||||||||||||
| 6422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6423 | return node; never executed: return node; | 0 | ||||||||||||||||||||||||
| 6424 | } | - | ||||||||||||||||||||||||
| 6425 | - | |||||||||||||||||||||||||
| 6426 | void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNode::EncodingPolicy encUsed) const | - | ||||||||||||||||||||||||
| 6427 | { | - | ||||||||||||||||||||||||
| 6428 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 6429 | - | |||||||||||||||||||||||||
| 6430 | if(encUsed == QDomNode::EncodingFromDocument) {
| 0-86 | ||||||||||||||||||||||||
| 6431 | #ifndef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 6432 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 6433 | - | |||||||||||||||||||||||||
| 6434 | QTextCodec *codec = 0; | - | ||||||||||||||||||||||||
| 6435 | - | |||||||||||||||||||||||||
| 6436 | if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
| 0-86 | ||||||||||||||||||||||||
| 6437 | // we have an XML declaration | - | ||||||||||||||||||||||||
| 6438 | QString data = n->nodeValue(); | - | ||||||||||||||||||||||||
| 6439 | QRegExp encoding(QString::fromLatin1("encoding\\s*=\\s*((\"([^\"]*)\")|('([^']*)'))")); | - | ||||||||||||||||||||||||
| 6440 | encoding.indexIn(data); | - | ||||||||||||||||||||||||
| 6441 | QString enc = encoding.cap(3); | - | ||||||||||||||||||||||||
| 6442 | if (enc.isEmpty())
| 0 | ||||||||||||||||||||||||
| 6443 | enc = encoding.cap(5); never executed: enc = encoding.cap(5); | 0 | ||||||||||||||||||||||||
| 6444 | if (!enc.isEmpty())
| 0 | ||||||||||||||||||||||||
| 6445 | codec = QTextCodec::codecForName(enc.toLatin1().data()); never executed: codec = QTextCodec::codecForName(enc.toLatin1().data()); | 0 | ||||||||||||||||||||||||
| 6446 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6447 | if (!codec)
| 0-86 | ||||||||||||||||||||||||
| 6448 | codec = QTextCodec::codecForName("UTF-8"); executed 86 times by 2 tests: codec = QTextCodec::codecForName("UTF-8");Executed by:
| 86 | ||||||||||||||||||||||||
| 6449 | if (codec)
| 0-86 | ||||||||||||||||||||||||
| 6450 | s.setCodec(codec); executed 86 times by 2 tests: s.setCodec(codec);Executed by:
| 86 | ||||||||||||||||||||||||
| 6451 | #endif | - | ||||||||||||||||||||||||
| 6452 | bool doc = false; | - | ||||||||||||||||||||||||
| 6453 | - | |||||||||||||||||||||||||
| 6454 | while (n) {
| 86 | ||||||||||||||||||||||||
| 6455 | if (!doc && !(n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml"))) {
| 0-86 | ||||||||||||||||||||||||
| 6456 | // save doctype after XML declaration | - | ||||||||||||||||||||||||
| 6457 | type->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6458 | doc = true; | - | ||||||||||||||||||||||||
| 6459 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6460 | n->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6461 | n = n->next; | - | ||||||||||||||||||||||||
| 6462 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6463 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6464 | else { | - | ||||||||||||||||||||||||
| 6465 | - | |||||||||||||||||||||||||
| 6466 | // Write out the XML declaration. | - | ||||||||||||||||||||||||
| 6467 | #ifdef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 6468 | const QLatin1String codecName("iso-8859-1"); | - | ||||||||||||||||||||||||
| 6469 | #else | - | ||||||||||||||||||||||||
| 6470 | const QTextCodec *const codec = s.codec(); | - | ||||||||||||||||||||||||
| 6471 | Q_ASSERT_X(codec, "QDomNode::save()", "A codec must be specified in the text stream."); | - | ||||||||||||||||||||||||
| 6472 | const QByteArray codecName = codec->name(); | - | ||||||||||||||||||||||||
| 6473 | #endif | - | ||||||||||||||||||||||||
| 6474 | - | |||||||||||||||||||||||||
| 6475 | s << "<?xml version=\"1.0\" encoding=\"" | - | ||||||||||||||||||||||||
| 6476 | << codecName | - | ||||||||||||||||||||||||
| 6477 | << "\"?>\n"; | - | ||||||||||||||||||||||||
| 6478 | - | |||||||||||||||||||||||||
| 6479 | // Skip the first processing instruction by name "xml", if any such exists. | - | ||||||||||||||||||||||||
| 6480 | const QDomNodePrivate* startNode = n; | - | ||||||||||||||||||||||||
| 6481 | - | |||||||||||||||||||||||||
| 6482 | // First, we try to find the PI and sets the startNode to the one appearing after it. | - | ||||||||||||||||||||||||
| 6483 | while (n) {
| 0 | ||||||||||||||||||||||||
| 6484 | if(n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
| 0 | ||||||||||||||||||||||||
| 6485 | startNode = n->next; | - | ||||||||||||||||||||||||
| 6486 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6487 | } | - | ||||||||||||||||||||||||
| 6488 | else | - | ||||||||||||||||||||||||
| 6489 | n = n->next; never executed: n = n->next; | 0 | ||||||||||||||||||||||||
| 6490 | } | - | ||||||||||||||||||||||||
| 6491 | - | |||||||||||||||||||||||||
| 6492 | // Now we serialize all the nodes after the faked XML declaration(the PI). | - | ||||||||||||||||||||||||
| 6493 | while(startNode) {
| 0 | ||||||||||||||||||||||||
| 6494 | startNode->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6495 | startNode = startNode->next; | - | ||||||||||||||||||||||||
| 6496 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6498 | } | - | ||||||||||||||||||||||||
| 6499 | - | |||||||||||||||||||||||||
| 6500 | /************************************************************** | - | ||||||||||||||||||||||||
| 6501 | * | - | ||||||||||||||||||||||||
| 6502 | * QDomDocument | - | ||||||||||||||||||||||||
| 6503 | * | - | ||||||||||||||||||||||||
| 6504 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6505 | - | |||||||||||||||||||||||||
| 6506 | #define IMPL ((QDomDocumentPrivate*)impl) | - | ||||||||||||||||||||||||
| 6507 | - | |||||||||||||||||||||||||
| 6508 | /*! | - | ||||||||||||||||||||||||
| 6509 | \class QDomDocument | - | ||||||||||||||||||||||||
| 6510 | \reentrant | - | ||||||||||||||||||||||||
| 6511 | \brief The QDomDocument class represents an XML document. | - | ||||||||||||||||||||||||
| 6512 | - | |||||||||||||||||||||||||
| 6513 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 6514 | - | |||||||||||||||||||||||||
| 6515 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 6516 | - | |||||||||||||||||||||||||
| 6517 | The QDomDocument class represents the entire XML document. | - | ||||||||||||||||||||||||
| 6518 | Conceptually, it is the root of the document tree, and provides | - | ||||||||||||||||||||||||
| 6519 | the primary access to the document's data. | - | ||||||||||||||||||||||||
| 6520 | - | |||||||||||||||||||||||||
| 6521 | Since elements, text nodes, comments, processing instructions, | - | ||||||||||||||||||||||||
| 6522 | etc., cannot exist outside the context of a document, the document | - | ||||||||||||||||||||||||
| 6523 | class also contains the factory functions needed to create these | - | ||||||||||||||||||||||||
| 6524 | objects. The node objects created have an ownerDocument() function | - | ||||||||||||||||||||||||
| 6525 | which associates them with the document within whose context they | - | ||||||||||||||||||||||||
| 6526 | were created. The DOM classes that will be used most often are | - | ||||||||||||||||||||||||
| 6527 | QDomNode, QDomDocument, QDomElement and QDomText. | - | ||||||||||||||||||||||||
| 6528 | - | |||||||||||||||||||||||||
| 6529 | The parsed XML is represented internally by a tree of objects that | - | ||||||||||||||||||||||||
| 6530 | can be accessed using the various QDom classes. All QDom classes | - | ||||||||||||||||||||||||
| 6531 | only \e reference objects in the internal tree. The internal | - | ||||||||||||||||||||||||
| 6532 | objects in the DOM tree will get deleted once the last QDom | - | ||||||||||||||||||||||||
| 6533 | object referencing them or the QDomDocument itself is deleted. | - | ||||||||||||||||||||||||
| 6534 | - | |||||||||||||||||||||||||
| 6535 | Creation of elements, text nodes, etc. is done using the various | - | ||||||||||||||||||||||||
| 6536 | factory functions provided in this class. Using the default | - | ||||||||||||||||||||||||
| 6537 | constructors of the QDom classes will only result in empty | - | ||||||||||||||||||||||||
| 6538 | objects that cannot be manipulated or inserted into the Document. | - | ||||||||||||||||||||||||
| 6539 | - | |||||||||||||||||||||||||
| 6540 | The QDomDocument class has several functions for creating document | - | ||||||||||||||||||||||||
| 6541 | data, for example, createElement(), createTextNode(), | - | ||||||||||||||||||||||||
| 6542 | createComment(), createCDATASection(), | - | ||||||||||||||||||||||||
| 6543 | createProcessingInstruction(), createAttribute() and | - | ||||||||||||||||||||||||
| 6544 | createEntityReference(). Some of these functions have versions | - | ||||||||||||||||||||||||
| 6545 | that support namespaces, i.e. createElementNS() and | - | ||||||||||||||||||||||||
| 6546 | createAttributeNS(). The createDocumentFragment() function is used | - | ||||||||||||||||||||||||
| 6547 | to hold parts of the document; this is useful for manipulating for | - | ||||||||||||||||||||||||
| 6548 | complex documents. | - | ||||||||||||||||||||||||
| 6549 | - | |||||||||||||||||||||||||
| 6550 | The entire content of the document is set with setContent(). This | - | ||||||||||||||||||||||||
| 6551 | function parses the string it is passed as an XML document and | - | ||||||||||||||||||||||||
| 6552 | creates the DOM tree that represents the document. The root | - | ||||||||||||||||||||||||
| 6553 | element is available using documentElement(). The textual | - | ||||||||||||||||||||||||
| 6554 | representation of the document can be obtained using toString(). | - | ||||||||||||||||||||||||
| 6555 | - | |||||||||||||||||||||||||
| 6556 | \note The DOM tree might end up reserving a lot of memory if the XML | - | ||||||||||||||||||||||||
| 6557 | document is big. For such documents, the QXmlStreamReader or the | - | ||||||||||||||||||||||||
| 6558 | QXmlQuery classes might be better solutions. | - | ||||||||||||||||||||||||
| 6559 | - | |||||||||||||||||||||||||
| 6560 | It is possible to insert a node from another document into the | - | ||||||||||||||||||||||||
| 6561 | document using importNode(). | - | ||||||||||||||||||||||||
| 6562 | - | |||||||||||||||||||||||||
| 6563 | You can obtain a list of all the elements that have a particular | - | ||||||||||||||||||||||||
| 6564 | tag with elementsByTagName() or with elementsByTagNameNS(). | - | ||||||||||||||||||||||||
| 6565 | - | |||||||||||||||||||||||||
| 6566 | The QDom classes are typically used as follows: | - | ||||||||||||||||||||||||
| 6567 | - | |||||||||||||||||||||||||
| 6568 | \snippet code/src_xml_dom_qdom.cpp 16 | - | ||||||||||||||||||||||||
| 6569 | - | |||||||||||||||||||||||||
| 6570 | Once \c doc and \c elem go out of scope, the whole internal tree | - | ||||||||||||||||||||||||
| 6571 | representing the XML document is deleted. | - | ||||||||||||||||||||||||
| 6572 | - | |||||||||||||||||||||||||
| 6573 | To create a document using DOM use code like this: | - | ||||||||||||||||||||||||
| 6574 | - | |||||||||||||||||||||||||
| 6575 | \snippet code/src_xml_dom_qdom.cpp 17 | - | ||||||||||||||||||||||||
| 6576 | - | |||||||||||||||||||||||||
| 6577 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 6578 | the Document Object Model (DOM) | - | ||||||||||||||||||||||||
| 6579 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 6580 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core} | - | ||||||||||||||||||||||||
| 6581 | Specifications. | - | ||||||||||||||||||||||||
| 6582 | - | |||||||||||||||||||||||||
| 6583 | \sa {DOM Bookmarks Example}, {Simple DOM Model Example} | - | ||||||||||||||||||||||||
| 6584 | */ | - | ||||||||||||||||||||||||
| 6585 | - | |||||||||||||||||||||||||
| 6586 | - | |||||||||||||||||||||||||
| 6587 | /*! | - | ||||||||||||||||||||||||
| 6588 | Constructs an empty document. | - | ||||||||||||||||||||||||
| 6589 | */ | - | ||||||||||||||||||||||||
| 6590 | QDomDocument::QDomDocument() | - | ||||||||||||||||||||||||
| 6591 | { | - | ||||||||||||||||||||||||
| 6592 | impl = 0; | - | ||||||||||||||||||||||||
| 6593 | } executed 242 times by 4 tests: end of blockExecuted by:
| 242 | ||||||||||||||||||||||||
| 6594 | - | |||||||||||||||||||||||||
| 6595 | /*! | - | ||||||||||||||||||||||||
| 6596 | Creates a document and sets the name of the document type to \a | - | ||||||||||||||||||||||||
| 6597 | name. | - | ||||||||||||||||||||||||
| 6598 | */ | - | ||||||||||||||||||||||||
| 6599 | QDomDocument::QDomDocument(const QString& name) | - | ||||||||||||||||||||||||
| 6600 | { | - | ||||||||||||||||||||||||
| 6601 | // We take over ownership | - | ||||||||||||||||||||||||
| 6602 | impl = new QDomDocumentPrivate(name); | - | ||||||||||||||||||||||||
| 6603 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 6604 | - | |||||||||||||||||||||||||
| 6605 | /*! | - | ||||||||||||||||||||||||
| 6606 | Creates a document with the document type \a doctype. | - | ||||||||||||||||||||||||
| 6607 | - | |||||||||||||||||||||||||
| 6608 | \sa QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 6609 | */ | - | ||||||||||||||||||||||||
| 6610 | QDomDocument::QDomDocument(const QDomDocumentType& doctype) | - | ||||||||||||||||||||||||
| 6611 | { | - | ||||||||||||||||||||||||
| 6612 | impl = new QDomDocumentPrivate((QDomDocumentTypePrivate*)(doctype.impl)); | - | ||||||||||||||||||||||||
| 6613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6614 | - | |||||||||||||||||||||||||
| 6615 | /*! | - | ||||||||||||||||||||||||
| 6616 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 6617 | - | |||||||||||||||||||||||||
| 6618 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6619 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6620 | cloneNode(). | - | ||||||||||||||||||||||||
| 6621 | */ | - | ||||||||||||||||||||||||
| 6622 | QDomDocument::QDomDocument(const QDomDocument& x) | - | ||||||||||||||||||||||||
| 6623 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6624 | { | - | ||||||||||||||||||||||||
| 6625 | } executed 97 times by 1 test: end of blockExecuted by:
| 97 | ||||||||||||||||||||||||
| 6626 | - | |||||||||||||||||||||||||
| 6627 | QDomDocument::QDomDocument(QDomDocumentPrivate* x) | - | ||||||||||||||||||||||||
| 6628 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6629 | { | - | ||||||||||||||||||||||||
| 6630 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6631 | - | |||||||||||||||||||||||||
| 6632 | /*! | - | ||||||||||||||||||||||||
| 6633 | Assigns \a x to this DOM document. | - | ||||||||||||||||||||||||
| 6634 | - | |||||||||||||||||||||||||
| 6635 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6636 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6637 | cloneNode(). | - | ||||||||||||||||||||||||
| 6638 | */ | - | ||||||||||||||||||||||||
| 6639 | QDomDocument& QDomDocument::operator= (const QDomDocument& x) | - | ||||||||||||||||||||||||
| 6640 | { | - | ||||||||||||||||||||||||
| 6641 | return (QDomDocument&) QDomNode::operator=(x); never executed: return (QDomDocument&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 6642 | } | - | ||||||||||||||||||||||||
| 6643 | - | |||||||||||||||||||||||||
| 6644 | /*! | - | ||||||||||||||||||||||||
| 6645 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 6646 | */ | - | ||||||||||||||||||||||||
| 6647 | QDomDocument::~QDomDocument() | - | ||||||||||||||||||||||||
| 6648 | { | - | ||||||||||||||||||||||||
| 6649 | } | - | ||||||||||||||||||||||||
| 6650 | - | |||||||||||||||||||||||||
| 6651 | /*! | - | ||||||||||||||||||||||||
| 6652 | \overload | - | ||||||||||||||||||||||||
| 6653 | - | |||||||||||||||||||||||||
| 6654 | This function reads the XML document from the string \a text, returning | - | ||||||||||||||||||||||||
| 6655 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6656 | Since \a text is already a Unicode string, no encoding detection | - | ||||||||||||||||||||||||
| 6657 | is done. | - | ||||||||||||||||||||||||
| 6658 | */ | - | ||||||||||||||||||||||||
| 6659 | bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6660 | { | - | ||||||||||||||||||||||||
| 6661 | if (!impl)
| 0-241 | ||||||||||||||||||||||||
| 6662 | impl = new QDomDocumentPrivate(); executed 241 times by 3 tests: impl = new QDomDocumentPrivate();Executed by:
| 241 | ||||||||||||||||||||||||
| 6663 | QXmlInputSource source; | - | ||||||||||||||||||||||||
| 6664 | source.setData(text); | - | ||||||||||||||||||||||||
| 6665 | return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); executed 241 times by 3 tests: return ((QDomDocumentPrivate*)impl)->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);Executed by:
| 241 | ||||||||||||||||||||||||
| 6666 | } | - | ||||||||||||||||||||||||
| 6667 | - | |||||||||||||||||||||||||
| 6668 | /*! | - | ||||||||||||||||||||||||
| 6669 | \nonreentrant | - | ||||||||||||||||||||||||
| 6670 | - | |||||||||||||||||||||||||
| 6671 | This function parses the XML document from the byte array \a | - | ||||||||||||||||||||||||
| 6672 | data and sets it as the content of the document. It tries to | - | ||||||||||||||||||||||||
| 6673 | detect the encoding of the document as required by the XML | - | ||||||||||||||||||||||||
| 6674 | specification. | - | ||||||||||||||||||||||||
| 6675 | - | |||||||||||||||||||||||||
| 6676 | If \a namespaceProcessing is true, the parser recognizes | - | ||||||||||||||||||||||||
| 6677 | namespaces in the XML file and sets the prefix name, local name | - | ||||||||||||||||||||||||
| 6678 | and namespace URI to appropriate values. If \a namespaceProcessing | - | ||||||||||||||||||||||||
| 6679 | is false, the parser does no namespace processing when it reads | - | ||||||||||||||||||||||||
| 6680 | the XML file. | - | ||||||||||||||||||||||||
| 6681 | - | |||||||||||||||||||||||||
| 6682 | If a parse error occurs, this function returns \c false and the error | - | ||||||||||||||||||||||||
| 6683 | message is placed in \c{*}\a{errorMsg}, the line number in | - | ||||||||||||||||||||||||
| 6684 | \c{*}\a{errorLine} and the column number in \c{*}\a{errorColumn} | - | ||||||||||||||||||||||||
| 6685 | (unless the associated pointer is set to 0); otherwise this | - | ||||||||||||||||||||||||
| 6686 | function returns \c true. The various error messages are described in | - | ||||||||||||||||||||||||
| 6687 | the QXmlParseException class documentation. Note that, if you | - | ||||||||||||||||||||||||
| 6688 | want to display these error messages to your application's users, | - | ||||||||||||||||||||||||
| 6689 | they will be displayed in English unless they are explicitly | - | ||||||||||||||||||||||||
| 6690 | translated. | - | ||||||||||||||||||||||||
| 6691 | - | |||||||||||||||||||||||||
| 6692 | If \a namespaceProcessing is true, the function QDomNode::prefix() | - | ||||||||||||||||||||||||
| 6693 | returns a string for all elements and attributes. It returns an | - | ||||||||||||||||||||||||
| 6694 | empty string if the element or attribute has no prefix. | - | ||||||||||||||||||||||||
| 6695 | - | |||||||||||||||||||||||||
| 6696 | Text nodes consisting only of whitespace are stripped and won't | - | ||||||||||||||||||||||||
| 6697 | appear in the QDomDocument. If this behavior is not desired, | - | ||||||||||||||||||||||||
| 6698 | one can use the setContent() overload that allows a QXmlReader to be | - | ||||||||||||||||||||||||
| 6699 | supplied. | - | ||||||||||||||||||||||||
| 6700 | - | |||||||||||||||||||||||||
| 6701 | If \a namespaceProcessing is false, the functions | - | ||||||||||||||||||||||||
| 6702 | QDomNode::prefix(), QDomNode::localName() and | - | ||||||||||||||||||||||||
| 6703 | QDomNode::namespaceURI() return an empty string. | - | ||||||||||||||||||||||||
| 6704 | - | |||||||||||||||||||||||||
| 6705 | Entity references are handled as follows: | - | ||||||||||||||||||||||||
| 6706 | \list | - | ||||||||||||||||||||||||
| 6707 | \li References to internal general entities and character entities occurring in the | - | ||||||||||||||||||||||||
| 6708 | content are included. The result is a QDomText node with the references replaced | - | ||||||||||||||||||||||||
| 6709 | by their corresponding entity values. | - | ||||||||||||||||||||||||
| 6710 | \li References to parameter entities occurring in the internal subset are included. | - | ||||||||||||||||||||||||
| 6711 | The result is a QDomDocumentType node which contains entity and notation declarations | - | ||||||||||||||||||||||||
| 6712 | with the references replaced by their corresponding entity values. | - | ||||||||||||||||||||||||
| 6713 | \li Any general parsed entity reference which is not defined in the internal subset and | - | ||||||||||||||||||||||||
| 6714 | which occurs in the content is represented as a QDomEntityReference node. | - | ||||||||||||||||||||||||
| 6715 | \li Any parsed entity reference which is not defined in the internal subset and which | - | ||||||||||||||||||||||||
| 6716 | occurs outside of the content is replaced with an empty string. | - | ||||||||||||||||||||||||
| 6717 | \li Any unparsed entity reference is replaced with an empty string. | - | ||||||||||||||||||||||||
| 6718 | \endlist | - | ||||||||||||||||||||||||
| 6719 | - | |||||||||||||||||||||||||
| 6720 | \sa QDomNode::namespaceURI(), QDomNode::localName(), | - | ||||||||||||||||||||||||
| 6721 | QDomNode::prefix(), QString::isNull(), QString::isEmpty() | - | ||||||||||||||||||||||||
| 6722 | */ | - | ||||||||||||||||||||||||
| 6723 | bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6724 | { | - | ||||||||||||||||||||||||
| 6725 | if (!impl)
| 1-2 | ||||||||||||||||||||||||
| 6726 | impl = new QDomDocumentPrivate(); executed 1 time by 1 test: impl = new QDomDocumentPrivate();Executed by:
| 1 | ||||||||||||||||||||||||
| 6727 | QBuffer buf; | - | ||||||||||||||||||||||||
| 6728 | buf.setData(data); | - | ||||||||||||||||||||||||
| 6729 | QXmlInputSource source(&buf); | - | ||||||||||||||||||||||||
| 6730 | return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); executed 3 times by 2 tests: return ((QDomDocumentPrivate*)impl)->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);Executed by:
| 3 | ||||||||||||||||||||||||
| 6731 | } | - | ||||||||||||||||||||||||
| 6732 | - | |||||||||||||||||||||||||
| 6733 | /*! | - | ||||||||||||||||||||||||
| 6734 | \overload | - | ||||||||||||||||||||||||
| 6735 | - | |||||||||||||||||||||||||
| 6736 | This function reads the XML document from the IO device \a dev, returning | - | ||||||||||||||||||||||||
| 6737 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6738 | */ | - | ||||||||||||||||||||||||
| 6739 | bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6740 | { | - | ||||||||||||||||||||||||
| 6741 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6742 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6743 | QXmlInputSource source(dev); | - | ||||||||||||||||||||||||
| 6744 | return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6745 | } | - | ||||||||||||||||||||||||
| 6746 | - | |||||||||||||||||||||||||
| 6747 | /*! | - | ||||||||||||||||||||||||
| 6748 | \overload | - | ||||||||||||||||||||||||
| 6749 | \since 4.5 | - | ||||||||||||||||||||||||
| 6750 | - | |||||||||||||||||||||||||
| 6751 | This function reads the XML document from the QXmlInputSource \a source, | - | ||||||||||||||||||||||||
| 6752 | returning true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6753 | - | |||||||||||||||||||||||||
| 6754 | */ | - | ||||||||||||||||||||||||
| 6755 | bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6756 | { | - | ||||||||||||||||||||||||
| 6757 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6758 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6759 | QXmlSimpleReader reader; | - | ||||||||||||||||||||||||
| 6760 | initializeReader(reader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6761 | return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6762 | } | - | ||||||||||||||||||||||||
| 6763 | - | |||||||||||||||||||||||||
| 6764 | /*! | - | ||||||||||||||||||||||||
| 6765 | \overload | - | ||||||||||||||||||||||||
| 6766 | - | |||||||||||||||||||||||||
| 6767 | This function reads the XML document from the string \a text, returning | - | ||||||||||||||||||||||||
| 6768 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6769 | Since \a text is already a Unicode string, no encoding detection | - | ||||||||||||||||||||||||
| 6770 | is performed. | - | ||||||||||||||||||||||||
| 6771 | - | |||||||||||||||||||||||||
| 6772 | No namespace processing is performed either. | - | ||||||||||||||||||||||||
| 6773 | */ | - | ||||||||||||||||||||||||
| 6774 | bool QDomDocument::setContent(const QString& text, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6775 | { | - | ||||||||||||||||||||||||
| 6776 | return setContent(text, false, errorMsg, errorLine, errorColumn); executed 241 times by 3 tests: return setContent(text, false, errorMsg, errorLine, errorColumn);Executed by:
| 241 | ||||||||||||||||||||||||
| 6777 | } | - | ||||||||||||||||||||||||
| 6778 | - | |||||||||||||||||||||||||
| 6779 | /*! | - | ||||||||||||||||||||||||
| 6780 | \overload | - | ||||||||||||||||||||||||
| 6781 | - | |||||||||||||||||||||||||
| 6782 | This function reads the XML document from the byte array \a buffer, | - | ||||||||||||||||||||||||
| 6783 | returning true if the content was successfully parsed; otherwise returns | - | ||||||||||||||||||||||||
| 6784 | false. | - | ||||||||||||||||||||||||
| 6785 | - | |||||||||||||||||||||||||
| 6786 | No namespace processing is performed. | - | ||||||||||||||||||||||||
| 6787 | */ | - | ||||||||||||||||||||||||
| 6788 | bool QDomDocument::setContent(const QByteArray& buffer, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6789 | { | - | ||||||||||||||||||||||||
| 6790 | return setContent(buffer, false, errorMsg, errorLine, errorColumn); executed 1 time by 1 test: return setContent(buffer, false, errorMsg, errorLine, errorColumn);Executed by:
| 1 | ||||||||||||||||||||||||
| 6791 | } | - | ||||||||||||||||||||||||
| 6792 | - | |||||||||||||||||||||||||
| 6793 | /*! | - | ||||||||||||||||||||||||
| 6794 | \overload | - | ||||||||||||||||||||||||
| 6795 | - | |||||||||||||||||||||||||
| 6796 | This function reads the XML document from the IO device \a dev, returning | - | ||||||||||||||||||||||||
| 6797 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6798 | - | |||||||||||||||||||||||||
| 6799 | No namespace processing is performed. | - | ||||||||||||||||||||||||
| 6800 | */ | - | ||||||||||||||||||||||||
| 6801 | bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6802 | { | - | ||||||||||||||||||||||||
| 6803 | return setContent(dev, false, errorMsg, errorLine, errorColumn); never executed: return setContent(dev, false, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6804 | } | - | ||||||||||||||||||||||||
| 6805 | - | |||||||||||||||||||||||||
| 6806 | /*! | - | ||||||||||||||||||||||||
| 6807 | \overload | - | ||||||||||||||||||||||||
| 6808 | - | |||||||||||||||||||||||||
| 6809 | This function reads the XML document from the QXmlInputSource \a source and | - | ||||||||||||||||||||||||
| 6810 | parses it with the QXmlReader \a reader, returning true if the content was | - | ||||||||||||||||||||||||
| 6811 | successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6812 | - | |||||||||||||||||||||||||
| 6813 | This function doesn't change the features of the \a reader. If you want to | - | ||||||||||||||||||||||||
| 6814 | use certain features for parsing you can use this function to set up the | - | ||||||||||||||||||||||||
| 6815 | reader appropriately. | - | ||||||||||||||||||||||||
| 6816 | - | |||||||||||||||||||||||||
| 6817 | \sa QXmlSimpleReader | - | ||||||||||||||||||||||||
| 6818 | */ | - | ||||||||||||||||||||||||
| 6819 | bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6820 | { | - | ||||||||||||||||||||||||
| 6821 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6822 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6823 | return IMPL->setContent(source, reader, 0, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(source, reader, 0, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6824 | } | - | ||||||||||||||||||||||||
| 6825 | - | |||||||||||||||||||||||||
| 6826 | /*! | - | ||||||||||||||||||||||||
| 6827 | Converts the parsed document back to its textual representation. | - | ||||||||||||||||||||||||
| 6828 | - | |||||||||||||||||||||||||
| 6829 | This function uses \a indent as the amount of space to indent | - | ||||||||||||||||||||||||
| 6830 | subelements. | - | ||||||||||||||||||||||||
| 6831 | - | |||||||||||||||||||||||||
| 6832 | If \a indent is -1, no whitespace at all is added. | - | ||||||||||||||||||||||||
| 6833 | */ | - | ||||||||||||||||||||||||
| 6834 | QString QDomDocument::toString(int indent) const | - | ||||||||||||||||||||||||
| 6835 | { | - | ||||||||||||||||||||||||
| 6836 | QString str; | - | ||||||||||||||||||||||||
| 6837 | QTextStream s(&str, QIODevice::WriteOnly); | - | ||||||||||||||||||||||||
| 6838 | save(s, indent); | - | ||||||||||||||||||||||||
| 6839 | return str; executed 86 times by 2 tests: return str;Executed by:
| 86 | ||||||||||||||||||||||||
| 6840 | } | - | ||||||||||||||||||||||||
| 6841 | - | |||||||||||||||||||||||||
| 6842 | /*! | - | ||||||||||||||||||||||||
| 6843 | Converts the parsed document back to its textual representation | - | ||||||||||||||||||||||||
| 6844 | and returns a QByteArray containing the data encoded as UTF-8. | - | ||||||||||||||||||||||||
| 6845 | - | |||||||||||||||||||||||||
| 6846 | This function uses \a indent as the amount of space to indent | - | ||||||||||||||||||||||||
| 6847 | subelements. | - | ||||||||||||||||||||||||
| 6848 | - | |||||||||||||||||||||||||
| 6849 | \sa toString() | - | ||||||||||||||||||||||||
| 6850 | */ | - | ||||||||||||||||||||||||
| 6851 | QByteArray QDomDocument::toByteArray(int indent) const | - | ||||||||||||||||||||||||
| 6852 | { | - | ||||||||||||||||||||||||
| 6853 | // ### if there is an encoding specified in the xml declaration, this | - | ||||||||||||||||||||||||
| 6854 | // encoding declaration should be changed to utf8 | - | ||||||||||||||||||||||||
| 6855 | return toString(indent).toUtf8(); executed 2 times by 1 test: return toString(indent).toUtf8();Executed by:
| 2 | ||||||||||||||||||||||||
| 6856 | } | - | ||||||||||||||||||||||||
| 6857 | - | |||||||||||||||||||||||||
| 6858 | - | |||||||||||||||||||||||||
| 6859 | /*! | - | ||||||||||||||||||||||||
| 6860 | Returns the document type of this document. | - | ||||||||||||||||||||||||
| 6861 | */ | - | ||||||||||||||||||||||||
| 6862 | QDomDocumentType QDomDocument::doctype() const | - | ||||||||||||||||||||||||
| 6863 | { | - | ||||||||||||||||||||||||
| 6864 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6865 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 6866 | return QDomDocumentType(IMPL->doctype()); never executed: return QDomDocumentType(((QDomDocumentPrivate*)impl)->doctype()); | 0 | ||||||||||||||||||||||||
| 6867 | } | - | ||||||||||||||||||||||||
| 6868 | - | |||||||||||||||||||||||||
| 6869 | /*! | - | ||||||||||||||||||||||||
| 6870 | Returns a QDomImplementation object. | - | ||||||||||||||||||||||||
| 6871 | */ | - | ||||||||||||||||||||||||
| 6872 | QDomImplementation QDomDocument::implementation() const | - | ||||||||||||||||||||||||
| 6873 | { | - | ||||||||||||||||||||||||
| 6874 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6875 | return QDomImplementation(); never executed: return QDomImplementation(); | 0 | ||||||||||||||||||||||||
| 6876 | return QDomImplementation(IMPL->implementation()); never executed: return QDomImplementation(((QDomDocumentPrivate*)impl)->implementation()); | 0 | ||||||||||||||||||||||||
| 6877 | } | - | ||||||||||||||||||||||||
| 6878 | - | |||||||||||||||||||||||||
| 6879 | /*! | - | ||||||||||||||||||||||||
| 6880 | Returns the root element of the document. | - | ||||||||||||||||||||||||
| 6881 | */ | - | ||||||||||||||||||||||||
| 6882 | QDomElement QDomDocument::documentElement() const | - | ||||||||||||||||||||||||
| 6883 | { | - | ||||||||||||||||||||||||
| 6884 | if (!impl)
| 0-97 | ||||||||||||||||||||||||
| 6885 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 6886 | return QDomElement(IMPL->documentElement()); executed 97 times by 1 test: return QDomElement(((QDomDocumentPrivate*)impl)->documentElement());Executed by:
| 97 | ||||||||||||||||||||||||
| 6887 | } | - | ||||||||||||||||||||||||
| 6888 | - | |||||||||||||||||||||||||
| 6889 | /*! | - | ||||||||||||||||||||||||
| 6890 | Creates a new element called \a tagName that can be inserted into | - | ||||||||||||||||||||||||
| 6891 | the DOM tree, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6892 | - | |||||||||||||||||||||||||
| 6893 | If \a tagName is not a valid XML name, the behavior of this function is governed | - | ||||||||||||||||||||||||
| 6894 | by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6895 | - | |||||||||||||||||||||||||
| 6896 | \sa createElementNS(), QDomNode::appendChild(), QDomNode::insertBefore(), | - | ||||||||||||||||||||||||
| 6897 | QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6898 | */ | - | ||||||||||||||||||||||||
| 6899 | QDomElement QDomDocument::createElement(const QString& tagName) | - | ||||||||||||||||||||||||
| 6900 | { | - | ||||||||||||||||||||||||
| 6901 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6902 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6903 | return QDomElement(IMPL->createElement(tagName)); never executed: return QDomElement(((QDomDocumentPrivate*)impl)->createElement(tagName)); | 0 | ||||||||||||||||||||||||
| 6904 | } | - | ||||||||||||||||||||||||
| 6905 | - | |||||||||||||||||||||||||
| 6906 | /*! | - | ||||||||||||||||||||||||
| 6907 | Creates a new document fragment, that can be used to hold parts of | - | ||||||||||||||||||||||||
| 6908 | the document, e.g. when doing complex manipulations of the | - | ||||||||||||||||||||||||
| 6909 | document tree. | - | ||||||||||||||||||||||||
| 6910 | */ | - | ||||||||||||||||||||||||
| 6911 | QDomDocumentFragment QDomDocument::createDocumentFragment() | - | ||||||||||||||||||||||||
| 6912 | { | - | ||||||||||||||||||||||||
| 6913 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6914 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6915 | return QDomDocumentFragment(IMPL->createDocumentFragment()); never executed: return QDomDocumentFragment(((QDomDocumentPrivate*)impl)->createDocumentFragment()); | 0 | ||||||||||||||||||||||||
| 6916 | } | - | ||||||||||||||||||||||||
| 6917 | - | |||||||||||||||||||||||||
| 6918 | /*! | - | ||||||||||||||||||||||||
| 6919 | Creates a text node for the string \a value that can be inserted | - | ||||||||||||||||||||||||
| 6920 | into the document tree, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6921 | - | |||||||||||||||||||||||||
| 6922 | If \a value contains characters which cannot be stored as character | - | ||||||||||||||||||||||||
| 6923 | data of an XML document (even in the form of character references), the | - | ||||||||||||||||||||||||
| 6924 | behavior of this function is governed by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6925 | - | |||||||||||||||||||||||||
| 6926 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6927 | */ | - | ||||||||||||||||||||||||
| 6928 | QDomText QDomDocument::createTextNode(const QString& value) | - | ||||||||||||||||||||||||
| 6929 | { | - | ||||||||||||||||||||||||
| 6930 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6931 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6932 | return QDomText(IMPL->createTextNode(value)); never executed: return QDomText(((QDomDocumentPrivate*)impl)->createTextNode(value)); | 0 | ||||||||||||||||||||||||
| 6933 | } | - | ||||||||||||||||||||||||
| 6934 | - | |||||||||||||||||||||||||
| 6935 | /*! | - | ||||||||||||||||||||||||
| 6936 | Creates a new comment for the string \a value that can be inserted | - | ||||||||||||||||||||||||
| 6937 | into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6938 | - | |||||||||||||||||||||||||
| 6939 | If \a value contains characters which cannot be stored in an XML comment, | - | ||||||||||||||||||||||||
| 6940 | the behavior of this function is governed by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6941 | - | |||||||||||||||||||||||||
| 6942 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6943 | */ | - | ||||||||||||||||||||||||
| 6944 | QDomComment QDomDocument::createComment(const QString& value) | - | ||||||||||||||||||||||||
| 6945 | { | - | ||||||||||||||||||||||||
| 6946 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6947 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6948 | return QDomComment(IMPL->createComment(value)); never executed: return QDomComment(((QDomDocumentPrivate*)impl)->createComment(value)); | 0 | ||||||||||||||||||||||||
| 6949 | } | - | ||||||||||||||||||||||||
| 6950 | - | |||||||||||||||||||||||||
| 6951 | /*! | - | ||||||||||||||||||||||||
| 6952 | Creates a new CDATA section for the string \a value that can be | - | ||||||||||||||||||||||||
| 6953 | inserted into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6954 | - | |||||||||||||||||||||||||
| 6955 | If \a value contains characters which cannot be stored in a CDATA section, | - | ||||||||||||||||||||||||
| 6956 | the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6957 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6958 | - | |||||||||||||||||||||||||
| 6959 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6960 | */ | - | ||||||||||||||||||||||||
| 6961 | QDomCDATASection QDomDocument::createCDATASection(const QString& value) | - | ||||||||||||||||||||||||
| 6962 | { | - | ||||||||||||||||||||||||
| 6963 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6964 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6965 | return QDomCDATASection(IMPL->createCDATASection(value)); never executed: return QDomCDATASection(((QDomDocumentPrivate*)impl)->createCDATASection(value)); | 0 | ||||||||||||||||||||||||
| 6966 | } | - | ||||||||||||||||||||||||
| 6967 | - | |||||||||||||||||||||||||
| 6968 | /*! | - | ||||||||||||||||||||||||
| 6969 | Creates a new processing instruction that can be inserted into the | - | ||||||||||||||||||||||||
| 6970 | document, e.g. using QDomNode::appendChild(). This function sets | - | ||||||||||||||||||||||||
| 6971 | the target for the processing instruction to \a target and the | - | ||||||||||||||||||||||||
| 6972 | data to \a data. | - | ||||||||||||||||||||||||
| 6973 | - | |||||||||||||||||||||||||
| 6974 | If \a target is not a valid XML name, or data if contains characters which cannot | - | ||||||||||||||||||||||||
| 6975 | appear in a processing instruction, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6976 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6977 | - | |||||||||||||||||||||||||
| 6978 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6979 | */ | - | ||||||||||||||||||||||||
| 6980 | QDomProcessingInstruction QDomDocument::createProcessingInstruction(const QString& target, | - | ||||||||||||||||||||||||
| 6981 | const QString& data) | - | ||||||||||||||||||||||||
| 6982 | { | - | ||||||||||||||||||||||||
| 6983 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6984 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6985 | return QDomProcessingInstruction(IMPL->createProcessingInstruction(target, data)); never executed: return QDomProcessingInstruction(((QDomDocumentPrivate*)impl)->createProcessingInstruction(target, data)); | 0 | ||||||||||||||||||||||||
| 6986 | } | - | ||||||||||||||||||||||||
| 6987 | - | |||||||||||||||||||||||||
| 6988 | - | |||||||||||||||||||||||||
| 6989 | /*! | - | ||||||||||||||||||||||||
| 6990 | Creates a new attribute called \a name that can be inserted into | - | ||||||||||||||||||||||||
| 6991 | an element, e.g. using QDomElement::setAttributeNode(). | - | ||||||||||||||||||||||||
| 6992 | - | |||||||||||||||||||||||||
| 6993 | If \a name is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6994 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6995 | - | |||||||||||||||||||||||||
| 6996 | \sa createAttributeNS() | - | ||||||||||||||||||||||||
| 6997 | */ | - | ||||||||||||||||||||||||
| 6998 | QDomAttr QDomDocument::createAttribute(const QString& name) | - | ||||||||||||||||||||||||
| 6999 | { | - | ||||||||||||||||||||||||
| 7000 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7001 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7002 | return QDomAttr(IMPL->createAttribute(name)); never executed: return QDomAttr(((QDomDocumentPrivate*)impl)->createAttribute(name)); | 0 | ||||||||||||||||||||||||
| 7003 | } | - | ||||||||||||||||||||||||
| 7004 | - | |||||||||||||||||||||||||
| 7005 | /*! | - | ||||||||||||||||||||||||
| 7006 | Creates a new entity reference called \a name that can be inserted | - | ||||||||||||||||||||||||
| 7007 | into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 7008 | - | |||||||||||||||||||||||||
| 7009 | If \a name is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 7010 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 7011 | - | |||||||||||||||||||||||||
| 7012 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 7013 | */ | - | ||||||||||||||||||||||||
| 7014 | QDomEntityReference QDomDocument::createEntityReference(const QString& name) | - | ||||||||||||||||||||||||
| 7015 | { | - | ||||||||||||||||||||||||
| 7016 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7017 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7018 | return QDomEntityReference(IMPL->createEntityReference(name)); never executed: return QDomEntityReference(((QDomDocumentPrivate*)impl)->createEntityReference(name)); | 0 | ||||||||||||||||||||||||
| 7019 | } | - | ||||||||||||||||||||||||
| 7020 | - | |||||||||||||||||||||||||
| 7021 | /*! | - | ||||||||||||||||||||||||
| 7022 | Returns a QDomNodeList, that contains all the elements in the | - | ||||||||||||||||||||||||
| 7023 | document with the name \a tagname. The order of the node list is | - | ||||||||||||||||||||||||
| 7024 | the order they are encountered in a preorder traversal of the | - | ||||||||||||||||||||||||
| 7025 | element tree. | - | ||||||||||||||||||||||||
| 7026 | - | |||||||||||||||||||||||||
| 7027 | \sa elementsByTagNameNS(), QDomElement::elementsByTagName() | - | ||||||||||||||||||||||||
| 7028 | */ | - | ||||||||||||||||||||||||
| 7029 | QDomNodeList QDomDocument::elementsByTagName(const QString& tagname) const | - | ||||||||||||||||||||||||
| 7030 | { | - | ||||||||||||||||||||||||
| 7031 | return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); | 0 | ||||||||||||||||||||||||
| 7032 | } | - | ||||||||||||||||||||||||
| 7033 | - | |||||||||||||||||||||||||
| 7034 | /*! | - | ||||||||||||||||||||||||
| 7035 | Imports the node \a importedNode from another document to this | - | ||||||||||||||||||||||||
| 7036 | document. \a importedNode remains in the original document; this | - | ||||||||||||||||||||||||
| 7037 | function creates a copy that can be used within this document. | - | ||||||||||||||||||||||||
| 7038 | - | |||||||||||||||||||||||||
| 7039 | This function returns the imported node that belongs to this | - | ||||||||||||||||||||||||
| 7040 | document. The returned node has no parent. It is not possible to | - | ||||||||||||||||||||||||
| 7041 | import QDomDocument and QDomDocumentType nodes. In those cases | - | ||||||||||||||||||||||||
| 7042 | this function returns a \l{QDomNode::isNull()}{null node}. | - | ||||||||||||||||||||||||
| 7043 | - | |||||||||||||||||||||||||
| 7044 | If \a importedNode is a \l{QDomNode::isNull()}{null node}, | - | ||||||||||||||||||||||||
| 7045 | a null node is returned. | - | ||||||||||||||||||||||||
| 7046 | - | |||||||||||||||||||||||||
| 7047 | If \a deep is true, this function imports not only the node \a | - | ||||||||||||||||||||||||
| 7048 | importedNode but its whole subtree; if it is false, only the \a | - | ||||||||||||||||||||||||
| 7049 | importedNode is imported. The argument \a deep has no effect on | - | ||||||||||||||||||||||||
| 7050 | QDomAttr and QDomEntityReference nodes, since the descendants of | - | ||||||||||||||||||||||||
| 7051 | QDomAttr nodes are always imported and those of | - | ||||||||||||||||||||||||
| 7052 | QDomEntityReference nodes are never imported. | - | ||||||||||||||||||||||||
| 7053 | - | |||||||||||||||||||||||||
| 7054 | The behavior of this function is slightly different depending on | - | ||||||||||||||||||||||||
| 7055 | the node types: | - | ||||||||||||||||||||||||
| 7056 | \table | - | ||||||||||||||||||||||||
| 7057 | \header \li Node Type \li Behavior | - | ||||||||||||||||||||||||
| 7058 | \row \li QDomAttr | - | ||||||||||||||||||||||||
| 7059 | \li The owner element is set to 0 and the specified flag is | - | ||||||||||||||||||||||||
| 7060 | set to true in the generated attribute. The whole subtree | - | ||||||||||||||||||||||||
| 7061 | of \a importedNode is always imported for attribute nodes: | - | ||||||||||||||||||||||||
| 7062 | \a deep has no effect. | - | ||||||||||||||||||||||||
| 7063 | \row \li QDomDocument | - | ||||||||||||||||||||||||
| 7064 | \li Document nodes cannot be imported. | - | ||||||||||||||||||||||||
| 7065 | \row \li QDomDocumentFragment | - | ||||||||||||||||||||||||
| 7066 | \li If \a deep is true, this function imports the whole | - | ||||||||||||||||||||||||
| 7067 | document fragment; otherwise it only generates an empty | - | ||||||||||||||||||||||||
| 7068 | document fragment. | - | ||||||||||||||||||||||||
| 7069 | \row \li QDomDocumentType | - | ||||||||||||||||||||||||
| 7070 | \li Document type nodes cannot be imported. | - | ||||||||||||||||||||||||
| 7071 | \row \li QDomElement | - | ||||||||||||||||||||||||
| 7072 | \li Attributes for which QDomAttr::specified() is true are | - | ||||||||||||||||||||||||
| 7073 | also imported, other attributes are not imported. If \a | - | ||||||||||||||||||||||||
| 7074 | deep is true, this function also imports the subtree of \a | - | ||||||||||||||||||||||||
| 7075 | importedNode; otherwise it imports only the element node | - | ||||||||||||||||||||||||
| 7076 | (and some attributes, see above). | - | ||||||||||||||||||||||||
| 7077 | \row \li QDomEntity | - | ||||||||||||||||||||||||
| 7078 | \li Entity nodes can be imported, but at the moment there is | - | ||||||||||||||||||||||||
| 7079 | no way to use them since the document type is read-only in | - | ||||||||||||||||||||||||
| 7080 | DOM level 2. | - | ||||||||||||||||||||||||
| 7081 | \row \li QDomEntityReference | - | ||||||||||||||||||||||||
| 7082 | \li Descendants of entity reference nodes are never imported: | - | ||||||||||||||||||||||||
| 7083 | \a deep has no effect. | - | ||||||||||||||||||||||||
| 7084 | \row \li QDomNotation | - | ||||||||||||||||||||||||
| 7085 | \li Notation nodes can be imported, but at the moment there is | - | ||||||||||||||||||||||||
| 7086 | no way to use them since the document type is read-only in | - | ||||||||||||||||||||||||
| 7087 | DOM level 2. | - | ||||||||||||||||||||||||
| 7088 | \row \li QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 7089 | \li The target and value of the processing instruction is | - | ||||||||||||||||||||||||
| 7090 | copied to the new node. | - | ||||||||||||||||||||||||
| 7091 | \row \li QDomText | - | ||||||||||||||||||||||||
| 7092 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7093 | \row \li QDomCDATASection | - | ||||||||||||||||||||||||
| 7094 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7095 | \row \li QDomComment | - | ||||||||||||||||||||||||
| 7096 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7097 | \endtable | - | ||||||||||||||||||||||||
| 7098 | - | |||||||||||||||||||||||||
| 7099 | \sa QDomElement::setAttribute(), QDomNode::insertBefore(), | - | ||||||||||||||||||||||||
| 7100 | QDomNode::insertAfter(), QDomNode::replaceChild(), QDomNode::removeChild(), | - | ||||||||||||||||||||||||
| 7101 | QDomNode::appendChild() | - | ||||||||||||||||||||||||
| 7102 | */ | - | ||||||||||||||||||||||||
| 7103 | QDomNode QDomDocument::importNode(const QDomNode& importedNode, bool deep) | - | ||||||||||||||||||||||||
| 7104 | { | - | ||||||||||||||||||||||||
| 7105 | if (importedNode.isNull())
| 0 | ||||||||||||||||||||||||
| 7106 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 7107 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7108 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7109 | return QDomNode(IMPL->importNode(importedNode.impl, deep)); never executed: return QDomNode(((QDomDocumentPrivate*)impl)->importNode(importedNode.impl, deep)); | 0 | ||||||||||||||||||||||||
| 7110 | } | - | ||||||||||||||||||||||||
| 7111 | - | |||||||||||||||||||||||||
| 7112 | /*! | - | ||||||||||||||||||||||||
| 7113 | Creates a new element with namespace support that can be inserted | - | ||||||||||||||||||||||||
| 7114 | into the DOM tree. The name of the element is \a qName and the | - | ||||||||||||||||||||||||
| 7115 | namespace URI is \a nsURI. This function also sets | - | ||||||||||||||||||||||||
| 7116 | QDomNode::prefix() and QDomNode::localName() to appropriate values | - | ||||||||||||||||||||||||
| 7117 | (depending on \a qName). | - | ||||||||||||||||||||||||
| 7118 | - | |||||||||||||||||||||||||
| 7119 | If \a qName is an empty string, returns a null element regardless of | - | ||||||||||||||||||||||||
| 7120 | whether the invalid data policy is set. | - | ||||||||||||||||||||||||
| 7121 | - | |||||||||||||||||||||||||
| 7122 | \sa createElement() | - | ||||||||||||||||||||||||
| 7123 | */ | - | ||||||||||||||||||||||||
| 7124 | QDomElement QDomDocument::createElementNS(const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 7125 | { | - | ||||||||||||||||||||||||
| 7126 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7127 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7128 | return QDomElement(IMPL->createElementNS(nsURI, qName)); never executed: return QDomElement(((QDomDocumentPrivate*)impl)->createElementNS(nsURI, qName)); | 0 | ||||||||||||||||||||||||
| 7129 | } | - | ||||||||||||||||||||||||
| 7130 | - | |||||||||||||||||||||||||
| 7131 | /*! | - | ||||||||||||||||||||||||
| 7132 | Creates a new attribute with namespace support that can be | - | ||||||||||||||||||||||||
| 7133 | inserted into an element. The name of the attribute is \a qName | - | ||||||||||||||||||||||||
| 7134 | and the namespace URI is \a nsURI. This function also sets | - | ||||||||||||||||||||||||
| 7135 | QDomNode::prefix() and QDomNode::localName() to appropriate values | - | ||||||||||||||||||||||||
| 7136 | (depending on \a qName). | - | ||||||||||||||||||||||||
| 7137 | - | |||||||||||||||||||||||||
| 7138 | If \a qName is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 7139 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 7140 | - | |||||||||||||||||||||||||
| 7141 | \sa createAttribute() | - | ||||||||||||||||||||||||
| 7142 | */ | - | ||||||||||||||||||||||||
| 7143 | QDomAttr QDomDocument::createAttributeNS(const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 7144 | { | - | ||||||||||||||||||||||||
| 7145 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7146 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7147 | return QDomAttr(IMPL->createAttributeNS(nsURI, qName)); never executed: return QDomAttr(((QDomDocumentPrivate*)impl)->createAttributeNS(nsURI, qName)); | 0 | ||||||||||||||||||||||||
| 7148 | } | - | ||||||||||||||||||||||||
| 7149 | - | |||||||||||||||||||||||||
| 7150 | /*! | - | ||||||||||||||||||||||||
| 7151 | Returns a QDomNodeList that contains all the elements in the | - | ||||||||||||||||||||||||
| 7152 | document with the local name \a localName and a namespace URI of | - | ||||||||||||||||||||||||
| 7153 | \a nsURI. The order of the node list is the order they are | - | ||||||||||||||||||||||||
| 7154 | encountered in a preorder traversal of the element tree. | - | ||||||||||||||||||||||||
| 7155 | - | |||||||||||||||||||||||||
| 7156 | \sa elementsByTagName(), QDomElement::elementsByTagNameNS() | - | ||||||||||||||||||||||||
| 7157 | */ | - | ||||||||||||||||||||||||
| 7158 | QDomNodeList QDomDocument::elementsByTagNameNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 7159 | { | - | ||||||||||||||||||||||||
| 7160 | return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 7161 | } | - | ||||||||||||||||||||||||
| 7162 | - | |||||||||||||||||||||||||
| 7163 | /*! | - | ||||||||||||||||||||||||
| 7164 | Returns the element whose ID is equal to \a elementId. If no | - | ||||||||||||||||||||||||
| 7165 | element with the ID was found, this function returns a | - | ||||||||||||||||||||||||
| 7166 | \l{QDomNode::isNull()}{null element}. | - | ||||||||||||||||||||||||
| 7167 | - | |||||||||||||||||||||||||
| 7168 | Since the QDomClasses do not know which attributes are element | - | ||||||||||||||||||||||||
| 7169 | IDs, this function returns always a | - | ||||||||||||||||||||||||
| 7170 | \l{QDomNode::isNull()}{null element}. | - | ||||||||||||||||||||||||
| 7171 | This may change in a future version. | - | ||||||||||||||||||||||||
| 7172 | */ | - | ||||||||||||||||||||||||
| 7173 | QDomElement QDomDocument::elementById(const QString& /*elementId*/) | - | ||||||||||||||||||||||||
| 7174 | { | - | ||||||||||||||||||||||||
| 7175 | qWarning("elementById() is not implemented and will always return a null node."); | - | ||||||||||||||||||||||||
| 7176 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 7177 | } | - | ||||||||||||||||||||||||
| 7178 | - | |||||||||||||||||||||||||
| 7179 | /*! | - | ||||||||||||||||||||||||
| 7180 | \fn QDomNode::NodeType QDomDocument::nodeType() const | - | ||||||||||||||||||||||||
| 7181 | - | |||||||||||||||||||||||||
| 7182 | Returns \c DocumentNode. | - | ||||||||||||||||||||||||
| 7183 | */ | - | ||||||||||||||||||||||||
| 7184 | - | |||||||||||||||||||||||||
| 7185 | #undef IMPL | - | ||||||||||||||||||||||||
| 7186 | - | |||||||||||||||||||||||||
| 7187 | /************************************************************** | - | ||||||||||||||||||||||||
| 7188 | * | - | ||||||||||||||||||||||||
| 7189 | * Node casting functions | - | ||||||||||||||||||||||||
| 7190 | * | - | ||||||||||||||||||||||||
| 7191 | **************************************************************/ | - | ||||||||||||||||||||||||
| 7192 | - | |||||||||||||||||||||||||
| 7193 | /*! | - | ||||||||||||||||||||||||
| 7194 | Converts a QDomNode into a QDomAttr. If the node is not an | - | ||||||||||||||||||||||||
| 7195 | attribute, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7196 | - | |||||||||||||||||||||||||
| 7197 | \sa isAttr() | - | ||||||||||||||||||||||||
| 7198 | */ | - | ||||||||||||||||||||||||
| 7199 | QDomAttr QDomNode::toAttr() const | - | ||||||||||||||||||||||||
| 7200 | { | - | ||||||||||||||||||||||||
| 7201 | if (impl && impl->isAttr())
| 0 | ||||||||||||||||||||||||
| 7202 | return QDomAttr(((QDomAttrPrivate*)impl)); never executed: return QDomAttr(((QDomAttrPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7203 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 7204 | } | - | ||||||||||||||||||||||||
| 7205 | - | |||||||||||||||||||||||||
| 7206 | /*! | - | ||||||||||||||||||||||||
| 7207 | Converts a QDomNode into a QDomCDATASection. If the node is not a | - | ||||||||||||||||||||||||
| 7208 | CDATA section, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7209 | - | |||||||||||||||||||||||||
| 7210 | \sa isCDATASection() | - | ||||||||||||||||||||||||
| 7211 | */ | - | ||||||||||||||||||||||||
| 7212 | QDomCDATASection QDomNode::toCDATASection() const | - | ||||||||||||||||||||||||
| 7213 | { | - | ||||||||||||||||||||||||
| 7214 | if (impl && impl->isCDATASection())
| 0 | ||||||||||||||||||||||||
| 7215 | return QDomCDATASection(((QDomCDATASectionPrivate*)impl)); never executed: return QDomCDATASection(((QDomCDATASectionPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7216 | return QDomCDATASection(); never executed: return QDomCDATASection(); | 0 | ||||||||||||||||||||||||
| 7217 | } | - | ||||||||||||||||||||||||
| 7218 | - | |||||||||||||||||||||||||
| 7219 | /*! | - | ||||||||||||||||||||||||
| 7220 | Converts a QDomNode into a QDomDocumentFragment. If the node is | - | ||||||||||||||||||||||||
| 7221 | not a document fragment the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7222 | - | |||||||||||||||||||||||||
| 7223 | \sa isDocumentFragment() | - | ||||||||||||||||||||||||
| 7224 | */ | - | ||||||||||||||||||||||||
| 7225 | QDomDocumentFragment QDomNode::toDocumentFragment() const | - | ||||||||||||||||||||||||
| 7226 | { | - | ||||||||||||||||||||||||
| 7227 | if (impl && impl->isDocumentFragment())
| 0 | ||||||||||||||||||||||||
| 7228 | return QDomDocumentFragment(((QDomDocumentFragmentPrivate*)impl)); never executed: return QDomDocumentFragment(((QDomDocumentFragmentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7229 | return QDomDocumentFragment(); never executed: return QDomDocumentFragment(); | 0 | ||||||||||||||||||||||||
| 7230 | } | - | ||||||||||||||||||||||||
| 7231 | - | |||||||||||||||||||||||||
| 7232 | /*! | - | ||||||||||||||||||||||||
| 7233 | Converts a QDomNode into a QDomDocument. If the node is not a | - | ||||||||||||||||||||||||
| 7234 | document the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7235 | - | |||||||||||||||||||||||||
| 7236 | \sa isDocument() | - | ||||||||||||||||||||||||
| 7237 | */ | - | ||||||||||||||||||||||||
| 7238 | QDomDocument QDomNode::toDocument() const | - | ||||||||||||||||||||||||
| 7239 | { | - | ||||||||||||||||||||||||
| 7240 | if (impl && impl->isDocument())
| 0 | ||||||||||||||||||||||||
| 7241 | return QDomDocument(((QDomDocumentPrivate*)impl)); never executed: return QDomDocument(((QDomDocumentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7242 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 7243 | } | - | ||||||||||||||||||||||||
| 7244 | - | |||||||||||||||||||||||||
| 7245 | /*! | - | ||||||||||||||||||||||||
| 7246 | Converts a QDomNode into a QDomDocumentType. If the node is not a | - | ||||||||||||||||||||||||
| 7247 | document type the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7248 | - | |||||||||||||||||||||||||
| 7249 | \sa isDocumentType() | - | ||||||||||||||||||||||||
| 7250 | */ | - | ||||||||||||||||||||||||
| 7251 | QDomDocumentType QDomNode::toDocumentType() const | - | ||||||||||||||||||||||||
| 7252 | { | - | ||||||||||||||||||||||||
| 7253 | if (impl && impl->isDocumentType())
| 0 | ||||||||||||||||||||||||
| 7254 | return QDomDocumentType(((QDomDocumentTypePrivate*)impl)); never executed: return QDomDocumentType(((QDomDocumentTypePrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7255 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 7256 | } | - | ||||||||||||||||||||||||
| 7257 | - | |||||||||||||||||||||||||
| 7258 | /*! | - | ||||||||||||||||||||||||
| 7259 | Converts a QDomNode into a QDomElement. If the node is not an | - | ||||||||||||||||||||||||
| 7260 | element the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7261 | - | |||||||||||||||||||||||||
| 7262 | \sa isElement() | - | ||||||||||||||||||||||||
| 7263 | */ | - | ||||||||||||||||||||||||
| 7264 | QDomElement QDomNode::toElement() const | - | ||||||||||||||||||||||||
| 7265 | { | - | ||||||||||||||||||||||||
| 7266 | if (impl && impl->isElement())
| 0-162 | ||||||||||||||||||||||||
| 7267 | return QDomElement(((QDomElementPrivate*)impl)); executed 159 times by 1 test: return QDomElement(((QDomElementPrivate*)impl));Executed by:
| 159 | ||||||||||||||||||||||||
| 7268 | return QDomElement(); executed 3 times by 1 test: return QDomElement();Executed by:
| 3 | ||||||||||||||||||||||||
| 7269 | } | - | ||||||||||||||||||||||||
| 7270 | - | |||||||||||||||||||||||||
| 7271 | /*! | - | ||||||||||||||||||||||||
| 7272 | Converts a QDomNode into a QDomEntityReference. If the node is not | - | ||||||||||||||||||||||||
| 7273 | an entity reference, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7274 | - | |||||||||||||||||||||||||
| 7275 | \sa isEntityReference() | - | ||||||||||||||||||||||||
| 7276 | */ | - | ||||||||||||||||||||||||
| 7277 | QDomEntityReference QDomNode::toEntityReference() const | - | ||||||||||||||||||||||||
| 7278 | { | - | ||||||||||||||||||||||||
| 7279 | if (impl && impl->isEntityReference())
| 0 | ||||||||||||||||||||||||
| 7280 | return QDomEntityReference(((QDomEntityReferencePrivate*)impl)); never executed: return QDomEntityReference(((QDomEntityReferencePrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7281 | return QDomEntityReference(); never executed: return QDomEntityReference(); | 0 | ||||||||||||||||||||||||
| 7282 | } | - | ||||||||||||||||||||||||
| 7283 | - | |||||||||||||||||||||||||
| 7284 | /*! | - | ||||||||||||||||||||||||
| 7285 | Converts a QDomNode into a QDomText. If the node is not a text, | - | ||||||||||||||||||||||||
| 7286 | the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7287 | - | |||||||||||||||||||||||||
| 7288 | \sa isText() | - | ||||||||||||||||||||||||
| 7289 | */ | - | ||||||||||||||||||||||||
| 7290 | QDomText QDomNode::toText() const | - | ||||||||||||||||||||||||
| 7291 | { | - | ||||||||||||||||||||||||
| 7292 | if (impl && impl->isText())
| 0 | ||||||||||||||||||||||||
| 7293 | return QDomText(((QDomTextPrivate*)impl)); never executed: return QDomText(((QDomTextPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7294 | return QDomText(); never executed: return QDomText(); | 0 | ||||||||||||||||||||||||
| 7295 | } | - | ||||||||||||||||||||||||
| 7296 | - | |||||||||||||||||||||||||
| 7297 | /*! | - | ||||||||||||||||||||||||
| 7298 | Converts a QDomNode into a QDomEntity. If the node is not an | - | ||||||||||||||||||||||||
| 7299 | entity the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7300 | - | |||||||||||||||||||||||||
| 7301 | \sa isEntity() | - | ||||||||||||||||||||||||
| 7302 | */ | - | ||||||||||||||||||||||||
| 7303 | QDomEntity QDomNode::toEntity() const | - | ||||||||||||||||||||||||
| 7304 | { | - | ||||||||||||||||||||||||
| 7305 | if (impl && impl->isEntity())
| 0 | ||||||||||||||||||||||||
| 7306 | return QDomEntity(((QDomEntityPrivate*)impl)); never executed: return QDomEntity(((QDomEntityPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7307 | return QDomEntity(); never executed: return QDomEntity(); | 0 | ||||||||||||||||||||||||
| 7308 | } | - | ||||||||||||||||||||||||
| 7309 | - | |||||||||||||||||||||||||
| 7310 | /*! | - | ||||||||||||||||||||||||
| 7311 | Converts a QDomNode into a QDomNotation. If the node is not a | - | ||||||||||||||||||||||||
| 7312 | notation the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7313 | - | |||||||||||||||||||||||||
| 7314 | \sa isNotation() | - | ||||||||||||||||||||||||
| 7315 | */ | - | ||||||||||||||||||||||||
| 7316 | QDomNotation QDomNode::toNotation() const | - | ||||||||||||||||||||||||
| 7317 | { | - | ||||||||||||||||||||||||
| 7318 | if (impl && impl->isNotation())
| 0 | ||||||||||||||||||||||||
| 7319 | return QDomNotation(((QDomNotationPrivate*)impl)); never executed: return QDomNotation(((QDomNotationPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7320 | return QDomNotation(); never executed: return QDomNotation(); | 0 | ||||||||||||||||||||||||
| 7321 | } | - | ||||||||||||||||||||||||
| 7322 | - | |||||||||||||||||||||||||
| 7323 | /*! | - | ||||||||||||||||||||||||
| 7324 | Converts a QDomNode into a QDomProcessingInstruction. If the node | - | ||||||||||||||||||||||||
| 7325 | is not a processing instruction the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7326 | - | |||||||||||||||||||||||||
| 7327 | \sa isProcessingInstruction() | - | ||||||||||||||||||||||||
| 7328 | */ | - | ||||||||||||||||||||||||
| 7329 | QDomProcessingInstruction QDomNode::toProcessingInstruction() const | - | ||||||||||||||||||||||||
| 7330 | { | - | ||||||||||||||||||||||||
| 7331 | if (impl && impl->isProcessingInstruction())
| 0 | ||||||||||||||||||||||||
| 7332 | return QDomProcessingInstruction(((QDomProcessingInstructionPrivate*)impl)); never executed: return QDomProcessingInstruction(((QDomProcessingInstructionPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7333 | return QDomProcessingInstruction(); never executed: return QDomProcessingInstruction(); | 0 | ||||||||||||||||||||||||
| 7334 | } | - | ||||||||||||||||||||||||
| 7335 | - | |||||||||||||||||||||||||
| 7336 | /*! | - | ||||||||||||||||||||||||
| 7337 | Converts a QDomNode into a QDomCharacterData. If the node is not a | - | ||||||||||||||||||||||||
| 7338 | character data node the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7339 | - | |||||||||||||||||||||||||
| 7340 | \sa isCharacterData() | - | ||||||||||||||||||||||||
| 7341 | */ | - | ||||||||||||||||||||||||
| 7342 | QDomCharacterData QDomNode::toCharacterData() const | - | ||||||||||||||||||||||||
| 7343 | { | - | ||||||||||||||||||||||||
| 7344 | if (impl && impl->isCharacterData())
| 0 | ||||||||||||||||||||||||
| 7345 | return QDomCharacterData(((QDomCharacterDataPrivate*)impl)); never executed: return QDomCharacterData(((QDomCharacterDataPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7346 | return QDomCharacterData(); never executed: return QDomCharacterData(); | 0 | ||||||||||||||||||||||||
| 7347 | } | - | ||||||||||||||||||||||||
| 7348 | - | |||||||||||||||||||||||||
| 7349 | /*! | - | ||||||||||||||||||||||||
| 7350 | Converts a QDomNode into a QDomComment. If the node is not a | - | ||||||||||||||||||||||||
| 7351 | comment the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7352 | - | |||||||||||||||||||||||||
| 7353 | \sa isComment() | - | ||||||||||||||||||||||||
| 7354 | */ | - | ||||||||||||||||||||||||
| 7355 | QDomComment QDomNode::toComment() const | - | ||||||||||||||||||||||||
| 7356 | { | - | ||||||||||||||||||||||||
| 7357 | if (impl && impl->isComment())
| 0 | ||||||||||||||||||||||||
| 7358 | return QDomComment(((QDomCommentPrivate*)impl)); never executed: return QDomComment(((QDomCommentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7359 | return QDomComment(); never executed: return QDomComment(); | 0 | ||||||||||||||||||||||||
| 7360 | } | - | ||||||||||||||||||||||||
| 7361 | - | |||||||||||||||||||||||||
| 7362 | /************************************************************** | - | ||||||||||||||||||||||||
| 7363 | * | - | ||||||||||||||||||||||||
| 7364 | * QDomHandler | - | ||||||||||||||||||||||||
| 7365 | * | - | ||||||||||||||||||||||||
| 7366 | **************************************************************/ | - | ||||||||||||||||||||||||
| 7367 | - | |||||||||||||||||||||||||
| 7368 | QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, QXmlSimpleReader* areader, bool namespaceProcessing) | - | ||||||||||||||||||||||||
| 7369 | : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false), | - | ||||||||||||||||||||||||
| 7370 | nsProcessing(namespaceProcessing), locator(0), reader(areader) | - | ||||||||||||||||||||||||
| 7371 | { | - | ||||||||||||||||||||||||
| 7372 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 7373 | - | |||||||||||||||||||||||||
| 7374 | QDomHandler::~QDomHandler() | - | ||||||||||||||||||||||||
| 7375 | { | - | ||||||||||||||||||||||||
| 7376 | } | - | ||||||||||||||||||||||||
| 7377 | - | |||||||||||||||||||||||||
| 7378 | bool QDomHandler::endDocument() | - | ||||||||||||||||||||||||
| 7379 | { | - | ||||||||||||||||||||||||
| 7380 | // ### is this really necessary? (rms) | - | ||||||||||||||||||||||||
| 7381 | if (node != doc)
| 0-244 | ||||||||||||||||||||||||
| 7382 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7383 | return true; executed 244 times by 5 tests: return true;Executed by:
| 244 | ||||||||||||||||||||||||
| 7384 | } | - | ||||||||||||||||||||||||
| 7385 | - | |||||||||||||||||||||||||
| 7386 | bool QDomHandler::startDTD(const QString& name, const QString& publicId, const QString& systemId) | - | ||||||||||||||||||||||||
| 7387 | { | - | ||||||||||||||||||||||||
| 7388 | doc->doctype()->name = name; | - | ||||||||||||||||||||||||
| 7389 | doc->doctype()->publicId = publicId; | - | ||||||||||||||||||||||||
| 7390 | doc->doctype()->systemId = systemId; | - | ||||||||||||||||||||||||
| 7391 | return true; executed 157 times by 2 tests: return true;Executed by:
| 157 | ||||||||||||||||||||||||
| 7392 | } | - | ||||||||||||||||||||||||
| 7393 | - | |||||||||||||||||||||||||
| 7394 | bool QDomHandler::startElement(const QString& nsURI, const QString&, const QString& qName, const QXmlAttributes& atts) | - | ||||||||||||||||||||||||
| 7395 | { | - | ||||||||||||||||||||||||
| 7396 | // tag name | - | ||||||||||||||||||||||||
| 7397 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 7398 | if (nsProcessing) {
| 2-1021 | ||||||||||||||||||||||||
| 7399 | n = doc->createElementNS(nsURI, qName); | - | ||||||||||||||||||||||||
| 7400 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 7401 | n = doc->createElement(qName); | - | ||||||||||||||||||||||||
| 7402 | } executed 1021 times by 4 tests: end of blockExecuted by:
| 1021 | ||||||||||||||||||||||||
| 7403 | - | |||||||||||||||||||||||||
| 7404 | if (!n)
| 0-1023 | ||||||||||||||||||||||||
| 7405 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7406 | - | |||||||||||||||||||||||||
| 7407 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7408 | - | |||||||||||||||||||||||||
| 7409 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7410 | node = n; | - | ||||||||||||||||||||||||
| 7411 | - | |||||||||||||||||||||||||
| 7412 | // attributes | - | ||||||||||||||||||||||||
| 7413 | for (int i=0; i<atts.length(); i++)
| 868-1023 | ||||||||||||||||||||||||
| 7414 | { | - | ||||||||||||||||||||||||
| 7415 | if (nsProcessing) {
| 2-866 | ||||||||||||||||||||||||
| 7416 | ((QDomElementPrivate*)node)->setAttributeNS(atts.uri(i), atts.qName(i), atts.value(i)); | - | ||||||||||||||||||||||||
| 7417 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 7418 | ((QDomElementPrivate*)node)->setAttribute(atts.qName(i), atts.value(i)); | - | ||||||||||||||||||||||||
| 7419 | } executed 866 times by 3 tests: end of blockExecuted by:
| 866 | ||||||||||||||||||||||||
| 7420 | } | - | ||||||||||||||||||||||||
| 7421 | - | |||||||||||||||||||||||||
| 7422 | return true; executed 1023 times by 5 tests: return true;Executed by:
| 1023 | ||||||||||||||||||||||||
| 7423 | } | - | ||||||||||||||||||||||||
| 7424 | - | |||||||||||||||||||||||||
| 7425 | bool QDomHandler::endElement(const QString&, const QString&, const QString&) | - | ||||||||||||||||||||||||
| 7426 | { | - | ||||||||||||||||||||||||
| 7427 | if (!node || node == doc)
| 0-1023 | ||||||||||||||||||||||||
| 7428 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7429 | node = node->parent(); | - | ||||||||||||||||||||||||
| 7430 | - | |||||||||||||||||||||||||
| 7431 | return true; executed 1023 times by 5 tests: return true;Executed by:
| 1023 | ||||||||||||||||||||||||
| 7432 | } | - | ||||||||||||||||||||||||
| 7433 | - | |||||||||||||||||||||||||
| 7434 | bool QDomHandler::characters(const QString& ch) | - | ||||||||||||||||||||||||
| 7435 | { | - | ||||||||||||||||||||||||
| 7436 | // No text as child of some document | - | ||||||||||||||||||||||||
| 7437 | if (node == doc)
| 0-125 | ||||||||||||||||||||||||
| 7438 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7439 | - | |||||||||||||||||||||||||
| 7440 | QScopedPointer<QDomNodePrivate> n; | - | ||||||||||||||||||||||||
| 7441 | if (cdata) {
| 0-125 | ||||||||||||||||||||||||
| 7442 | n.reset(doc->createCDATASection(ch)); | - | ||||||||||||||||||||||||
| 7443 | } else if (!entityName.isEmpty()) { never executed: end of block
| 0-125 | ||||||||||||||||||||||||
| 7444 | QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName, | - | ||||||||||||||||||||||||
| 7445 | QString(), QString(), QString())); | - | ||||||||||||||||||||||||
| 7446 | e->value = ch; | - | ||||||||||||||||||||||||
| 7447 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 7448 | doc->doctype()->appendChild(e.data()); | - | ||||||||||||||||||||||||
| 7449 | e.take(); | - | ||||||||||||||||||||||||
| 7450 | n.reset(doc->createEntityReference(entityName)); | - | ||||||||||||||||||||||||
| 7451 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 7452 | n.reset(doc->createTextNode(ch)); | - | ||||||||||||||||||||||||
| 7453 | } executed 125 times by 2 tests: end of blockExecuted by:
| 125 | ||||||||||||||||||||||||
| 7454 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7455 | node->appendChild(n.data()); | - | ||||||||||||||||||||||||
| 7456 | n.take(); | - | ||||||||||||||||||||||||
| 7457 | - | |||||||||||||||||||||||||
| 7458 | return true; executed 125 times by 2 tests: return true;Executed by:
| 125 | ||||||||||||||||||||||||
| 7459 | } | - | ||||||||||||||||||||||||
| 7460 | - | |||||||||||||||||||||||||
| 7461 | bool QDomHandler::processingInstruction(const QString& target, const QString& data) | - | ||||||||||||||||||||||||
| 7462 | { | - | ||||||||||||||||||||||||
| 7463 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 7464 | n = doc->createProcessingInstruction(target, data); | - | ||||||||||||||||||||||||
| 7465 | if (n) {
| 0 | ||||||||||||||||||||||||
| 7466 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7467 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7468 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7469 | } | - | ||||||||||||||||||||||||
| 7470 | else | - | ||||||||||||||||||||||||
| 7471 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7472 | } | - | ||||||||||||||||||||||||
| 7473 | - | |||||||||||||||||||||||||
| 7474 | bool QDomHandler::skippedEntity(const QString& name) | - | ||||||||||||||||||||||||
| 7475 | { | - | ||||||||||||||||||||||||
| 7476 | // we can only handle inserting entity references into content | - | ||||||||||||||||||||||||
| 7477 | if (reader && !reader->d_ptr->skipped_entity_in_content)
| 0 | ||||||||||||||||||||||||
| 7478 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7479 | - | |||||||||||||||||||||||||
| 7480 | QDomNodePrivate *n = doc->createEntityReference(name); | - | ||||||||||||||||||||||||
| 7481 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7482 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7483 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7484 | } | - | ||||||||||||||||||||||||
| 7485 | - | |||||||||||||||||||||||||
| 7486 | bool QDomHandler::fatalError(const QXmlParseException& exception) | - | ||||||||||||||||||||||||
| 7487 | { | - | ||||||||||||||||||||||||
| 7488 | errorMsg = exception.message(); | - | ||||||||||||||||||||||||
| 7489 | errorLine = exception.lineNumber(); | - | ||||||||||||||||||||||||
| 7490 | errorColumn = exception.columnNumber(); | - | ||||||||||||||||||||||||
| 7491 | return QXmlDefaultHandler::fatalError(exception); never executed: return QXmlDefaultHandler::fatalError(exception); | 0 | ||||||||||||||||||||||||
| 7492 | } | - | ||||||||||||||||||||||||
| 7493 | - | |||||||||||||||||||||||||
| 7494 | bool QDomHandler::startCDATA() | - | ||||||||||||||||||||||||
| 7495 | { | - | ||||||||||||||||||||||||
| 7496 | cdata = true; | - | ||||||||||||||||||||||||
| 7497 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7498 | } | - | ||||||||||||||||||||||||
| 7499 | - | |||||||||||||||||||||||||
| 7500 | bool QDomHandler::endCDATA() | - | ||||||||||||||||||||||||
| 7501 | { | - | ||||||||||||||||||||||||
| 7502 | cdata = false; | - | ||||||||||||||||||||||||
| 7503 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7504 | } | - | ||||||||||||||||||||||||
| 7505 | - | |||||||||||||||||||||||||
| 7506 | bool QDomHandler::startEntity(const QString &name) | - | ||||||||||||||||||||||||
| 7507 | { | - | ||||||||||||||||||||||||
| 7508 | entityName = name; | - | ||||||||||||||||||||||||
| 7509 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7510 | } | - | ||||||||||||||||||||||||
| 7511 | - | |||||||||||||||||||||||||
| 7512 | bool QDomHandler::endEntity(const QString &) | - | ||||||||||||||||||||||||
| 7513 | { | - | ||||||||||||||||||||||||
| 7514 | entityName.clear(); | - | ||||||||||||||||||||||||
| 7515 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7516 | } | - | ||||||||||||||||||||||||
| 7517 | - | |||||||||||||||||||||||||
| 7518 | bool QDomHandler::comment(const QString& ch) | - | ||||||||||||||||||||||||
| 7519 | { | - | ||||||||||||||||||||||||
| 7520 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 7521 | n = doc->createComment(ch); | - | ||||||||||||||||||||||||
| 7522 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7523 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7524 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7525 | } | - | ||||||||||||||||||||||||
| 7526 | - | |||||||||||||||||||||||||
| 7527 | bool QDomHandler::unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName) | - | ||||||||||||||||||||||||
| 7528 | { | - | ||||||||||||||||||||||||
| 7529 | QDomEntityPrivate* e = new QDomEntityPrivate(doc, 0, name, | - | ||||||||||||||||||||||||
| 7530 | publicId, systemId, notationName); | - | ||||||||||||||||||||||||
| 7531 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 7532 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 7533 | doc->doctype()->appendChild(e); | - | ||||||||||||||||||||||||
| 7534 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7535 | } | - | ||||||||||||||||||||||||
| 7536 | - | |||||||||||||||||||||||||
| 7537 | bool QDomHandler::externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) | - | ||||||||||||||||||||||||
| 7538 | { | - | ||||||||||||||||||||||||
| 7539 | return unparsedEntityDecl(name, publicId, systemId, QString()); never executed: return unparsedEntityDecl(name, publicId, systemId, QString()); | 0 | ||||||||||||||||||||||||
| 7540 | } | - | ||||||||||||||||||||||||
| 7541 | - | |||||||||||||||||||||||||
| 7542 | bool QDomHandler::notationDecl(const QString & name, const QString & publicId, const QString & systemId) | - | ||||||||||||||||||||||||
| 7543 | { | - | ||||||||||||||||||||||||
| 7544 | QDomNotationPrivate* n = new QDomNotationPrivate(doc, 0, name, publicId, systemId); | - | ||||||||||||||||||||||||
| 7545 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 7546 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 7547 | doc->doctype()->appendChild(n); | - | ||||||||||||||||||||||||
| 7548 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7549 | } | - | ||||||||||||||||||||||||
| 7550 | - | |||||||||||||||||||||||||
| 7551 | void QDomHandler::setDocumentLocator(QXmlLocator *locator) | - | ||||||||||||||||||||||||
| 7552 | { | - | ||||||||||||||||||||||||
| 7553 | this->locator = locator; | - | ||||||||||||||||||||||||
| 7554 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 7555 | - | |||||||||||||||||||||||||
| 7556 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 7557 | - | |||||||||||||||||||||||||
| 7558 | #endif // QT_NO_DOM | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |