| 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) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtXml module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||
| 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 http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at http://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 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | #include <qplatformdefs.h> | - | ||||||||||||||||||||||||
| 35 | #include <qdom.h> | - | ||||||||||||||||||||||||
| 36 | #include "private/qxmlutils_p.h" | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | #ifndef QT_NO_DOM | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include <qatomic.h> | - | ||||||||||||||||||||||||
| 41 | #include <qbuffer.h> | - | ||||||||||||||||||||||||
| 42 | #include <qhash.h> | - | ||||||||||||||||||||||||
| 43 | #include <qiodevice.h> | - | ||||||||||||||||||||||||
| 44 | #include <qlist.h> | - | ||||||||||||||||||||||||
| 45 | #include <qregexp.h> | - | ||||||||||||||||||||||||
| 46 | #include <qtextcodec.h> | - | ||||||||||||||||||||||||
| 47 | #include <qtextstream.h> | - | ||||||||||||||||||||||||
| 48 | #include <qxml.h> | - | ||||||||||||||||||||||||
| 49 | #include "private/qxml_p.h" | - | ||||||||||||||||||||||||
| 50 | #include <qvariant.h> | - | ||||||||||||||||||||||||
| 51 | #include <qmap.h> | - | ||||||||||||||||||||||||
| 52 | #include <qshareddata.h> | - | ||||||||||||||||||||||||
| 53 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 54 | #include <stdio.h> | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | /* | - | ||||||||||||||||||||||||
| 59 | ### old todo comments -- I don't know if they still apply... | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | If the document dies, remove all pointers to it from children | - | ||||||||||||||||||||||||
| 62 | which can not be deleted at this time. | - | ||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||
| 64 | If a node dies and has direct children which can not be deleted, | - | ||||||||||||||||||||||||
| 65 | then remove the pointer to the parent. | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | createElement and friends create double reference counts. | - | ||||||||||||||||||||||||
| 68 | */ | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | /* ##### new TODOs: | - | ||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||
| 72 | Remove emtpy emthods in the *Private classes | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | Make a lot of the (mostly empty) methods in the public classes inline. | - | ||||||||||||||||||||||||
| 75 | Specially constructors assignment operators and comparison operators are candidates. | - | ||||||||||||||||||||||||
| 76 | */ | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | /* | - | ||||||||||||||||||||||||
| 79 | Reference counting: | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | Some simple rules: | - | ||||||||||||||||||||||||
| 82 | 1) If an intern object returns a pointer to another intern object | - | ||||||||||||||||||||||||
| 83 | then the reference count of the returned object is not increased. | - | ||||||||||||||||||||||||
| 84 | 2) If an extern object is created and gets a pointer to some intern | - | ||||||||||||||||||||||||
| 85 | object, then the extern object increases the intern objects reference count. | - | ||||||||||||||||||||||||
| 86 | 3) If an extern object is deleted, then it decreases the reference count | - | ||||||||||||||||||||||||
| 87 | on its associated intern object and deletes it if nobody else hold references | - | ||||||||||||||||||||||||
| 88 | on the intern object. | - | ||||||||||||||||||||||||
| 89 | */ | - | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | /* | - | ||||||||||||||||||||||||
| 93 | Helper to split a qualified name in the prefix and local name. | - | ||||||||||||||||||||||||
| 94 | */ | - | ||||||||||||||||||||||||
| 95 | static void qt_split_namespace(QString& prefix, QString& name, const QString& qName, bool hasURI) | - | ||||||||||||||||||||||||
| 96 | { | - | ||||||||||||||||||||||||
| 97 | int i = qName.indexOf(QLatin1Char(':')); | - | ||||||||||||||||||||||||
| 98 | if (i == -1) {
| 4 | ||||||||||||||||||||||||
| 99 | if (hasURI)
| 2 | ||||||||||||||||||||||||
| 100 | prefix = QLatin1String(""); executed 2 times by 1 test: prefix = QLatin1String("");Executed by:
| 2 | ||||||||||||||||||||||||
| 101 | else | - | ||||||||||||||||||||||||
| 102 | prefix.clear(); executed 2 times by 1 test: prefix.clear();Executed by:
| 2 | ||||||||||||||||||||||||
| 103 | name = qName; | - | ||||||||||||||||||||||||
| 104 | } else { executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 105 | prefix = qName.left(i); | - | ||||||||||||||||||||||||
| 106 | name = qName.mid(i + 1); | - | ||||||||||||||||||||||||
| 107 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||
| 108 | } | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | /************************************************************** | - | ||||||||||||||||||||||||
| 111 | * | - | ||||||||||||||||||||||||
| 112 | * Private class declerations | - | ||||||||||||||||||||||||
| 113 | * | - | ||||||||||||||||||||||||
| 114 | **************************************************************/ | - | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | class QDomImplementationPrivate | - | ||||||||||||||||||||||||
| 117 | { | - | ||||||||||||||||||||||||
| 118 | public: | - | ||||||||||||||||||||||||
| 119 | inline QDomImplementationPrivate() {} | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | QDomImplementationPrivate* clone(); | - | ||||||||||||||||||||||||
| 122 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 123 | static QDomImplementation::InvalidDataPolicy invalidDataPolicy; | - | ||||||||||||||||||||||||
| 124 | }; | - | ||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||
| 126 | class QDomNodePrivate | - | ||||||||||||||||||||||||
| 127 | { | - | ||||||||||||||||||||||||
| 128 | public: | - | ||||||||||||||||||||||||
| 129 | QDomNodePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 130 | QDomNodePrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 131 | virtual ~QDomNodePrivate(); | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | QString nodeName() const { return name; } executed 1982 times by 4 tests: return name;Executed by:
| 1982 | ||||||||||||||||||||||||
| 134 | QString nodeValue() const { return value; } executed 33 times by 1 test: return value;Executed by:
| 33 | ||||||||||||||||||||||||
| 135 | virtual void setNodeValue(const QString& v) { value = v; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | QDomDocumentPrivate* ownerDocument(); | - | ||||||||||||||||||||||||
| 138 | void setOwnerDocument(QDomDocumentPrivate* doc); | - | ||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | virtual QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild); | - | ||||||||||||||||||||||||
| 141 | virtual QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild); | - | ||||||||||||||||||||||||
| 142 | virtual QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild); | - | ||||||||||||||||||||||||
| 143 | virtual QDomNodePrivate* removeChild(QDomNodePrivate* oldChild); | - | ||||||||||||||||||||||||
| 144 | virtual QDomNodePrivate* appendChild(QDomNodePrivate* newChild); | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | QDomNodePrivate* namedItem(const QString& name); | - | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | virtual QDomNodePrivate* cloneNode(bool deep = true); | - | ||||||||||||||||||||||||
| 149 | virtual void normalize(); | - | ||||||||||||||||||||||||
| 150 | virtual void clear(); | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | inline QDomNodePrivate* parent() const { return hasParent ? ownerNode : 0; } executed 15338 times by 5 tests: return hasParent ? ownerNode : 0;Executed by:
| 1148-15338 | ||||||||||||||||||||||||
| 153 | inline void setParent(QDomNodePrivate *p) { ownerNode = p; hasParent = true; } executed 4239 times by 5 tests: end of blockExecuted by:
| 4239 | ||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | void setNoParent() { | - | ||||||||||||||||||||||||
| 156 | ownerNode = hasParent ? (QDomNodePrivate*)ownerDocument() : 0;
| 0-1 | ||||||||||||||||||||||||
| 157 | hasParent = false; | - | ||||||||||||||||||||||||
| 158 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | // Dynamic cast | - | ||||||||||||||||||||||||
| 161 | bool isAttr() const { return nodeType() == QDomNode::AttributeNode; } never executed: return nodeType() == QDomNode::AttributeNode; | 0 | ||||||||||||||||||||||||
| 162 | bool isCDATASection() const { return nodeType() == QDomNode::CDATASectionNode; } never executed: return nodeType() == QDomNode::CDATASectionNode; | 0 | ||||||||||||||||||||||||
| 163 | bool isDocumentFragment() const { return nodeType() == QDomNode::DocumentFragmentNode; } executed 2016 times by 5 tests: return nodeType() == QDomNode::DocumentFragmentNode;Executed by:
| 2016 | ||||||||||||||||||||||||
| 164 | bool isDocument() const { return nodeType() == QDomNode::DocumentNode; } executed 14368 times by 5 tests: return nodeType() == QDomNode::DocumentNode;Executed by:
| 14368 | ||||||||||||||||||||||||
| 165 | bool isDocumentType() const { return nodeType() == QDomNode::DocumentTypeNode; } never executed: return nodeType() == QDomNode::DocumentTypeNode; | 0 | ||||||||||||||||||||||||
| 166 | bool isElement() const { return nodeType() == QDomNode::ElementNode; } executed 365 times by 1 test: return nodeType() == QDomNode::ElementNode;Executed by:
| 365 | ||||||||||||||||||||||||
| 167 | bool isEntityReference() const { return nodeType() == QDomNode::EntityReferenceNode; } never executed: return nodeType() == QDomNode::EntityReferenceNode; | 0 | ||||||||||||||||||||||||
| 168 | bool isText() const { const QDomNode::NodeType nt = nodeType(); | - | ||||||||||||||||||||||||
| 169 | return (nt == QDomNode::TextNode) executed 320 times by 1 test: return (nt == QDomNode::TextNode) || (nt == QDomNode::CDATASectionNode);Executed by:
| 0-320 | ||||||||||||||||||||||||
| 170 | || (nt == QDomNode::CDATASectionNode); } executed 320 times by 1 test: return (nt == QDomNode::TextNode) || (nt == QDomNode::CDATASectionNode);Executed by:
| 0-320 | ||||||||||||||||||||||||
| 171 | bool isEntity() const { return nodeType() == QDomNode::EntityNode; } never executed: return nodeType() == QDomNode::EntityNode; | 0 | ||||||||||||||||||||||||
| 172 | bool isNotation() const { return nodeType() == QDomNode::NotationNode; } never executed: return nodeType() == QDomNode::NotationNode; | 0 | ||||||||||||||||||||||||
| 173 | bool isProcessingInstruction() const { return nodeType() == QDomNode::ProcessingInstructionNode; } executed 172 times by 2 tests: return nodeType() == QDomNode::ProcessingInstructionNode;Executed by:
| 172 | ||||||||||||||||||||||||
| 174 | bool isCharacterData() const { const QDomNode::NodeType nt = nodeType(); | - | ||||||||||||||||||||||||
| 175 | return (nt == QDomNode::CharacterDataNode) never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode);
| 0 | ||||||||||||||||||||||||
| 176 | || (nt == QDomNode::TextNode) never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode);
| 0 | ||||||||||||||||||||||||
| 177 | || (nt == QDomNode::CommentNode); } never executed: return (nt == QDomNode::CharacterDataNode) || (nt == QDomNode::TextNode) || (nt == QDomNode::CommentNode);
| 0 | ||||||||||||||||||||||||
| 178 | bool isComment() const { return nodeType() == QDomNode::CommentNode; } never executed: return nodeType() == QDomNode::CommentNode; | 0 | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | virtual QDomNode::NodeType nodeType() const { return QDomNode::BaseNode; } never executed: return QDomNode::BaseNode; | 0 | ||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | virtual void save(QTextStream&, int, int) const; | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | void setLocation(int lineNumber, int columnNumber); | - | ||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | // Variables | - | ||||||||||||||||||||||||
| 187 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 188 | QDomNodePrivate* prev; | - | ||||||||||||||||||||||||
| 189 | QDomNodePrivate* next; | - | ||||||||||||||||||||||||
| 190 | QDomNodePrivate* ownerNode; // either the node's parent or the node's owner document | - | ||||||||||||||||||||||||
| 191 | QDomNodePrivate* first; | - | ||||||||||||||||||||||||
| 192 | QDomNodePrivate* last; | - | ||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | QString name; // this is the local name if prefix != null | - | ||||||||||||||||||||||||
| 195 | QString value; | - | ||||||||||||||||||||||||
| 196 | QString prefix; // set this only for ElementNode and AttributeNode | - | ||||||||||||||||||||||||
| 197 | QString namespaceURI; // set this only for ElementNode and AttributeNode | - | ||||||||||||||||||||||||
| 198 | bool createdWithDom1Interface : 1; | - | ||||||||||||||||||||||||
| 199 | bool hasParent : 1; | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | int lineNumber; | - | ||||||||||||||||||||||||
| 202 | int columnNumber; | - | ||||||||||||||||||||||||
| 203 | }; | - | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | class QDomNodeListPrivate | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | public: | - | ||||||||||||||||||||||||
| 208 | QDomNodeListPrivate(QDomNodePrivate*); | - | ||||||||||||||||||||||||
| 209 | QDomNodeListPrivate(QDomNodePrivate*, const QString& ); | - | ||||||||||||||||||||||||
| 210 | QDomNodeListPrivate(QDomNodePrivate*, const QString&, const QString& ); | - | ||||||||||||||||||||||||
| 211 | ~QDomNodeListPrivate(); | - | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | bool operator== (const QDomNodeListPrivate&) const; | - | ||||||||||||||||||||||||
| 214 | bool operator!= (const QDomNodeListPrivate&) const; | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | void createList(); | - | ||||||||||||||||||||||||
| 217 | QDomNodePrivate* item(int index); | - | ||||||||||||||||||||||||
| 218 | int length() const; | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 221 | /* | - | ||||||||||||||||||||||||
| 222 | This list contains the children of this node. | - | ||||||||||||||||||||||||
| 223 | */ | - | ||||||||||||||||||||||||
| 224 | QDomNodePrivate* node_impl; | - | ||||||||||||||||||||||||
| 225 | QString tagname; | - | ||||||||||||||||||||||||
| 226 | QString nsURI; | - | ||||||||||||||||||||||||
| 227 | QList<QDomNodePrivate*> list; | - | ||||||||||||||||||||||||
| 228 | long timestamp; | - | ||||||||||||||||||||||||
| 229 | }; | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | class QDomNamedNodeMapPrivate | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | public: | - | ||||||||||||||||||||||||
| 234 | QDomNamedNodeMapPrivate(QDomNodePrivate*); | - | ||||||||||||||||||||||||
| 235 | ~QDomNamedNodeMapPrivate(); | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | QDomNodePrivate* namedItem(const QString& name) const; | - | ||||||||||||||||||||||||
| 238 | QDomNodePrivate* namedItemNS(const QString& nsURI, const QString& localName) const; | - | ||||||||||||||||||||||||
| 239 | QDomNodePrivate* setNamedItem(QDomNodePrivate* arg); | - | ||||||||||||||||||||||||
| 240 | QDomNodePrivate* setNamedItemNS(QDomNodePrivate* arg); | - | ||||||||||||||||||||||||
| 241 | QDomNodePrivate* removeNamedItem(const QString& name); | - | ||||||||||||||||||||||||
| 242 | QDomNodePrivate* item(int index) const; | - | ||||||||||||||||||||||||
| 243 | int length() const; | - | ||||||||||||||||||||||||
| 244 | bool contains(const QString& name) const; | - | ||||||||||||||||||||||||
| 245 | bool containsNS(const QString& nsURI, const QString & localName) const; | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | /** | - | ||||||||||||||||||||||||
| 248 | * Remove all children from the map. | - | ||||||||||||||||||||||||
| 249 | */ | - | ||||||||||||||||||||||||
| 250 | void clearMap(); | - | ||||||||||||||||||||||||
| 251 | bool isReadOnly() { return readonly; } never executed: return readonly; | 0 | ||||||||||||||||||||||||
| 252 | void setReadOnly(bool r) { readonly = r; } never executed: end of block | 0 | ||||||||||||||||||||||||
| 253 | bool isAppendToParent() { return appendToParent; } never executed: return appendToParent; | 0 | ||||||||||||||||||||||||
| 254 | /** | - | ||||||||||||||||||||||||
| 255 | * If true, then the node will redirect insert/remove calls | - | ||||||||||||||||||||||||
| 256 | * to its parent by calling QDomNodePrivate::appendChild or removeChild. | - | ||||||||||||||||||||||||
| 257 | * In addition the map won't increase or decrease the reference count | - | ||||||||||||||||||||||||
| 258 | * of the nodes it contains. | - | ||||||||||||||||||||||||
| 259 | * | - | ||||||||||||||||||||||||
| 260 | * By default this value is false and the map will handle reference counting | - | ||||||||||||||||||||||||
| 261 | * by itself. | - | ||||||||||||||||||||||||
| 262 | */ | - | ||||||||||||||||||||||||
| 263 | void setAppendToParent(bool b) { appendToParent = b; } executed 976 times by 5 tests: end of blockExecuted by:
| 976 | ||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | /** | - | ||||||||||||||||||||||||
| 266 | * Creates a copy of the map. It is a deep copy | - | ||||||||||||||||||||||||
| 267 | * that means that all children are cloned. | - | ||||||||||||||||||||||||
| 268 | */ | - | ||||||||||||||||||||||||
| 269 | QDomNamedNodeMapPrivate* clone(QDomNodePrivate* parent); | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | // Variables | - | ||||||||||||||||||||||||
| 272 | QAtomicInt ref; | - | ||||||||||||||||||||||||
| 273 | QHash<QString, QDomNodePrivate *> map; | - | ||||||||||||||||||||||||
| 274 | QDomNodePrivate* parent; | - | ||||||||||||||||||||||||
| 275 | bool readonly; | - | ||||||||||||||||||||||||
| 276 | bool appendToParent; | - | ||||||||||||||||||||||||
| 277 | }; | - | ||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||
| 279 | class QDomDocumentTypePrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 280 | { | - | ||||||||||||||||||||||||
| 281 | public: | - | ||||||||||||||||||||||||
| 282 | QDomDocumentTypePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 283 | QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 284 | ~QDomDocumentTypePrivate(); | - | ||||||||||||||||||||||||
| 285 | void init(); | - | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 288 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 289 | QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 290 | QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 291 | QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 292 | QDomNodePrivate* removeChild(QDomNodePrivate* oldChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 293 | QDomNodePrivate* appendChild(QDomNodePrivate* newChild) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentTypeNode; } never executed: return QDomNode::DocumentTypeNode; | 0 | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | // Variables | - | ||||||||||||||||||||||||
| 300 | QDomNamedNodeMapPrivate* entities; | - | ||||||||||||||||||||||||
| 301 | QDomNamedNodeMapPrivate* notations; | - | ||||||||||||||||||||||||
| 302 | QString publicId; | - | ||||||||||||||||||||||||
| 303 | QString systemId; | - | ||||||||||||||||||||||||
| 304 | QString internalSubset; | - | ||||||||||||||||||||||||
| 305 | }; | - | ||||||||||||||||||||||||
| 306 | - | |||||||||||||||||||||||||
| 307 | class QDomDocumentFragmentPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 308 | { | - | ||||||||||||||||||||||||
| 309 | public: | - | ||||||||||||||||||||||||
| 310 | QDomDocumentFragmentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent = 0); | - | ||||||||||||||||||||||||
| 311 | QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 314 | virtual QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 315 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentFragmentNode; } never executed: return QDomNode::DocumentFragmentNode; | 0 | ||||||||||||||||||||||||
| 316 | }; | - | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | class QDomCharacterDataPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 319 | { | - | ||||||||||||||||||||||||
| 320 | public: | - | ||||||||||||||||||||||||
| 321 | QDomCharacterDataPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& data); | - | ||||||||||||||||||||||||
| 322 | QDomCharacterDataPrivate(QDomCharacterDataPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | int dataLength() const; | - | ||||||||||||||||||||||||
| 325 | QString substringData(unsigned long offset, unsigned long count) const; | - | ||||||||||||||||||||||||
| 326 | void appendData(const QString& arg); | - | ||||||||||||||||||||||||
| 327 | void insertData(unsigned long offset, const QString& arg); | - | ||||||||||||||||||||||||
| 328 | void deleteData(unsigned long offset, unsigned long count); | - | ||||||||||||||||||||||||
| 329 | void replaceData(unsigned long offset, unsigned long count, const QString& arg); | - | ||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||
| 331 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 332 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CharacterDataNode; } never executed: return QDomNode::CharacterDataNode; | 0 | ||||||||||||||||||||||||
| 333 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 334 | }; | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | class QDomTextPrivate : public QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | public: | - | ||||||||||||||||||||||||
| 339 | QDomTextPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 340 | QDomTextPrivate(QDomTextPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||
| 342 | QDomTextPrivate* splitText(int offset); | - | ||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 345 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 346 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::TextNode; } executed 994 times by 5 tests: return QDomNode::TextNode;Executed by:
| 994 | ||||||||||||||||||||||||
| 347 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 348 | }; | - | ||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||
| 350 | class QDomAttrPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 351 | { | - | ||||||||||||||||||||||||
| 352 | public: | - | ||||||||||||||||||||||||
| 353 | QDomAttrPrivate(QDomDocumentPrivate*, QDomNodePrivate*, const QString& name); | - | ||||||||||||||||||||||||
| 354 | QDomAttrPrivate(QDomDocumentPrivate*, QDomNodePrivate*, const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 355 | QDomAttrPrivate(QDomAttrPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | bool specified() const; | - | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 360 | void setNodeValue(const QString& v) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 361 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 362 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::AttributeNode; } executed 1738 times by 4 tests: return QDomNode::AttributeNode;Executed by:
| 1738 | ||||||||||||||||||||||||
| 363 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||
| 365 | // Variables | - | ||||||||||||||||||||||||
| 366 | bool m_specified; | - | ||||||||||||||||||||||||
| 367 | }; | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | class QDomElementPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 370 | { | - | ||||||||||||||||||||||||
| 371 | public: | - | ||||||||||||||||||||||||
| 372 | QDomElementPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name); | - | ||||||||||||||||||||||||
| 373 | QDomElementPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 374 | QDomElementPrivate(QDomElementPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 375 | ~QDomElementPrivate(); | - | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | QString attribute(const QString& name, const QString& defValue) const; | - | ||||||||||||||||||||||||
| 378 | QString attributeNS(const QString& nsURI, const QString& localName, const QString& defValue) const; | - | ||||||||||||||||||||||||
| 379 | void setAttribute(const QString& name, const QString& value); | - | ||||||||||||||||||||||||
| 380 | void setAttributeNS(const QString& nsURI, const QString& qName, const QString& newValue); | - | ||||||||||||||||||||||||
| 381 | void removeAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 382 | QDomAttrPrivate* attributeNode(const QString& name); | - | ||||||||||||||||||||||||
| 383 | QDomAttrPrivate* attributeNodeNS(const QString& nsURI, const QString& localName); | - | ||||||||||||||||||||||||
| 384 | QDomAttrPrivate* setAttributeNode(QDomAttrPrivate* newAttr); | - | ||||||||||||||||||||||||
| 385 | QDomAttrPrivate* setAttributeNodeNS(QDomAttrPrivate* newAttr); | - | ||||||||||||||||||||||||
| 386 | QDomAttrPrivate* removeAttributeNode(QDomAttrPrivate* oldAttr); | - | ||||||||||||||||||||||||
| 387 | bool hasAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 388 | bool hasAttributeNS(const QString& nsURI, const QString& localName); | - | ||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | QString text(); | - | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 393 | QDomNamedNodeMapPrivate* attributes() { return m_attr; } never executed: return m_attr; | 0 | ||||||||||||||||||||||||
| 394 | bool hasAttributes() { return (m_attr->length() > 0); } executed 26 times by 1 test: return (m_attr->length() > 0);Executed by:
| 26 | ||||||||||||||||||||||||
| 395 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ElementNode; } executed 10667 times by 5 tests: return QDomNode::ElementNode;Executed by:
| 10667 | ||||||||||||||||||||||||
| 396 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 397 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | // Variables | - | ||||||||||||||||||||||||
| 400 | QDomNamedNodeMapPrivate* m_attr; | - | ||||||||||||||||||||||||
| 401 | }; | - | ||||||||||||||||||||||||
| 402 | - | |||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||
| 404 | class QDomCommentPrivate : public QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 405 | { | - | ||||||||||||||||||||||||
| 406 | public: | - | ||||||||||||||||||||||||
| 407 | QDomCommentPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 408 | QDomCommentPrivate(QDomCommentPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 411 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 412 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CommentNode; } never executed: return QDomNode::CommentNode; | 0 | ||||||||||||||||||||||||
| 413 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 414 | }; | - | ||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||
| 416 | class QDomCDATASectionPrivate : public QDomTextPrivate | - | ||||||||||||||||||||||||
| 417 | { | - | ||||||||||||||||||||||||
| 418 | public: | - | ||||||||||||||||||||||||
| 419 | QDomCDATASectionPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& val); | - | ||||||||||||||||||||||||
| 420 | QDomCDATASectionPrivate(QDomCDATASectionPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 423 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 424 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CDATASectionNode; } never executed: return QDomNode::CDATASectionNode; | 0 | ||||||||||||||||||||||||
| 425 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 426 | }; | - | ||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||
| 428 | class QDomNotationPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 429 | { | - | ||||||||||||||||||||||||
| 430 | public: | - | ||||||||||||||||||||||||
| 431 | QDomNotationPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name, | - | ||||||||||||||||||||||||
| 432 | const QString& pub, const QString& sys); | - | ||||||||||||||||||||||||
| 433 | QDomNotationPrivate(QDomNotationPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 436 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 437 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::NotationNode; } never executed: return QDomNode::NotationNode; | 0 | ||||||||||||||||||||||||
| 438 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||
| 440 | // Variables | - | ||||||||||||||||||||||||
| 441 | QString m_sys; | - | ||||||||||||||||||||||||
| 442 | QString m_pub; | - | ||||||||||||||||||||||||
| 443 | }; | - | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | class QDomEntityPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 446 | { | - | ||||||||||||||||||||||||
| 447 | public: | - | ||||||||||||||||||||||||
| 448 | QDomEntityPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name, | - | ||||||||||||||||||||||||
| 449 | const QString& pub, const QString& sys, const QString& notation); | - | ||||||||||||||||||||||||
| 450 | QDomEntityPrivate(QDomEntityPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 453 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 454 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityNode; } never executed: return QDomNode::EntityNode; | 0 | ||||||||||||||||||||||||
| 455 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | // Variables | - | ||||||||||||||||||||||||
| 458 | QString m_sys; | - | ||||||||||||||||||||||||
| 459 | QString m_pub; | - | ||||||||||||||||||||||||
| 460 | QString m_notationName; | - | ||||||||||||||||||||||||
| 461 | }; | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | class QDomEntityReferencePrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 464 | { | - | ||||||||||||||||||||||||
| 465 | public: | - | ||||||||||||||||||||||||
| 466 | QDomEntityReferencePrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& name); | - | ||||||||||||||||||||||||
| 467 | QDomEntityReferencePrivate(QDomNodePrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 470 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 471 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityReferenceNode; } never executed: return QDomNode::EntityReferenceNode; | 0 | ||||||||||||||||||||||||
| 472 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 473 | }; | - | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | class QDomProcessingInstructionPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 476 | { | - | ||||||||||||||||||||||||
| 477 | public: | - | ||||||||||||||||||||||||
| 478 | QDomProcessingInstructionPrivate(QDomDocumentPrivate*, QDomNodePrivate* parent, const QString& target, | - | ||||||||||||||||||||||||
| 479 | const QString& data); | - | ||||||||||||||||||||||||
| 480 | QDomProcessingInstructionPrivate(QDomProcessingInstructionPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 483 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 484 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ProcessingInstructionNode; } never executed: return QDomNode::ProcessingInstructionNode; | 0 | ||||||||||||||||||||||||
| 485 | virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 486 | }; | - | ||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||
| 488 | class QDomDocumentPrivate : public QDomNodePrivate | - | ||||||||||||||||||||||||
| 489 | { | - | ||||||||||||||||||||||||
| 490 | public: | - | ||||||||||||||||||||||||
| 491 | QDomDocumentPrivate(); | - | ||||||||||||||||||||||||
| 492 | QDomDocumentPrivate(const QString& name); | - | ||||||||||||||||||||||||
| 493 | QDomDocumentPrivate(QDomDocumentTypePrivate* dt); | - | ||||||||||||||||||||||||
| 494 | QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep); | - | ||||||||||||||||||||||||
| 495 | ~QDomDocumentPrivate(); | - | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn); | - | ||||||||||||||||||||||||
| 498 | bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn); | - | ||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | // Attributes | - | ||||||||||||||||||||||||
| 501 | QDomDocumentTypePrivate* doctype() { return type.data(); } executed 471 times by 2 tests: return type.data();Executed by:
| 471 | ||||||||||||||||||||||||
| 502 | QDomImplementationPrivate* implementation() { return impl.data(); } never executed: return impl.data(); | 0 | ||||||||||||||||||||||||
| 503 | QDomElementPrivate* documentElement(); | - | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | // Factories | - | ||||||||||||||||||||||||
| 506 | QDomElementPrivate* createElement(const QString& tagName); | - | ||||||||||||||||||||||||
| 507 | QDomElementPrivate* createElementNS(const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 508 | QDomDocumentFragmentPrivate* createDocumentFragment(); | - | ||||||||||||||||||||||||
| 509 | QDomTextPrivate* createTextNode(const QString& data); | - | ||||||||||||||||||||||||
| 510 | QDomCommentPrivate* createComment(const QString& data); | - | ||||||||||||||||||||||||
| 511 | QDomCDATASectionPrivate* createCDATASection(const QString& data); | - | ||||||||||||||||||||||||
| 512 | QDomProcessingInstructionPrivate* createProcessingInstruction(const QString& target, const QString& data); | - | ||||||||||||||||||||||||
| 513 | QDomAttrPrivate* createAttribute(const QString& name); | - | ||||||||||||||||||||||||
| 514 | QDomAttrPrivate* createAttributeNS(const QString& nsURI, const QString& qName); | - | ||||||||||||||||||||||||
| 515 | QDomEntityReferencePrivate* createEntityReference(const QString& name); | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | QDomNodePrivate* importNode(QDomNodePrivate* importedNode, bool deep); | - | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | // Reimplemented from QDomNodePrivate | - | ||||||||||||||||||||||||
| 520 | QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 521 | QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentNode; } executed 3842 times by 5 tests: return QDomNode::DocumentNode;Executed by:
| 3842 | ||||||||||||||||||||||||
| 522 | void clear() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | // Variables | - | ||||||||||||||||||||||||
| 525 | QExplicitlySharedDataPointer<QDomImplementationPrivate> impl; | - | ||||||||||||||||||||||||
| 526 | QExplicitlySharedDataPointer<QDomDocumentTypePrivate> type; | - | ||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | void saveDocument(QTextStream& stream, const int indent, QDomNode::EncodingPolicy encUsed) const; | - | ||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||
| 530 | /* \internal | - | ||||||||||||||||||||||||
| 531 | Counter for the QDomNodeListPrivate timestamps. | - | ||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | This is a cache optimization, that might in some cases be effective. The | - | ||||||||||||||||||||||||
| 534 | dilemma is that QDomNode::childNodes() returns a list, but the | - | ||||||||||||||||||||||||
| 535 | implementation stores the children in a linked list. Hence, in order to | - | ||||||||||||||||||||||||
| 536 | get the children out through childNodes(), a list must be populated each | - | ||||||||||||||||||||||||
| 537 | time, which is O(N). | - | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | DOM has the requirement of node references being live, see DOM Core | - | ||||||||||||||||||||||||
| 540 | Level 3, 1.1.1 The DOM Structure Model, which means that changes to the | - | ||||||||||||||||||||||||
| 541 | underlying documents must be reflected in node lists. | - | ||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | This mechanism, nodeListTime, is a caching optimization that reduces the | - | ||||||||||||||||||||||||
| 544 | amount of times the node list is rebuilt, by only doing so when the | - | ||||||||||||||||||||||||
| 545 | document actually changes. However, a change to anywhere in any document | - | ||||||||||||||||||||||||
| 546 | invalidate all lists, since no dependency tracking is done. | - | ||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||
| 548 | It functions by that all modifying functions(insertBefore() and so on) | - | ||||||||||||||||||||||||
| 549 | increment the count; each QDomNodeListPrivate copies nodeListTime on | - | ||||||||||||||||||||||||
| 550 | construction, and compares its own value to nodeListTime in order to | - | ||||||||||||||||||||||||
| 551 | determine whether it needs to rebuild. | - | ||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||
| 553 | This is reentrant. The nodeListTime may overflow, but that's ok since we | - | ||||||||||||||||||||||||
| 554 | check for equalness, not whether nodeListTime is smaller than the list's | - | ||||||||||||||||||||||||
| 555 | stored timestamp. | - | ||||||||||||||||||||||||
| 556 | */ | - | ||||||||||||||||||||||||
| 557 | long nodeListTime; | - | ||||||||||||||||||||||||
| 558 | }; | - | ||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 | /************************************************************** | - | ||||||||||||||||||||||||
| 561 | * | - | ||||||||||||||||||||||||
| 562 | * QDomHandler | - | ||||||||||||||||||||||||
| 563 | * | - | ||||||||||||||||||||||||
| 564 | **************************************************************/ | - | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | class QDomHandler : public QXmlDefaultHandler | - | ||||||||||||||||||||||||
| 567 | { | - | ||||||||||||||||||||||||
| 568 | public: | - | ||||||||||||||||||||||||
| 569 | QDomHandler(QDomDocumentPrivate* d, QXmlSimpleReader *reader, bool namespaceProcessing); | - | ||||||||||||||||||||||||
| 570 | ~QDomHandler(); | - | ||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | // content handler | - | ||||||||||||||||||||||||
| 573 | bool endDocument() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 574 | bool startElement(const QString& nsURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 575 | bool endElement(const QString& nsURI, const QString& localName, const QString& qName) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 576 | bool characters(const QString& ch) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 577 | bool processingInstruction(const QString& target, const QString& data) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 578 | bool skippedEntity(const QString& name) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||
| 580 | // error handler | - | ||||||||||||||||||||||||
| 581 | bool fatalError(const QXmlParseException& exception) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | // lexical handler | - | ||||||||||||||||||||||||
| 584 | bool startCDATA() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 585 | bool endCDATA() Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 586 | bool startEntity(const QString &) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 587 | bool endEntity(const QString &) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 588 | bool startDTD(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 589 | bool comment(const QString& ch) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 590 | - | |||||||||||||||||||||||||
| 591 | // decl handler | - | ||||||||||||||||||||||||
| 592 | bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) Q_DECL_OVERRIDE ; | - | ||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||
| 594 | // DTD handler | - | ||||||||||||||||||||||||
| 595 | bool notationDecl(const QString & name, const QString & publicId, const QString & systemId) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 596 | bool unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName) Q_DECL_OVERRIDE ; | - | ||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||
| 598 | void setDocumentLocator(QXmlLocator *locator) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | QString errorMsg; | - | ||||||||||||||||||||||||
| 601 | int errorLine; | - | ||||||||||||||||||||||||
| 602 | int errorColumn; | - | ||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||
| 604 | private: | - | ||||||||||||||||||||||||
| 605 | QDomDocumentPrivate *doc; | - | ||||||||||||||||||||||||
| 606 | QDomNodePrivate *node; | - | ||||||||||||||||||||||||
| 607 | QString entityName; | - | ||||||||||||||||||||||||
| 608 | bool cdata; | - | ||||||||||||||||||||||||
| 609 | bool nsProcessing; | - | ||||||||||||||||||||||||
| 610 | QXmlLocator *locator; | - | ||||||||||||||||||||||||
| 611 | QXmlSimpleReader *reader; | - | ||||||||||||||||||||||||
| 612 | }; | - | ||||||||||||||||||||||||
| 613 | - | |||||||||||||||||||||||||
| 614 | /************************************************************** | - | ||||||||||||||||||||||||
| 615 | * | - | ||||||||||||||||||||||||
| 616 | * Functions for verifying legal data | - | ||||||||||||||||||||||||
| 617 | * | - | ||||||||||||||||||||||||
| 618 | **************************************************************/ | - | ||||||||||||||||||||||||
| 619 | QDomImplementation::InvalidDataPolicy QDomImplementationPrivate::invalidDataPolicy | - | ||||||||||||||||||||||||
| 620 | = QDomImplementation::AcceptInvalidChars; | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | // [5] Name ::= (Letter | '_' | ':') (NameChar)* | - | ||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||
| 624 | static QString fixedXmlName(const QString &_name, bool *ok, bool namespaces = false) | - | ||||||||||||||||||||||||
| 625 | { | - | ||||||||||||||||||||||||
| 626 | QString name, prefix; | - | ||||||||||||||||||||||||
| 627 | if (namespaces)
| 2-1021 | ||||||||||||||||||||||||
| 628 | qt_split_namespace(prefix, name, _name, true); executed 2 times by 1 test: qt_split_namespace(prefix, name, _name, true);Executed by:
| 2 | ||||||||||||||||||||||||
| 629 | else | - | ||||||||||||||||||||||||
| 630 | name = _name; executed 1021 times by 4 tests: name = _name;Executed by:
| 1021 | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 | if (name.isEmpty()) {
| 0-1023 | ||||||||||||||||||||||||
| 633 | *ok = false; | - | ||||||||||||||||||||||||
| 634 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 635 | } | - | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0-1023 | ||||||||||||||||||||||||
| 638 | *ok = true; | - | ||||||||||||||||||||||||
| 639 | return _name; executed 1023 times by 5 tests: return _name;Executed by:
| 1023 | ||||||||||||||||||||||||
| 640 | } | - | ||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | QString result; | - | ||||||||||||||||||||||||
| 643 | bool firstChar = true; | - | ||||||||||||||||||||||||
| 644 | for (int i = 0; i < name.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 645 | QChar c = name.at(i); | - | ||||||||||||||||||||||||
| 646 | if (firstChar) {
| 0 | ||||||||||||||||||||||||
| 647 | if (QXmlUtils::isLetter(c) || c.unicode() == '_' || c.unicode() == ':') {
| 0 | ||||||||||||||||||||||||
| 648 | result.append(c); | - | ||||||||||||||||||||||||
| 649 | firstChar = false; | - | ||||||||||||||||||||||||
| 650 | } else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 651 | *ok = false; | - | ||||||||||||||||||||||||
| 652 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||
| 654 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 655 | if (QXmlUtils::isNameChar(c))
| 0 | ||||||||||||||||||||||||
| 656 | result.append(c); never executed: result.append(c); | 0 | ||||||||||||||||||||||||
| 657 | else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 658 | *ok = false; | - | ||||||||||||||||||||||||
| 659 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 660 | } | - | ||||||||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | if (result.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 665 | *ok = false; | - | ||||||||||||||||||||||||
| 666 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 667 | } | - | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | *ok = true; | - | ||||||||||||||||||||||||
| 670 | if (namespaces && !prefix.isEmpty())
| 0 | ||||||||||||||||||||||||
| 671 | return prefix + QLatin1Char(':') + result; never executed: return prefix + QLatin1Char(':') + result; | 0 | ||||||||||||||||||||||||
| 672 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 673 | } | - | ||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | // [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) | - | ||||||||||||||||||||||||
| 676 | // '<', '&' and "]]>" will be escaped when writing | - | ||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||
| 678 | static QString fixedCharData(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 679 | { | - | ||||||||||||||||||||||||
| 680 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0-125 | ||||||||||||||||||||||||
| 681 | *ok = true; | - | ||||||||||||||||||||||||
| 682 | return data; executed 125 times by 2 tests: return data;Executed by:
| 125 | ||||||||||||||||||||||||
| 683 | } | - | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | QString result; | - | ||||||||||||||||||||||||
| 686 | for (int i = 0; i < data.size(); ++i) {
| 0 | ||||||||||||||||||||||||
| 687 | QChar c = data.at(i); | - | ||||||||||||||||||||||||
| 688 | if (QXmlUtils::isChar(c)) {
| 0 | ||||||||||||||||||||||||
| 689 | result.append(c); | - | ||||||||||||||||||||||||
| 690 | } else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 691 | *ok = false; | - | ||||||||||||||||||||||||
| 692 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 693 | } | - | ||||||||||||||||||||||||
| 694 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 | *ok = true; | - | ||||||||||||||||||||||||
| 697 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 698 | } | - | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | // [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->' | - | ||||||||||||||||||||||||
| 701 | // can't escape "--", since entities are not recognised within comments | - | ||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | static QString fixedComment(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 704 | { | - | ||||||||||||||||||||||||
| 705 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 706 | *ok = true; | - | ||||||||||||||||||||||||
| 707 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 708 | } | - | ||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 711 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 712 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||
| 714 | for (;;) { | - | ||||||||||||||||||||||||
| 715 | int idx = fixedData.indexOf(QLatin1String("--")); | - | ||||||||||||||||||||||||
| 716 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 717 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 718 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 719 | *ok = false; | - | ||||||||||||||||||||||||
| 720 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 721 | } | - | ||||||||||||||||||||||||
| 722 | fixedData.remove(idx, 2); | - | ||||||||||||||||||||||||
| 723 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | *ok = true; | - | ||||||||||||||||||||||||
| 726 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 727 | } | - | ||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | // [20] CData ::= (Char* - (Char* ']]>' Char*)) | - | ||||||||||||||||||||||||
| 730 | // can't escape "]]>", since entities are not recognised within comments | - | ||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||
| 732 | static QString fixedCDataSection(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 733 | { | - | ||||||||||||||||||||||||
| 734 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 735 | *ok = true; | - | ||||||||||||||||||||||||
| 736 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 737 | } | - | ||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 740 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 741 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||
| 743 | for (;;) { | - | ||||||||||||||||||||||||
| 744 | int idx = fixedData.indexOf(QLatin1String("]]>")); | - | ||||||||||||||||||||||||
| 745 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 746 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 747 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 748 | *ok = false; | - | ||||||||||||||||||||||||
| 749 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 750 | } | - | ||||||||||||||||||||||||
| 751 | fixedData.remove(idx, 3); | - | ||||||||||||||||||||||||
| 752 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||
| 754 | *ok = true; | - | ||||||||||||||||||||||||
| 755 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 756 | } | - | ||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | // [16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' | - | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | static QString fixedPIData(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 761 | { | - | ||||||||||||||||||||||||
| 762 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 763 | *ok = true; | - | ||||||||||||||||||||||||
| 764 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 765 | } | - | ||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | QString fixedData = fixedCharData(data, ok); | - | ||||||||||||||||||||||||
| 768 | if (!*ok)
| 0 | ||||||||||||||||||||||||
| 769 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||
| 771 | for (;;) { | - | ||||||||||||||||||||||||
| 772 | int idx = fixedData.indexOf(QLatin1String("?>")); | - | ||||||||||||||||||||||||
| 773 | if (idx == -1)
| 0 | ||||||||||||||||||||||||
| 774 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 775 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 776 | *ok = false; | - | ||||||||||||||||||||||||
| 777 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 778 | } | - | ||||||||||||||||||||||||
| 779 | fixedData.remove(idx, 2); | - | ||||||||||||||||||||||||
| 780 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | *ok = true; | - | ||||||||||||||||||||||||
| 783 | return fixedData; never executed: return fixedData; | 0 | ||||||||||||||||||||||||
| 784 | } | - | ||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | // [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" | - | ||||||||||||||||||||||||
| 787 | // The correct quote will be chosen when writing | - | ||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||
| 789 | static QString fixedPubidLiteral(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 790 | { | - | ||||||||||||||||||||||||
| 791 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 792 | *ok = true; | - | ||||||||||||||||||||||||
| 793 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 794 | } | - | ||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||
| 796 | QString result; | - | ||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||
| 798 | if(QXmlUtils::isPublicID(data))
| 0 | ||||||||||||||||||||||||
| 799 | result = data; never executed: result = data; | 0 | ||||||||||||||||||||||||
| 800 | else if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 801 | *ok = false; | - | ||||||||||||||||||||||||
| 802 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 803 | } | - | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | if (result.indexOf(QLatin1Char('\'')) != -1
| 0 | ||||||||||||||||||||||||
| 806 | && result.indexOf(QLatin1Char('"')) != -1) {
| 0 | ||||||||||||||||||||||||
| 807 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 808 | *ok = false; | - | ||||||||||||||||||||||||
| 809 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 810 | } else { | - | ||||||||||||||||||||||||
| 811 | result.remove(QLatin1Char('\'')); | - | ||||||||||||||||||||||||
| 812 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 813 | } | - | ||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||
| 815 | *ok = true; | - | ||||||||||||||||||||||||
| 816 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 817 | } | - | ||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | // [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") | - | ||||||||||||||||||||||||
| 820 | // The correct quote will be chosen when writing | - | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | static QString fixedSystemLiteral(const QString &data, bool *ok) | - | ||||||||||||||||||||||||
| 823 | { | - | ||||||||||||||||||||||||
| 824 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::AcceptInvalidChars) {
| 0 | ||||||||||||||||||||||||
| 825 | *ok = true; | - | ||||||||||||||||||||||||
| 826 | return data; never executed: return data; | 0 | ||||||||||||||||||||||||
| 827 | } | - | ||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||
| 829 | QString result = data; | - | ||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||
| 831 | if (result.indexOf(QLatin1Char('\'')) != -1
| 0 | ||||||||||||||||||||||||
| 832 | && result.indexOf(QLatin1Char('"')) != -1) {
| 0 | ||||||||||||||||||||||||
| 833 | if (QDomImplementationPrivate::invalidDataPolicy == QDomImplementation::ReturnNullNode) {
| 0 | ||||||||||||||||||||||||
| 834 | *ok = false; | - | ||||||||||||||||||||||||
| 835 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 836 | } else { | - | ||||||||||||||||||||||||
| 837 | result.remove(QLatin1Char('\'')); | - | ||||||||||||||||||||||||
| 838 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 839 | } | - | ||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | *ok = true; | - | ||||||||||||||||||||||||
| 842 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 843 | } | - | ||||||||||||||||||||||||
| 844 | - | |||||||||||||||||||||||||
| 845 | /************************************************************** | - | ||||||||||||||||||||||||
| 846 | * | - | ||||||||||||||||||||||||
| 847 | * QDomImplementationPrivate | - | ||||||||||||||||||||||||
| 848 | * | - | ||||||||||||||||||||||||
| 849 | **************************************************************/ | - | ||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | QDomImplementationPrivate* QDomImplementationPrivate::clone() | - | ||||||||||||||||||||||||
| 852 | { | - | ||||||||||||||||||||||||
| 853 | return new QDomImplementationPrivate; never executed: return new QDomImplementationPrivate; | 0 | ||||||||||||||||||||||||
| 854 | } | - | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | /************************************************************** | - | ||||||||||||||||||||||||
| 857 | * | - | ||||||||||||||||||||||||
| 858 | * QDomImplementation | - | ||||||||||||||||||||||||
| 859 | * | - | ||||||||||||||||||||||||
| 860 | **************************************************************/ | - | ||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | /*! | - | ||||||||||||||||||||||||
| 863 | \class QDomImplementation | - | ||||||||||||||||||||||||
| 864 | \reentrant | - | ||||||||||||||||||||||||
| 865 | \brief The QDomImplementation class provides information about the | - | ||||||||||||||||||||||||
| 866 | features of the DOM implementation. | - | ||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 869 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||
| 871 | This class describes the features that are supported by the DOM | - | ||||||||||||||||||||||||
| 872 | implementation. Currently the XML subset of DOM Level 1 and DOM | - | ||||||||||||||||||||||||
| 873 | Level 2 Core are supported. | - | ||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||
| 875 | Normally you will use the function QDomDocument::implementation() | - | ||||||||||||||||||||||||
| 876 | to get the implementation object. | - | ||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | You can create a new document type with createDocumentType() and a | - | ||||||||||||||||||||||||
| 879 | new document with createDocument(). | - | ||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 882 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 883 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. For a more | - | ||||||||||||||||||||||||
| 884 | general introduction of the DOM implementation see the QDomDocument | - | ||||||||||||||||||||||||
| 885 | documentation. | - | ||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||
| 887 | The QDom classes have a few issues of nonconformance with the XML | - | ||||||||||||||||||||||||
| 888 | specifications that cannot be fixed in Qt 4 without breaking backward | - | ||||||||||||||||||||||||
| 889 | compatibility. The Qt XML Patterns module and the QXmlStreamReader and | - | ||||||||||||||||||||||||
| 890 | QXmlStreamWriter classes have a higher degree of a conformance. | - | ||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | \sa hasFeature() | - | ||||||||||||||||||||||||
| 893 | */ | - | ||||||||||||||||||||||||
| 894 | - | |||||||||||||||||||||||||
| 895 | /*! | - | ||||||||||||||||||||||||
| 896 | Constructs a QDomImplementation object. | - | ||||||||||||||||||||||||
| 897 | */ | - | ||||||||||||||||||||||||
| 898 | QDomImplementation::QDomImplementation() | - | ||||||||||||||||||||||||
| 899 | { | - | ||||||||||||||||||||||||
| 900 | impl = 0; | - | ||||||||||||||||||||||||
| 901 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||
| 903 | /*! | - | ||||||||||||||||||||||||
| 904 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 905 | */ | - | ||||||||||||||||||||||||
| 906 | QDomImplementation::QDomImplementation(const QDomImplementation &x) | - | ||||||||||||||||||||||||
| 907 | { | - | ||||||||||||||||||||||||
| 908 | impl = x.impl; | - | ||||||||||||||||||||||||
| 909 | if (impl)
| 0 | ||||||||||||||||||||||||
| 910 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 911 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | QDomImplementation::QDomImplementation(QDomImplementationPrivate *p) | - | ||||||||||||||||||||||||
| 914 | { | - | ||||||||||||||||||||||||
| 915 | // We want to be co-owners, so increase the reference count | - | ||||||||||||||||||||||||
| 916 | impl = p; | - | ||||||||||||||||||||||||
| 917 | if (impl)
| 0 | ||||||||||||||||||||||||
| 918 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 919 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | /*! | - | ||||||||||||||||||||||||
| 922 | Assigns \a x to this DOM implementation. | - | ||||||||||||||||||||||||
| 923 | */ | - | ||||||||||||||||||||||||
| 924 | QDomImplementation& QDomImplementation::operator=(const QDomImplementation &x) | - | ||||||||||||||||||||||||
| 925 | { | - | ||||||||||||||||||||||||
| 926 | if (x.impl)
| 0 | ||||||||||||||||||||||||
| 927 | x.impl->ref.ref(); never executed: x.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 928 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 929 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 930 | impl = x.impl; | - | ||||||||||||||||||||||||
| 931 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 932 | } | - | ||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||
| 934 | /*! | - | ||||||||||||||||||||||||
| 935 | Returns \c true if \a x and this DOM implementation object were | - | ||||||||||||||||||||||||
| 936 | created from the same QDomDocument; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 937 | */ | - | ||||||||||||||||||||||||
| 938 | bool QDomImplementation::operator==(const QDomImplementation &x) const | - | ||||||||||||||||||||||||
| 939 | { | - | ||||||||||||||||||||||||
| 940 | return (impl == x.impl); never executed: return (impl == x.impl); | 0 | ||||||||||||||||||||||||
| 941 | } | - | ||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||
| 943 | /*! | - | ||||||||||||||||||||||||
| 944 | Returns \c true if \a x and this DOM implementation object were | - | ||||||||||||||||||||||||
| 945 | created from different QDomDocuments; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 946 | */ | - | ||||||||||||||||||||||||
| 947 | bool QDomImplementation::operator!=(const QDomImplementation &x) const | - | ||||||||||||||||||||||||
| 948 | { | - | ||||||||||||||||||||||||
| 949 | return (impl != x.impl); never executed: return (impl != x.impl); | 0 | ||||||||||||||||||||||||
| 950 | } | - | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | /*! | - | ||||||||||||||||||||||||
| 953 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 954 | */ | - | ||||||||||||||||||||||||
| 955 | QDomImplementation::~QDomImplementation() | - | ||||||||||||||||||||||||
| 956 | { | - | ||||||||||||||||||||||||
| 957 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 958 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 959 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||
| 961 | /*! | - | ||||||||||||||||||||||||
| 962 | The function returns \c true if QDom implements the requested \a | - | ||||||||||||||||||||||||
| 963 | version of a \a feature; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||
| 965 | The currently supported features and their versions: | - | ||||||||||||||||||||||||
| 966 | \table | - | ||||||||||||||||||||||||
| 967 | \header \li Feature \li Version | - | ||||||||||||||||||||||||
| 968 | \row \li XML \li 1.0 | - | ||||||||||||||||||||||||
| 969 | \endtable | - | ||||||||||||||||||||||||
| 970 | */ | - | ||||||||||||||||||||||||
| 971 | bool QDomImplementation::hasFeature(const QString& feature, const QString& version) const | - | ||||||||||||||||||||||||
| 972 | { | - | ||||||||||||||||||||||||
| 973 | if (feature == QLatin1String("XML")) {
| 0 | ||||||||||||||||||||||||
| 974 | if (version.isEmpty() || version == QLatin1String("1.0")) {
| 0 | ||||||||||||||||||||||||
| 975 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 976 | } | - | ||||||||||||||||||||||||
| 977 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 978 | // ### add DOM level 2 features | - | ||||||||||||||||||||||||
| 979 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 980 | } | - | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | /*! | - | ||||||||||||||||||||||||
| 983 | Creates a document type node for the name \a qName. | - | ||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | \a publicId specifies the public identifier of the external | - | ||||||||||||||||||||||||
| 986 | subset. If you specify an empty string (QString()) as the \a | - | ||||||||||||||||||||||||
| 987 | publicId, this means that the document type has no public | - | ||||||||||||||||||||||||
| 988 | identifier. | - | ||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||
| 990 | \a systemId specifies the system identifier of the external | - | ||||||||||||||||||||||||
| 991 | subset. If you specify an empty string as the \a systemId, this | - | ||||||||||||||||||||||||
| 992 | means that the document type has no system identifier. | - | ||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||
| 994 | Since you cannot have a public identifier without a system | - | ||||||||||||||||||||||||
| 995 | identifier, the public identifier is set to an empty string if | - | ||||||||||||||||||||||||
| 996 | there is no system identifier. | - | ||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||
| 998 | DOM level 2 does not support any other document type declaration | - | ||||||||||||||||||||||||
| 999 | features. | - | ||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | The only way you can use a document type that was created this | - | ||||||||||||||||||||||||
| 1002 | way, is in combination with the createDocument() function to | - | ||||||||||||||||||||||||
| 1003 | create a QDomDocument with this document type. | - | ||||||||||||||||||||||||
| 1004 | - | |||||||||||||||||||||||||
| 1005 | In the DOM specification, this is the only way to create a non-null | - | ||||||||||||||||||||||||
| 1006 | document. For historical reasons, Qt also allows to create the | - | ||||||||||||||||||||||||
| 1007 | document using the default empty constructor. The resulting document | - | ||||||||||||||||||||||||
| 1008 | is null, but becomes non-null when a factory function, for example | - | ||||||||||||||||||||||||
| 1009 | QDomDocument::createElement(), is called. The document also becomes | - | ||||||||||||||||||||||||
| 1010 | non-null when setContent() is called. | - | ||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||
| 1012 | \sa createDocument() | - | ||||||||||||||||||||||||
| 1013 | */ | - | ||||||||||||||||||||||||
| 1014 | QDomDocumentType QDomImplementation::createDocumentType(const QString& qName, const QString& publicId, const QString& systemId) | - | ||||||||||||||||||||||||
| 1015 | { | - | ||||||||||||||||||||||||
| 1016 | bool ok; | - | ||||||||||||||||||||||||
| 1017 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 1018 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1019 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | QString fixedPublicId = fixedPubidLiteral(publicId, &ok); | - | ||||||||||||||||||||||||
| 1022 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1023 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | QString fixedSystemId = fixedSystemLiteral(systemId, &ok); | - | ||||||||||||||||||||||||
| 1026 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 1027 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||
| 1029 | QDomDocumentTypePrivate *dt = new QDomDocumentTypePrivate(0); | - | ||||||||||||||||||||||||
| 1030 | dt->name = fixedName; | - | ||||||||||||||||||||||||
| 1031 | if (systemId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1032 | dt->publicId.clear(); | - | ||||||||||||||||||||||||
| 1033 | dt->systemId.clear(); | - | ||||||||||||||||||||||||
| 1034 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1035 | dt->publicId = fixedPublicId; | - | ||||||||||||||||||||||||
| 1036 | dt->systemId = fixedSystemId; | - | ||||||||||||||||||||||||
| 1037 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1038 | dt->ref.deref(); | - | ||||||||||||||||||||||||
| 1039 | return QDomDocumentType(dt); never executed: return QDomDocumentType(dt); | 0 | ||||||||||||||||||||||||
| 1040 | } | - | ||||||||||||||||||||||||
| 1041 | - | |||||||||||||||||||||||||
| 1042 | /*! | - | ||||||||||||||||||||||||
| 1043 | Creates a DOM document with the document type \a doctype. This | - | ||||||||||||||||||||||||
| 1044 | function also adds a root element node with the qualified name \a | - | ||||||||||||||||||||||||
| 1045 | qName and the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 1046 | */ | - | ||||||||||||||||||||||||
| 1047 | QDomDocument QDomImplementation::createDocument(const QString& nsURI, const QString& qName, const QDomDocumentType& doctype) | - | ||||||||||||||||||||||||
| 1048 | { | - | ||||||||||||||||||||||||
| 1049 | QDomDocument doc(doctype); | - | ||||||||||||||||||||||||
| 1050 | QDomElement root = doc.createElementNS(nsURI, qName); | - | ||||||||||||||||||||||||
| 1051 | if (root.isNull())
| 0 | ||||||||||||||||||||||||
| 1052 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 1053 | doc.appendChild(root); | - | ||||||||||||||||||||||||
| 1054 | return doc; never executed: return doc; | 0 | ||||||||||||||||||||||||
| 1055 | } | - | ||||||||||||||||||||||||
| 1056 | - | |||||||||||||||||||||||||
| 1057 | /*! | - | ||||||||||||||||||||||||
| 1058 | Returns \c false if the object was created by | - | ||||||||||||||||||||||||
| 1059 | QDomDocument::implementation(); otherwise returns \c true. | - | ||||||||||||||||||||||||
| 1060 | */ | - | ||||||||||||||||||||||||
| 1061 | bool QDomImplementation::isNull() | - | ||||||||||||||||||||||||
| 1062 | { | - | ||||||||||||||||||||||||
| 1063 | return (impl == 0); never executed: return (impl == 0); | 0 | ||||||||||||||||||||||||
| 1064 | } | - | ||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||
| 1066 | /*! | - | ||||||||||||||||||||||||
| 1067 | \enum QDomImplementation::InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||
| 1069 | This enum specifies what should be done when a factory function | - | ||||||||||||||||||||||||
| 1070 | in QDomDocument is called with invalid data. | - | ||||||||||||||||||||||||
| 1071 | \value AcceptInvalidChars The data should be stored in the DOM object | - | ||||||||||||||||||||||||
| 1072 | anyway. In this case the resulting XML document might not be well-formed. | - | ||||||||||||||||||||||||
| 1073 | This is the default value and QDom's behavior in Qt < 4.1. | - | ||||||||||||||||||||||||
| 1074 | \value DropInvalidChars The invalid characters should be removed from | - | ||||||||||||||||||||||||
| 1075 | the data. | - | ||||||||||||||||||||||||
| 1076 | \value ReturnNullNode The factory function should return a null node. | - | ||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||
| 1078 | \sa setInvalidDataPolicy(), invalidDataPolicy() | - | ||||||||||||||||||||||||
| 1079 | */ | - | ||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | /*! | - | ||||||||||||||||||||||||
| 1082 | \enum QDomNode::EncodingPolicy | - | ||||||||||||||||||||||||
| 1083 | \since 4.3 | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | This enum specifies how QDomNode::save() determines what encoding to use | - | ||||||||||||||||||||||||
| 1086 | when serializing. | - | ||||||||||||||||||||||||
| 1087 | - | |||||||||||||||||||||||||
| 1088 | \value EncodingFromDocument The encoding is fetched from the document. | - | ||||||||||||||||||||||||
| 1089 | \value EncodingFromTextStream The encoding is fetched from the QTextStream. | - | ||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | \sa QDomNode::save() | - | ||||||||||||||||||||||||
| 1092 | */ | - | ||||||||||||||||||||||||
| 1093 | - | |||||||||||||||||||||||||
| 1094 | /*! | - | ||||||||||||||||||||||||
| 1095 | \since 4.1 | - | ||||||||||||||||||||||||
| 1096 | \nonreentrant | - | ||||||||||||||||||||||||
| 1097 | - | |||||||||||||||||||||||||
| 1098 | Returns the invalid data policy, which specifies what should be done when | - | ||||||||||||||||||||||||
| 1099 | a factory function in QDomDocument is passed invalid data. | - | ||||||||||||||||||||||||
| 1100 | - | |||||||||||||||||||||||||
| 1101 | \sa setInvalidDataPolicy(), InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1102 | */ | - | ||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||
| 1104 | QDomImplementation::InvalidDataPolicy QDomImplementation::invalidDataPolicy() | - | ||||||||||||||||||||||||
| 1105 | { | - | ||||||||||||||||||||||||
| 1106 | return QDomImplementationPrivate::invalidDataPolicy; never executed: return QDomImplementationPrivate::invalidDataPolicy; | 0 | ||||||||||||||||||||||||
| 1107 | } | - | ||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||
| 1109 | /*! | - | ||||||||||||||||||||||||
| 1110 | \since 4.1 | - | ||||||||||||||||||||||||
| 1111 | \nonreentrant | - | ||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||
| 1113 | Sets the invalid data policy, which specifies what should be done when | - | ||||||||||||||||||||||||
| 1114 | a factory function in QDomDocument is passed invalid data. | - | ||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||
| 1116 | The \a policy is set for all instances of QDomDocument which already | - | ||||||||||||||||||||||||
| 1117 | exist and which will be created in the future. | - | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | \snippet code/src_xml_dom_qdom.cpp 0 | - | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | \sa invalidDataPolicy(), InvalidDataPolicy | - | ||||||||||||||||||||||||
| 1122 | */ | - | ||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||
| 1124 | void QDomImplementation::setInvalidDataPolicy(InvalidDataPolicy policy) | - | ||||||||||||||||||||||||
| 1125 | { | - | ||||||||||||||||||||||||
| 1126 | QDomImplementationPrivate::invalidDataPolicy = policy; | - | ||||||||||||||||||||||||
| 1127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||
| 1129 | /************************************************************** | - | ||||||||||||||||||||||||
| 1130 | * | - | ||||||||||||||||||||||||
| 1131 | * QDomNodeListPrivate | - | ||||||||||||||||||||||||
| 1132 | * | - | ||||||||||||||||||||||||
| 1133 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl) : ref(1) | - | ||||||||||||||||||||||||
| 1136 | { | - | ||||||||||||||||||||||||
| 1137 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1138 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1139 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1140 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1142 | - | |||||||||||||||||||||||||
| 1143 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &name) : | - | ||||||||||||||||||||||||
| 1144 | ref(1) | - | ||||||||||||||||||||||||
| 1145 | { | - | ||||||||||||||||||||||||
| 1146 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1147 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1148 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1149 | tagname = name; | - | ||||||||||||||||||||||||
| 1150 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1151 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||
| 1153 | QDomNodeListPrivate::QDomNodeListPrivate(QDomNodePrivate *n_impl, const QString &_nsURI, const QString &localName) : | - | ||||||||||||||||||||||||
| 1154 | ref(1) | - | ||||||||||||||||||||||||
| 1155 | { | - | ||||||||||||||||||||||||
| 1156 | node_impl = n_impl; | - | ||||||||||||||||||||||||
| 1157 | if (node_impl)
| 0 | ||||||||||||||||||||||||
| 1158 | node_impl->ref.ref(); never executed: node_impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1159 | tagname = localName; | - | ||||||||||||||||||||||||
| 1160 | nsURI = _nsURI; | - | ||||||||||||||||||||||||
| 1161 | timestamp = 0; | - | ||||||||||||||||||||||||
| 1162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | QDomNodeListPrivate::~QDomNodeListPrivate() | - | ||||||||||||||||||||||||
| 1165 | { | - | ||||||||||||||||||||||||
| 1166 | if (node_impl && !node_impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1167 | delete node_impl; never executed: delete node_impl; | 0 | ||||||||||||||||||||||||
| 1168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | bool QDomNodeListPrivate::operator==(const QDomNodeListPrivate &other) const | - | ||||||||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||||||||
| 1172 | return (node_impl == other.node_impl) && (tagname == other.tagname); never executed: return (node_impl == other.node_impl) && (tagname == other.tagname);
| 0 | ||||||||||||||||||||||||
| 1173 | } | - | ||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||
| 1175 | bool QDomNodeListPrivate::operator!=(const QDomNodeListPrivate &other) const | - | ||||||||||||||||||||||||
| 1176 | { | - | ||||||||||||||||||||||||
| 1177 | return (node_impl != other.node_impl) || (tagname != other.tagname); never executed: return (node_impl != other.node_impl) || (tagname != other.tagname);
| 0 | ||||||||||||||||||||||||
| 1178 | } | - | ||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||
| 1180 | void QDomNodeListPrivate::createList() | - | ||||||||||||||||||||||||
| 1181 | { | - | ||||||||||||||||||||||||
| 1182 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1183 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1186 | if (doc && timestamp != doc->nodeListTime)
| 0 | ||||||||||||||||||||||||
| 1187 | timestamp = doc->nodeListTime; never executed: timestamp = doc->nodeListTime; | 0 | ||||||||||||||||||||||||
| 1188 | - | |||||||||||||||||||||||||
| 1189 | QDomNodePrivate* p = node_impl->first; | - | ||||||||||||||||||||||||
| 1190 | - | |||||||||||||||||||||||||
| 1191 | list.clear(); | - | ||||||||||||||||||||||||
| 1192 | if (tagname.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1193 | while (p) {
| 0 | ||||||||||||||||||||||||
| 1194 | list.append(p); | - | ||||||||||||||||||||||||
| 1195 | p = p->next; | - | ||||||||||||||||||||||||
| 1196 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1197 | } else if (nsURI.isNull()) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1198 | while (p && p != node_impl) {
| 0 | ||||||||||||||||||||||||
| 1199 | if (p->isElement() && p->nodeName() == tagname) {
| 0 | ||||||||||||||||||||||||
| 1200 | list.append(p); | - | ||||||||||||||||||||||||
| 1201 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1202 | if (p->first)
| 0 | ||||||||||||||||||||||||
| 1203 | p = p->first; never executed: p = p->first; | 0 | ||||||||||||||||||||||||
| 1204 | else if (p->next)
| 0 | ||||||||||||||||||||||||
| 1205 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1206 | else { | - | ||||||||||||||||||||||||
| 1207 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1208 | while (p && p != node_impl && !p->next)
| 0 | ||||||||||||||||||||||||
| 1209 | p = p->parent(); never executed: p = p->parent(); | 0 | ||||||||||||||||||||||||
| 1210 | if (p && p != node_impl)
| 0 | ||||||||||||||||||||||||
| 1211 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1212 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1213 | } | - | ||||||||||||||||||||||||
| 1214 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1215 | while (p && p != node_impl) {
| 0 | ||||||||||||||||||||||||
| 1216 | if (p->isElement() && p->name==tagname && p->namespaceURI==nsURI) {
| 0 | ||||||||||||||||||||||||
| 1217 | list.append(p); | - | ||||||||||||||||||||||||
| 1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1219 | if (p->first)
| 0 | ||||||||||||||||||||||||
| 1220 | p = p->first; never executed: p = p->first; | 0 | ||||||||||||||||||||||||
| 1221 | else if (p->next)
| 0 | ||||||||||||||||||||||||
| 1222 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1223 | else { | - | ||||||||||||||||||||||||
| 1224 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1225 | while (p && p != node_impl && !p->next)
| 0 | ||||||||||||||||||||||||
| 1226 | p = p->parent(); never executed: p = p->parent(); | 0 | ||||||||||||||||||||||||
| 1227 | if (p && p != node_impl)
| 0 | ||||||||||||||||||||||||
| 1228 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 1229 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1230 | } | - | ||||||||||||||||||||||||
| 1231 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1232 | } | - | ||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||
| 1234 | QDomNodePrivate* QDomNodeListPrivate::item(int index) | - | ||||||||||||||||||||||||
| 1235 | { | - | ||||||||||||||||||||||||
| 1236 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1237 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||
| 1239 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1240 | if (!doc || timestamp != doc->nodeListTime)
| 0 | ||||||||||||||||||||||||
| 1241 | createList(); never executed: createList(); | 0 | ||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||
| 1243 | if (index >= list.size())
| 0 | ||||||||||||||||||||||||
| 1244 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1245 | - | |||||||||||||||||||||||||
| 1246 | return list.at(index); never executed: return list.at(index); | 0 | ||||||||||||||||||||||||
| 1247 | } | - | ||||||||||||||||||||||||
| 1248 | - | |||||||||||||||||||||||||
| 1249 | int QDomNodeListPrivate::length() const | - | ||||||||||||||||||||||||
| 1250 | { | - | ||||||||||||||||||||||||
| 1251 | if (!node_impl)
| 0 | ||||||||||||||||||||||||
| 1252 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||
| 1254 | const QDomDocumentPrivate *const doc = node_impl->ownerDocument(); | - | ||||||||||||||||||||||||
| 1255 | if (!doc || timestamp != doc->nodeListTime) {
| 0 | ||||||||||||||||||||||||
| 1256 | QDomNodeListPrivate *that = const_cast<QDomNodeListPrivate *>(this); | - | ||||||||||||||||||||||||
| 1257 | that->createList(); | - | ||||||||||||||||||||||||
| 1258 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | return list.count(); never executed: return list.count(); | 0 | ||||||||||||||||||||||||
| 1261 | } | - | ||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||
| 1263 | /************************************************************** | - | ||||||||||||||||||||||||
| 1264 | * | - | ||||||||||||||||||||||||
| 1265 | * QDomNodeList | - | ||||||||||||||||||||||||
| 1266 | * | - | ||||||||||||||||||||||||
| 1267 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||
| 1269 | /*! | - | ||||||||||||||||||||||||
| 1270 | \class QDomNodeList | - | ||||||||||||||||||||||||
| 1271 | \reentrant | - | ||||||||||||||||||||||||
| 1272 | \brief The QDomNodeList class is a list of QDomNode objects. | - | ||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||
| 1274 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 1275 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||
| 1277 | Lists can be obtained by QDomDocument::elementsByTagName() and | - | ||||||||||||||||||||||||
| 1278 | QDomNode::childNodes(). The Document Object Model (DOM) requires | - | ||||||||||||||||||||||||
| 1279 | these lists to be "live": whenever you change the underlying | - | ||||||||||||||||||||||||
| 1280 | document, the contents of the list will get updated. | - | ||||||||||||||||||||||||
| 1281 | - | |||||||||||||||||||||||||
| 1282 | You can get a particular node from the list with item(). The | - | ||||||||||||||||||||||||
| 1283 | number of items in the list is returned by length(). | - | ||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||
| 1285 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 1286 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 1287 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 1288 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 1289 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 1290 | - | |||||||||||||||||||||||||
| 1291 | \sa QDomNode::childNodes(), QDomDocument::elementsByTagName() | - | ||||||||||||||||||||||||
| 1292 | */ | - | ||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||
| 1294 | /*! | - | ||||||||||||||||||||||||
| 1295 | Creates an empty node list. | - | ||||||||||||||||||||||||
| 1296 | */ | - | ||||||||||||||||||||||||
| 1297 | QDomNodeList::QDomNodeList() | - | ||||||||||||||||||||||||
| 1298 | { | - | ||||||||||||||||||||||||
| 1299 | impl = 0; | - | ||||||||||||||||||||||||
| 1300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1301 | - | |||||||||||||||||||||||||
| 1302 | QDomNodeList::QDomNodeList(QDomNodeListPrivate* p) | - | ||||||||||||||||||||||||
| 1303 | { | - | ||||||||||||||||||||||||
| 1304 | impl = p; | - | ||||||||||||||||||||||||
| 1305 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1306 | - | |||||||||||||||||||||||||
| 1307 | /*! | - | ||||||||||||||||||||||||
| 1308 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 1309 | */ | - | ||||||||||||||||||||||||
| 1310 | QDomNodeList::QDomNodeList(const QDomNodeList& n) | - | ||||||||||||||||||||||||
| 1311 | { | - | ||||||||||||||||||||||||
| 1312 | impl = n.impl; | - | ||||||||||||||||||||||||
| 1313 | if (impl)
| 0 | ||||||||||||||||||||||||
| 1314 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1315 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||
| 1317 | /*! | - | ||||||||||||||||||||||||
| 1318 | Assigns \a n to this node list. | - | ||||||||||||||||||||||||
| 1319 | */ | - | ||||||||||||||||||||||||
| 1320 | QDomNodeList& QDomNodeList::operator=(const QDomNodeList &n) | - | ||||||||||||||||||||||||
| 1321 | { | - | ||||||||||||||||||||||||
| 1322 | if (n.impl)
| 0 | ||||||||||||||||||||||||
| 1323 | n.impl->ref.ref(); never executed: n.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 1324 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1325 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 1326 | impl = n.impl; | - | ||||||||||||||||||||||||
| 1327 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 1328 | } | - | ||||||||||||||||||||||||
| 1329 | - | |||||||||||||||||||||||||
| 1330 | /*! | - | ||||||||||||||||||||||||
| 1331 | Returns \c true if the node list \a n and this node list are equal; | - | ||||||||||||||||||||||||
| 1332 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1333 | */ | - | ||||||||||||||||||||||||
| 1334 | bool QDomNodeList::operator==(const QDomNodeList &n) const | - | ||||||||||||||||||||||||
| 1335 | { | - | ||||||||||||||||||||||||
| 1336 | if (impl == n.impl)
| 0 | ||||||||||||||||||||||||
| 1337 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 1338 | if (!impl || !n.impl)
| 0 | ||||||||||||||||||||||||
| 1339 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 1340 | return (*impl == *n.impl); never executed: return (*impl == *n.impl); | 0 | ||||||||||||||||||||||||
| 1341 | } | - | ||||||||||||||||||||||||
| 1342 | - | |||||||||||||||||||||||||
| 1343 | /*! | - | ||||||||||||||||||||||||
| 1344 | Returns \c true the node list \a n and this node list are not equal; | - | ||||||||||||||||||||||||
| 1345 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1346 | */ | - | ||||||||||||||||||||||||
| 1347 | bool QDomNodeList::operator!=(const QDomNodeList &n) const | - | ||||||||||||||||||||||||
| 1348 | { | - | ||||||||||||||||||||||||
| 1349 | return !operator==(n); never executed: return !operator==(n); | 0 | ||||||||||||||||||||||||
| 1350 | } | - | ||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||
| 1352 | /*! | - | ||||||||||||||||||||||||
| 1353 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 1354 | */ | - | ||||||||||||||||||||||||
| 1355 | QDomNodeList::~QDomNodeList() | - | ||||||||||||||||||||||||
| 1356 | { | - | ||||||||||||||||||||||||
| 1357 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1358 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 1359 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||
| 1361 | /*! | - | ||||||||||||||||||||||||
| 1362 | Returns the node at position \a index. | - | ||||||||||||||||||||||||
| 1363 | - | |||||||||||||||||||||||||
| 1364 | If \a index is negative or if \a index >= length() then a null | - | ||||||||||||||||||||||||
| 1365 | node is returned (i.e. a node for which QDomNode::isNull() returns | - | ||||||||||||||||||||||||
| 1366 | true). | - | ||||||||||||||||||||||||
| 1367 | - | |||||||||||||||||||||||||
| 1368 | \sa length() | - | ||||||||||||||||||||||||
| 1369 | */ | - | ||||||||||||||||||||||||
| 1370 | QDomNode QDomNodeList::item(int index) const | - | ||||||||||||||||||||||||
| 1371 | { | - | ||||||||||||||||||||||||
| 1372 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 1373 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 1374 | - | |||||||||||||||||||||||||
| 1375 | return QDomNode(impl->item(index)); never executed: return QDomNode(impl->item(index)); | 0 | ||||||||||||||||||||||||
| 1376 | } | - | ||||||||||||||||||||||||
| 1377 | - | |||||||||||||||||||||||||
| 1378 | /*! | - | ||||||||||||||||||||||||
| 1379 | Returns the number of nodes in the list. | - | ||||||||||||||||||||||||
| 1380 | */ | - | ||||||||||||||||||||||||
| 1381 | int QDomNodeList::length() const | - | ||||||||||||||||||||||||
| 1382 | { | - | ||||||||||||||||||||||||
| 1383 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 1384 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1385 | return impl->length(); never executed: return impl->length(); | 0 | ||||||||||||||||||||||||
| 1386 | } | - | ||||||||||||||||||||||||
| 1387 | - | |||||||||||||||||||||||||
| 1388 | /*! | - | ||||||||||||||||||||||||
| 1389 | \fn bool QDomNodeList::isEmpty() const | - | ||||||||||||||||||||||||
| 1390 | - | |||||||||||||||||||||||||
| 1391 | Returns \c true if the list contains no items; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 1392 | This function is provided for Qt API consistency. | - | ||||||||||||||||||||||||
| 1393 | */ | - | ||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||
| 1395 | /*! | - | ||||||||||||||||||||||||
| 1396 | \fn int QDomNodeList::count() const | - | ||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||
| 1398 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 1399 | */ | - | ||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||
| 1401 | /*! | - | ||||||||||||||||||||||||
| 1402 | \fn int QDomNodeList::size() const | - | ||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||
| 1404 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 1405 | */ | - | ||||||||||||||||||||||||
| 1406 | - | |||||||||||||||||||||||||
| 1407 | /*! | - | ||||||||||||||||||||||||
| 1408 | \fn QDomNode QDomNodeList::at(int index) const | - | ||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||
| 1410 | This function is provided for Qt API consistency. It is equivalent | - | ||||||||||||||||||||||||
| 1411 | to item(). | - | ||||||||||||||||||||||||
| 1412 | - | |||||||||||||||||||||||||
| 1413 | If \a index is negative or if \a index >= length() then a null | - | ||||||||||||||||||||||||
| 1414 | node is returned (i.e. a node for which QDomNode::isNull() returns | - | ||||||||||||||||||||||||
| 1415 | true). | - | ||||||||||||||||||||||||
| 1416 | */ | - | ||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||
| 1418 | /************************************************************** | - | ||||||||||||||||||||||||
| 1419 | * | - | ||||||||||||||||||||||||
| 1420 | * QDomNodePrivate | - | ||||||||||||||||||||||||
| 1421 | * | - | ||||||||||||||||||||||||
| 1422 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1423 | - | |||||||||||||||||||||||||
| 1424 | inline void QDomNodePrivate::setOwnerDocument(QDomDocumentPrivate *doc) | - | ||||||||||||||||||||||||
| 1425 | { | - | ||||||||||||||||||||||||
| 1426 | ownerNode = doc; | - | ||||||||||||||||||||||||
| 1427 | hasParent = false; | - | ||||||||||||||||||||||||
| 1428 | } executed 1392 times by 5 tests: end of blockExecuted by:
| 1392 | ||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||
| 1430 | QDomNodePrivate::QDomNodePrivate(QDomDocumentPrivate *doc, QDomNodePrivate *par) : ref(1) | - | ||||||||||||||||||||||||
| 1431 | { | - | ||||||||||||||||||||||||
| 1432 | if (par)
| 1392-2223 | ||||||||||||||||||||||||
| 1433 | setParent(par); executed 2223 times by 5 tests: setParent(par);Executed by:
| 2223 | ||||||||||||||||||||||||
| 1434 | else | - | ||||||||||||||||||||||||
| 1435 | setOwnerDocument(doc); executed 1392 times by 5 tests: setOwnerDocument(doc);Executed by:
| 1392 | ||||||||||||||||||||||||
| 1436 | prev = 0; | - | ||||||||||||||||||||||||
| 1437 | next = 0; | - | ||||||||||||||||||||||||
| 1438 | first = 0; | - | ||||||||||||||||||||||||
| 1439 | last = 0; | - | ||||||||||||||||||||||||
| 1440 | createdWithDom1Interface = true; | - | ||||||||||||||||||||||||
| 1441 | lineNumber = -1; | - | ||||||||||||||||||||||||
| 1442 | columnNumber = -1; | - | ||||||||||||||||||||||||
| 1443 | } executed 3615 times by 5 tests: end of blockExecuted by:
| 3615 | ||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||
| 1445 | QDomNodePrivate::QDomNodePrivate(QDomNodePrivate *n, bool deep) : ref(1) | - | ||||||||||||||||||||||||
| 1446 | { | - | ||||||||||||||||||||||||
| 1447 | setOwnerDocument(n->ownerDocument()); | - | ||||||||||||||||||||||||
| 1448 | prev = 0; | - | ||||||||||||||||||||||||
| 1449 | next = 0; | - | ||||||||||||||||||||||||
| 1450 | first = 0; | - | ||||||||||||||||||||||||
| 1451 | last = 0; | - | ||||||||||||||||||||||||
| 1452 | - | |||||||||||||||||||||||||
| 1453 | name = n->name; | - | ||||||||||||||||||||||||
| 1454 | value = n->value; | - | ||||||||||||||||||||||||
| 1455 | prefix = n->prefix; | - | ||||||||||||||||||||||||
| 1456 | namespaceURI = n->namespaceURI; | - | ||||||||||||||||||||||||
| 1457 | createdWithDom1Interface = n->createdWithDom1Interface; | - | ||||||||||||||||||||||||
| 1458 | lineNumber = -1; | - | ||||||||||||||||||||||||
| 1459 | columnNumber = -1; | - | ||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||
| 1461 | if (!deep)
| 0 | ||||||||||||||||||||||||
| 1462 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1463 | - | |||||||||||||||||||||||||
| 1464 | for (QDomNodePrivate* x = n->first; x; x = x->next)
| 0 | ||||||||||||||||||||||||
| 1465 | appendChild(x->cloneNode(true)); never executed: appendChild(x->cloneNode(true)); | 0 | ||||||||||||||||||||||||
| 1466 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1467 | - | |||||||||||||||||||||||||
| 1468 | QDomNodePrivate::~QDomNodePrivate() | - | ||||||||||||||||||||||||
| 1469 | { | - | ||||||||||||||||||||||||
| 1470 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1471 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 1472 | - | |||||||||||||||||||||||||
| 1473 | while (p) {
| 2015-3615 | ||||||||||||||||||||||||
| 1474 | n = p->next; | - | ||||||||||||||||||||||||
| 1475 | if (!p->ref.deref())
| 0-2015 | ||||||||||||||||||||||||
| 1476 | delete p; executed 2015 times by 5 tests: delete p;Executed by:
| 2015 | ||||||||||||||||||||||||
| 1477 | else | - | ||||||||||||||||||||||||
| 1478 | p->setNoParent(); never executed: p->setNoParent(); | 0 | ||||||||||||||||||||||||
| 1479 | p = n; | - | ||||||||||||||||||||||||
| 1480 | } executed 2015 times by 5 tests: end of blockExecuted by:
| 2015 | ||||||||||||||||||||||||
| 1481 | first = 0; | - | ||||||||||||||||||||||||
| 1482 | last = 0; | - | ||||||||||||||||||||||||
| 1483 | } executed 3615 times by 5 tests: end of blockExecuted by:
| 3615 | ||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||
| 1485 | void QDomNodePrivate::clear() | - | ||||||||||||||||||||||||
| 1486 | { | - | ||||||||||||||||||||||||
| 1487 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1488 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||
| 1490 | while (p) {
| 0-244 | ||||||||||||||||||||||||
| 1491 | n = p->next; | - | ||||||||||||||||||||||||
| 1492 | if (!p->ref.deref())
| 0 | ||||||||||||||||||||||||
| 1493 | delete p; never executed: delete p; | 0 | ||||||||||||||||||||||||
| 1494 | p = n; | - | ||||||||||||||||||||||||
| 1495 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1496 | first = 0; | - | ||||||||||||||||||||||||
| 1497 | last = 0; | - | ||||||||||||||||||||||||
| 1498 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||
| 1500 | QDomNodePrivate* QDomNodePrivate::namedItem(const QString &n) | - | ||||||||||||||||||||||||
| 1501 | { | - | ||||||||||||||||||||||||
| 1502 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 1503 | while (p) {
| 0-51 | ||||||||||||||||||||||||
| 1504 | if (p->nodeName() == n)
| 2-49 | ||||||||||||||||||||||||
| 1505 | return p; executed 49 times by 1 test: return p;Executed by:
| 49 | ||||||||||||||||||||||||
| 1506 | p = p->next; | - | ||||||||||||||||||||||||
| 1507 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1508 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1509 | } | - | ||||||||||||||||||||||||
| 1510 | - | |||||||||||||||||||||||||
| 1511 | - | |||||||||||||||||||||||||
| 1512 | QDomNodePrivate* QDomNodePrivate::insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 1513 | { | - | ||||||||||||||||||||||||
| 1514 | // Error check | - | ||||||||||||||||||||||||
| 1515 | if (!newChild)
| 0 | ||||||||||||||||||||||||
| 1516 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1517 | - | |||||||||||||||||||||||||
| 1518 | // Error check | - | ||||||||||||||||||||||||
| 1519 | if (newChild == refChild)
| 0 | ||||||||||||||||||||||||
| 1520 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||
| 1522 | // Error check | - | ||||||||||||||||||||||||
| 1523 | if (refChild && refChild->parent() != this)
| 0 | ||||||||||||||||||||||||
| 1524 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1525 | - | |||||||||||||||||||||||||
| 1526 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1527 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1528 | if(doc)
| 0 | ||||||||||||||||||||||||
| 1529 | doc->nodeListTime++; never executed: doc->nodeListTime++; | 0 | ||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||
| 1531 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1532 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1533 | if (newChild->isDocumentFragment()) {
| 0 | ||||||||||||||||||||||||
| 1534 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1535 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1536 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||
| 1538 | // New parent | - | ||||||||||||||||||||||||
| 1539 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1540 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1541 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1542 | n = n->next; | - | ||||||||||||||||||||||||
| 1543 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1544 | - | |||||||||||||||||||||||||
| 1545 | // Insert at the beginning ? | - | ||||||||||||||||||||||||
| 1546 | if (!refChild || refChild->prev == 0) {
| 0 | ||||||||||||||||||||||||
| 1547 | if (first)
| 0 | ||||||||||||||||||||||||
| 1548 | first->prev = newChild->last; never executed: first->prev = newChild->last; | 0 | ||||||||||||||||||||||||
| 1549 | newChild->last->next = first; | - | ||||||||||||||||||||||||
| 1550 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1551 | last = newChild->last; never executed: last = newChild->last; | 0 | ||||||||||||||||||||||||
| 1552 | first = newChild->first; | - | ||||||||||||||||||||||||
| 1553 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1554 | // Insert in the middle | - | ||||||||||||||||||||||||
| 1555 | newChild->last->next = refChild; | - | ||||||||||||||||||||||||
| 1556 | newChild->first->prev = refChild->prev; | - | ||||||||||||||||||||||||
| 1557 | refChild->prev->next = newChild->first; | - | ||||||||||||||||||||||||
| 1558 | refChild->prev = newChild->last; | - | ||||||||||||||||||||||||
| 1559 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1560 | - | |||||||||||||||||||||||||
| 1561 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1562 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1563 | - | |||||||||||||||||||||||||
| 1564 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1565 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1566 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1567 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1568 | } | - | ||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||
| 1570 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1571 | // ownership of the node. | - | ||||||||||||||||||||||||
| 1572 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1573 | - | |||||||||||||||||||||||||
| 1574 | if (newChild->parent())
| 0 | ||||||||||||||||||||||||
| 1575 | newChild->parent()->removeChild(newChild); never executed: newChild->parent()->removeChild(newChild); | 0 | ||||||||||||||||||||||||
| 1576 | - | |||||||||||||||||||||||||
| 1577 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1578 | - | |||||||||||||||||||||||||
| 1579 | if (!refChild) {
| 0 | ||||||||||||||||||||||||
| 1580 | if (first)
| 0 | ||||||||||||||||||||||||
| 1581 | first->prev = newChild; never executed: first->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1582 | newChild->next = first; | - | ||||||||||||||||||||||||
| 1583 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1584 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1585 | first = newChild; | - | ||||||||||||||||||||||||
| 1586 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1587 | } | - | ||||||||||||||||||||||||
| 1588 | - | |||||||||||||||||||||||||
| 1589 | if (refChild->prev == 0) {
| 0 | ||||||||||||||||||||||||
| 1590 | if (first)
| 0 | ||||||||||||||||||||||||
| 1591 | first->prev = newChild; never executed: first->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1592 | newChild->next = first; | - | ||||||||||||||||||||||||
| 1593 | if (!last)
| 0 | ||||||||||||||||||||||||
| 1594 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1595 | first = newChild; | - | ||||||||||||||||||||||||
| 1596 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1597 | } | - | ||||||||||||||||||||||||
| 1598 | - | |||||||||||||||||||||||||
| 1599 | newChild->next = refChild; | - | ||||||||||||||||||||||||
| 1600 | newChild->prev = refChild->prev; | - | ||||||||||||||||||||||||
| 1601 | refChild->prev->next = newChild; | - | ||||||||||||||||||||||||
| 1602 | refChild->prev = newChild; | - | ||||||||||||||||||||||||
| 1603 | - | |||||||||||||||||||||||||
| 1604 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1605 | } | - | ||||||||||||||||||||||||
| 1606 | - | |||||||||||||||||||||||||
| 1607 | QDomNodePrivate* QDomNodePrivate::insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 1608 | { | - | ||||||||||||||||||||||||
| 1609 | // Error check | - | ||||||||||||||||||||||||
| 1610 | if (!newChild)
| 0-2016 | ||||||||||||||||||||||||
| 1611 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||
| 1613 | // Error check | - | ||||||||||||||||||||||||
| 1614 | if (newChild == refChild)
| 0-2016 | ||||||||||||||||||||||||
| 1615 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||
| 1617 | // Error check | - | ||||||||||||||||||||||||
| 1618 | if (refChild && refChild->parent() != this)
| 0-2016 | ||||||||||||||||||||||||
| 1619 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||
| 1621 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1622 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1623 | if(doc)
| 0-2016 | ||||||||||||||||||||||||
| 1624 | doc->nodeListTime++; executed 2016 times by 5 tests: doc->nodeListTime++;Executed by:
| 2016 | ||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||
| 1626 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1627 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1628 | if (newChild->isDocumentFragment()) {
| 0-2016 | ||||||||||||||||||||||||
| 1629 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1630 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1631 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1632 | - | |||||||||||||||||||||||||
| 1633 | // New parent | - | ||||||||||||||||||||||||
| 1634 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1635 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1636 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1637 | n = n->next; | - | ||||||||||||||||||||||||
| 1638 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1639 | - | |||||||||||||||||||||||||
| 1640 | // Insert at the end | - | ||||||||||||||||||||||||
| 1641 | if (!refChild || refChild->next == 0) {
| 0 | ||||||||||||||||||||||||
| 1642 | if (last)
| 0 | ||||||||||||||||||||||||
| 1643 | last->next = newChild->first; never executed: last->next = newChild->first; | 0 | ||||||||||||||||||||||||
| 1644 | newChild->first->prev = last; | - | ||||||||||||||||||||||||
| 1645 | if (!first)
| 0 | ||||||||||||||||||||||||
| 1646 | first = newChild->first; never executed: first = newChild->first; | 0 | ||||||||||||||||||||||||
| 1647 | last = newChild->last; | - | ||||||||||||||||||||||||
| 1648 | } else { // Insert in the middle never executed: end of block | 0 | ||||||||||||||||||||||||
| 1649 | newChild->first->prev = refChild; | - | ||||||||||||||||||||||||
| 1650 | newChild->last->next = refChild->next; | - | ||||||||||||||||||||||||
| 1651 | refChild->next->prev = newChild->last; | - | ||||||||||||||||||||||||
| 1652 | refChild->next = newChild->first; | - | ||||||||||||||||||||||||
| 1653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1654 | - | |||||||||||||||||||||||||
| 1655 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1656 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1657 | - | |||||||||||||||||||||||||
| 1658 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1659 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1660 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1661 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1662 | } | - | ||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||
| 1664 | // Release new node from its current parent | - | ||||||||||||||||||||||||
| 1665 | if (newChild->parent())
| 868-1148 | ||||||||||||||||||||||||
| 1666 | newChild->parent()->removeChild(newChild); executed 868 times by 4 tests: newChild->parent()->removeChild(newChild);Executed by:
| 868 | ||||||||||||||||||||||||
| 1667 | - | |||||||||||||||||||||||||
| 1668 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1669 | // ownership of the node | - | ||||||||||||||||||||||||
| 1670 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1671 | - | |||||||||||||||||||||||||
| 1672 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1673 | - | |||||||||||||||||||||||||
| 1674 | // Insert at the end | - | ||||||||||||||||||||||||
| 1675 | if (!refChild) {
| 0-2016 | ||||||||||||||||||||||||
| 1676 | if (last)
| 267-1749 | ||||||||||||||||||||||||
| 1677 | last->next = newChild; executed 267 times by 4 tests: last->next = newChild;Executed by:
| 267 | ||||||||||||||||||||||||
| 1678 | newChild->prev = last; | - | ||||||||||||||||||||||||
| 1679 | if (!first)
| 267-1749 | ||||||||||||||||||||||||
| 1680 | first = newChild; executed 1749 times by 5 tests: first = newChild;Executed by:
| 1749 | ||||||||||||||||||||||||
| 1681 | last = newChild; | - | ||||||||||||||||||||||||
| 1682 | return newChild; executed 2016 times by 5 tests: return newChild;Executed by:
| 2016 | ||||||||||||||||||||||||
| 1683 | } | - | ||||||||||||||||||||||||
| 1684 | - | |||||||||||||||||||||||||
| 1685 | if (refChild->next == 0) {
| 0 | ||||||||||||||||||||||||
| 1686 | if (last)
| 0 | ||||||||||||||||||||||||
| 1687 | last->next = newChild; never executed: last->next = newChild; | 0 | ||||||||||||||||||||||||
| 1688 | newChild->prev = last; | - | ||||||||||||||||||||||||
| 1689 | if (!first)
| 0 | ||||||||||||||||||||||||
| 1690 | first = newChild; never executed: first = newChild; | 0 | ||||||||||||||||||||||||
| 1691 | last = newChild; | - | ||||||||||||||||||||||||
| 1692 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1693 | } | - | ||||||||||||||||||||||||
| 1694 | - | |||||||||||||||||||||||||
| 1695 | newChild->prev = refChild; | - | ||||||||||||||||||||||||
| 1696 | newChild->next = refChild->next; | - | ||||||||||||||||||||||||
| 1697 | refChild->next->prev = newChild; | - | ||||||||||||||||||||||||
| 1698 | refChild->next = newChild; | - | ||||||||||||||||||||||||
| 1699 | - | |||||||||||||||||||||||||
| 1700 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1701 | } | - | ||||||||||||||||||||||||
| 1702 | - | |||||||||||||||||||||||||
| 1703 | QDomNodePrivate* QDomNodePrivate::replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 1704 | { | - | ||||||||||||||||||||||||
| 1705 | if (!newChild || !oldChild)
| 0 | ||||||||||||||||||||||||
| 1706 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1707 | if (oldChild->parent() != this)
| 0 | ||||||||||||||||||||||||
| 1708 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1709 | if (newChild == oldChild)
| 0 | ||||||||||||||||||||||||
| 1710 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1711 | - | |||||||||||||||||||||||||
| 1712 | // mark lists as dirty | - | ||||||||||||||||||||||||
| 1713 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1714 | if(doc)
| 0 | ||||||||||||||||||||||||
| 1715 | doc->nodeListTime++; never executed: doc->nodeListTime++; | 0 | ||||||||||||||||||||||||
| 1716 | - | |||||||||||||||||||||||||
| 1717 | // Special handling for inserting a fragment. We just insert | - | ||||||||||||||||||||||||
| 1718 | // all elements of the fragment instead of the fragment itself. | - | ||||||||||||||||||||||||
| 1719 | if (newChild->isDocumentFragment()) {
| 0 | ||||||||||||||||||||||||
| 1720 | // Fragment is empty ? | - | ||||||||||||||||||||||||
| 1721 | if (newChild->first == 0)
| 0 | ||||||||||||||||||||||||
| 1722 | return newChild; never executed: return newChild; | 0 | ||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||
| 1724 | // New parent | - | ||||||||||||||||||||||||
| 1725 | QDomNodePrivate* n = newChild->first; | - | ||||||||||||||||||||||||
| 1726 | while (n) {
| 0 | ||||||||||||||||||||||||
| 1727 | n->setParent(this); | - | ||||||||||||||||||||||||
| 1728 | n = n->next; | - | ||||||||||||||||||||||||
| 1729 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1730 | - | |||||||||||||||||||||||||
| 1731 | - | |||||||||||||||||||||||||
| 1732 | if (oldChild->next)
| 0 | ||||||||||||||||||||||||
| 1733 | oldChild->next->prev = newChild->last; never executed: oldChild->next->prev = newChild->last; | 0 | ||||||||||||||||||||||||
| 1734 | if (oldChild->prev)
| 0 | ||||||||||||||||||||||||
| 1735 | oldChild->prev->next = newChild->first; never executed: oldChild->prev->next = newChild->first; | 0 | ||||||||||||||||||||||||
| 1736 | - | |||||||||||||||||||||||||
| 1737 | newChild->last->next = oldChild->next; | - | ||||||||||||||||||||||||
| 1738 | newChild->first->prev = oldChild->prev; | - | ||||||||||||||||||||||||
| 1739 | - | |||||||||||||||||||||||||
| 1740 | if (first == oldChild)
| 0 | ||||||||||||||||||||||||
| 1741 | first = newChild->first; never executed: first = newChild->first; | 0 | ||||||||||||||||||||||||
| 1742 | if (last == oldChild)
| 0 | ||||||||||||||||||||||||
| 1743 | last = newChild->last; never executed: last = newChild->last; | 0 | ||||||||||||||||||||||||
| 1744 | - | |||||||||||||||||||||||||
| 1745 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1746 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1747 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1748 | - | |||||||||||||||||||||||||
| 1749 | // No need to increase the reference since QDomDocumentFragment | - | ||||||||||||||||||||||||
| 1750 | // does not decrease the reference. | - | ||||||||||||||||||||||||
| 1751 | - | |||||||||||||||||||||||||
| 1752 | // Remove the nodes from the fragment | - | ||||||||||||||||||||||||
| 1753 | newChild->first = 0; | - | ||||||||||||||||||||||||
| 1754 | newChild->last = 0; | - | ||||||||||||||||||||||||
| 1755 | - | |||||||||||||||||||||||||
| 1756 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1757 | if (oldChild)
| 0 | ||||||||||||||||||||||||
| 1758 | oldChild->ref.deref(); never executed: oldChild->ref.deref(); | 0 | ||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||
| 1760 | return oldChild; never executed: return oldChild; | 0 | ||||||||||||||||||||||||
| 1761 | } | - | ||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||
| 1763 | // No more errors can occur now, so we take | - | ||||||||||||||||||||||||
| 1764 | // ownership of the node | - | ||||||||||||||||||||||||
| 1765 | newChild->ref.ref(); | - | ||||||||||||||||||||||||
| 1766 | - | |||||||||||||||||||||||||
| 1767 | // Release new node from its current parent | - | ||||||||||||||||||||||||
| 1768 | if (newChild->parent())
| 0 | ||||||||||||||||||||||||
| 1769 | newChild->parent()->removeChild(newChild); never executed: newChild->parent()->removeChild(newChild); | 0 | ||||||||||||||||||||||||
| 1770 | - | |||||||||||||||||||||||||
| 1771 | newChild->setParent(this); | - | ||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||
| 1773 | if (oldChild->next)
| 0 | ||||||||||||||||||||||||
| 1774 | oldChild->next->prev = newChild; never executed: oldChild->next->prev = newChild; | 0 | ||||||||||||||||||||||||
| 1775 | if (oldChild->prev)
| 0 | ||||||||||||||||||||||||
| 1776 | oldChild->prev->next = newChild; never executed: oldChild->prev->next = newChild; | 0 | ||||||||||||||||||||||||
| 1777 | - | |||||||||||||||||||||||||
| 1778 | newChild->next = oldChild->next; | - | ||||||||||||||||||||||||
| 1779 | newChild->prev = oldChild->prev; | - | ||||||||||||||||||||||||
| 1780 | - | |||||||||||||||||||||||||
| 1781 | if (first == oldChild)
| 0 | ||||||||||||||||||||||||
| 1782 | first = newChild; never executed: first = newChild; | 0 | ||||||||||||||||||||||||
| 1783 | if (last == oldChild)
| 0 | ||||||||||||||||||||||||
| 1784 | last = newChild; never executed: last = newChild; | 0 | ||||||||||||||||||||||||
| 1785 | - | |||||||||||||||||||||||||
| 1786 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1787 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1788 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1789 | - | |||||||||||||||||||||||||
| 1790 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1791 | if (oldChild)
| 0 | ||||||||||||||||||||||||
| 1792 | oldChild->ref.deref(); never executed: oldChild->ref.deref(); | 0 | ||||||||||||||||||||||||
| 1793 | - | |||||||||||||||||||||||||
| 1794 | return oldChild; never executed: return oldChild; | 0 | ||||||||||||||||||||||||
| 1795 | } | - | ||||||||||||||||||||||||
| 1796 | - | |||||||||||||||||||||||||
| 1797 | QDomNodePrivate* QDomNodePrivate::removeChild(QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 1798 | { | - | ||||||||||||||||||||||||
| 1799 | // Error check | - | ||||||||||||||||||||||||
| 1800 | if (oldChild->parent() != this)
| 0-869 | ||||||||||||||||||||||||
| 1801 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||
| 1803 | // "mark lists as dirty" | - | ||||||||||||||||||||||||
| 1804 | QDomDocumentPrivate *const doc = ownerDocument(); | - | ||||||||||||||||||||||||
| 1805 | if(doc)
| 0-869 | ||||||||||||||||||||||||
| 1806 | doc->nodeListTime++; executed 869 times by 4 tests: doc->nodeListTime++;Executed by:
| 869 | ||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||
| 1808 | // Perhaps oldChild was just created with "createElement" or that. In this case | - | ||||||||||||||||||||||||
| 1809 | // its parent is QDomDocument but it is not part of the documents child list. | - | ||||||||||||||||||||||||
| 1810 | if (oldChild->next == 0 && oldChild->prev == 0 && first != oldChild)
| 0-869 | ||||||||||||||||||||||||
| 1811 | return 0; executed 868 times by 4 tests: return 0;Executed by:
| 868 | ||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||
| 1813 | if (oldChild->next)
| 0-1 | ||||||||||||||||||||||||
| 1814 | oldChild->next->prev = oldChild->prev; never executed: oldChild->next->prev = oldChild->prev; | 0 | ||||||||||||||||||||||||
| 1815 | if (oldChild->prev)
| 0-1 | ||||||||||||||||||||||||
| 1816 | oldChild->prev->next = oldChild->next; never executed: oldChild->prev->next = oldChild->next; | 0 | ||||||||||||||||||||||||
| 1817 | - | |||||||||||||||||||||||||
| 1818 | if (last == oldChild)
| 0-1 | ||||||||||||||||||||||||
| 1819 | last = oldChild->prev; executed 1 time by 1 test: last = oldChild->prev;Executed by:
| 1 | ||||||||||||||||||||||||
| 1820 | if (first == oldChild)
| 0-1 | ||||||||||||||||||||||||
| 1821 | first = oldChild->next; executed 1 time by 1 test: first = oldChild->next;Executed by:
| 1 | ||||||||||||||||||||||||
| 1822 | - | |||||||||||||||||||||||||
| 1823 | oldChild->setNoParent(); | - | ||||||||||||||||||||||||
| 1824 | oldChild->next = 0; | - | ||||||||||||||||||||||||
| 1825 | oldChild->prev = 0; | - | ||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||
| 1827 | // We are no longer interested in the old node | - | ||||||||||||||||||||||||
| 1828 | oldChild->ref.deref(); | - | ||||||||||||||||||||||||
| 1829 | - | |||||||||||||||||||||||||
| 1830 | return oldChild; executed 1 time by 1 test: return oldChild;Executed by:
| 1 | ||||||||||||||||||||||||
| 1831 | } | - | ||||||||||||||||||||||||
| 1832 | - | |||||||||||||||||||||||||
| 1833 | QDomNodePrivate* QDomNodePrivate::appendChild(QDomNodePrivate* newChild) | - | ||||||||||||||||||||||||
| 1834 | { | - | ||||||||||||||||||||||||
| 1835 | // No reference manipulation needed. Done in insertAfter. | - | ||||||||||||||||||||||||
| 1836 | return insertAfter(newChild, 0); executed 2016 times by 5 tests: return insertAfter(newChild, 0);Executed by:
| 2016 | ||||||||||||||||||||||||
| 1837 | } | - | ||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||
| 1839 | QDomDocumentPrivate* QDomNodePrivate::ownerDocument() | - | ||||||||||||||||||||||||
| 1840 | { | - | ||||||||||||||||||||||||
| 1841 | QDomNodePrivate* p = this; | - | ||||||||||||||||||||||||
| 1842 | while (p && !p->isDocument()) {
| 0-14282 | ||||||||||||||||||||||||
| 1843 | if (!p->hasParent)
| 0-10529 | ||||||||||||||||||||||||
| 1844 | return (QDomDocumentPrivate*)p->ownerNode; never executed: return (QDomDocumentPrivate*)p->ownerNode; | 0 | ||||||||||||||||||||||||
| 1845 | p = p->parent(); | - | ||||||||||||||||||||||||
| 1846 | } executed 10529 times by 5 tests: end of blockExecuted by:
| 10529 | ||||||||||||||||||||||||
| 1847 | - | |||||||||||||||||||||||||
| 1848 | return static_cast<QDomDocumentPrivate *>(p); executed 3753 times by 5 tests: return static_cast<QDomDocumentPrivate *>(p);Executed by:
| 3753 | ||||||||||||||||||||||||
| 1849 | } | - | ||||||||||||||||||||||||
| 1850 | - | |||||||||||||||||||||||||
| 1851 | QDomNodePrivate* QDomNodePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 1852 | { | - | ||||||||||||||||||||||||
| 1853 | QDomNodePrivate* p = new QDomNodePrivate(this, deep); | - | ||||||||||||||||||||||||
| 1854 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 1855 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 1856 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 1857 | } | - | ||||||||||||||||||||||||
| 1858 | - | |||||||||||||||||||||||||
| 1859 | static void qNormalizeNode(QDomNodePrivate* n) | - | ||||||||||||||||||||||||
| 1860 | { | - | ||||||||||||||||||||||||
| 1861 | QDomNodePrivate* p = n->first; | - | ||||||||||||||||||||||||
| 1862 | QDomTextPrivate* t = 0; | - | ||||||||||||||||||||||||
| 1863 | - | |||||||||||||||||||||||||
| 1864 | while (p) {
| 0 | ||||||||||||||||||||||||
| 1865 | if (p->isText()) {
| 0 | ||||||||||||||||||||||||
| 1866 | if (t) {
| 0 | ||||||||||||||||||||||||
| 1867 | QDomNodePrivate* tmp = p->next; | - | ||||||||||||||||||||||||
| 1868 | t->appendData(p->nodeValue()); | - | ||||||||||||||||||||||||
| 1869 | n->removeChild(p); | - | ||||||||||||||||||||||||
| 1870 | p = tmp; | - | ||||||||||||||||||||||||
| 1871 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1872 | t = (QDomTextPrivate*)p; | - | ||||||||||||||||||||||||
| 1873 | p = p->next; | - | ||||||||||||||||||||||||
| 1874 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1875 | } else { | - | ||||||||||||||||||||||||
| 1876 | p = p->next; | - | ||||||||||||||||||||||||
| 1877 | t = 0; | - | ||||||||||||||||||||||||
| 1878 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1879 | } | - | ||||||||||||||||||||||||
| 1880 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1881 | void QDomNodePrivate::normalize() | - | ||||||||||||||||||||||||
| 1882 | { | - | ||||||||||||||||||||||||
| 1883 | // ### This one has moved from QDomElementPrivate to this position. It is | - | ||||||||||||||||||||||||
| 1884 | // not tested. | - | ||||||||||||||||||||||||
| 1885 | qNormalizeNode(this); | - | ||||||||||||||||||||||||
| 1886 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1887 | - | |||||||||||||||||||||||||
| 1888 | /*! \internal | - | ||||||||||||||||||||||||
| 1889 | \a depth is used for indentation, it seems. | - | ||||||||||||||||||||||||
| 1890 | */ | - | ||||||||||||||||||||||||
| 1891 | void QDomNodePrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 1892 | { | - | ||||||||||||||||||||||||
| 1893 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 1894 | while (n) {
| 94-160 | ||||||||||||||||||||||||
| 1895 | n->save(s, depth, indent); | - | ||||||||||||||||||||||||
| 1896 | n = n->next; | - | ||||||||||||||||||||||||
| 1897 | } executed 160 times by 1 test: end of blockExecuted by:
| 160 | ||||||||||||||||||||||||
| 1898 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 1899 | - | |||||||||||||||||||||||||
| 1900 | void QDomNodePrivate::setLocation(int lineNumber, int columnNumber) | - | ||||||||||||||||||||||||
| 1901 | { | - | ||||||||||||||||||||||||
| 1902 | this->lineNumber = lineNumber; | - | ||||||||||||||||||||||||
| 1903 | this->columnNumber = columnNumber; | - | ||||||||||||||||||||||||
| 1904 | } executed 1148 times by 5 tests: end of blockExecuted by:
| 1148 | ||||||||||||||||||||||||
| 1905 | - | |||||||||||||||||||||||||
| 1906 | /************************************************************** | - | ||||||||||||||||||||||||
| 1907 | * | - | ||||||||||||||||||||||||
| 1908 | * QDomNode | - | ||||||||||||||||||||||||
| 1909 | * | - | ||||||||||||||||||||||||
| 1910 | **************************************************************/ | - | ||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||
| 1912 | #define IMPL ((QDomNodePrivate*)impl) | - | ||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||
| 1914 | /*! | - | ||||||||||||||||||||||||
| 1915 | \class QDomNode | - | ||||||||||||||||||||||||
| 1916 | \reentrant | - | ||||||||||||||||||||||||
| 1917 | \brief The QDomNode class is the base class for all the nodes in a DOM tree. | - | ||||||||||||||||||||||||
| 1918 | - | |||||||||||||||||||||||||
| 1919 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 1920 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 1921 | - | |||||||||||||||||||||||||
| 1922 | - | |||||||||||||||||||||||||
| 1923 | Many functions in the DOM return a QDomNode. | - | ||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||
| 1925 | You can find out the type of a node using isAttr(), | - | ||||||||||||||||||||||||
| 1926 | isCDATASection(), isDocumentFragment(), isDocument(), | - | ||||||||||||||||||||||||
| 1927 | isDocumentType(), isElement(), isEntityReference(), isText(), | - | ||||||||||||||||||||||||
| 1928 | isEntity(), isNotation(), isProcessingInstruction(), | - | ||||||||||||||||||||||||
| 1929 | isCharacterData() and isComment(). | - | ||||||||||||||||||||||||
| 1930 | - | |||||||||||||||||||||||||
| 1931 | A QDomNode can be converted into one of its subclasses using | - | ||||||||||||||||||||||||
| 1932 | toAttr(), toCDATASection(), toDocumentFragment(), toDocument(), | - | ||||||||||||||||||||||||
| 1933 | toDocumentType(), toElement(), toEntityReference(), toText(), | - | ||||||||||||||||||||||||
| 1934 | toEntity(), toNotation(), toProcessingInstruction(), | - | ||||||||||||||||||||||||
| 1935 | toCharacterData() or toComment(). You can convert a node to a null | - | ||||||||||||||||||||||||
| 1936 | node with clear(). | - | ||||||||||||||||||||||||
| 1937 | - | |||||||||||||||||||||||||
| 1938 | Copies of the QDomNode class share their data using explicit | - | ||||||||||||||||||||||||
| 1939 | sharing. This means that modifying one node will change all | - | ||||||||||||||||||||||||
| 1940 | copies. This is especially useful in combination with functions | - | ||||||||||||||||||||||||
| 1941 | which return a QDomNode, e.g. firstChild(). You can make an | - | ||||||||||||||||||||||||
| 1942 | independent (deep) copy of the node with cloneNode(). | - | ||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||
| 1944 | A QDomNode can be null, much like a null pointer. Creating a copy | - | ||||||||||||||||||||||||
| 1945 | of a null node results in another null node. It is not | - | ||||||||||||||||||||||||
| 1946 | possible to modify a null node, but it is possible to assign another, | - | ||||||||||||||||||||||||
| 1947 | possibly non-null node to it. In this case, the copy of the null node | - | ||||||||||||||||||||||||
| 1948 | will remain null. You can check if a QDomNode is null by calling isNull(). | - | ||||||||||||||||||||||||
| 1949 | The empty constructor of a QDomNode (or any of the derived classes) creates | - | ||||||||||||||||||||||||
| 1950 | a null node. | - | ||||||||||||||||||||||||
| 1951 | - | |||||||||||||||||||||||||
| 1952 | Nodes are inserted with insertBefore(), insertAfter() or | - | ||||||||||||||||||||||||
| 1953 | appendChild(). You can replace one node with another using | - | ||||||||||||||||||||||||
| 1954 | replaceChild() and remove a node with removeChild(). | - | ||||||||||||||||||||||||
| 1955 | - | |||||||||||||||||||||||||
| 1956 | To traverse nodes use firstChild() to get a node's first child (if | - | ||||||||||||||||||||||||
| 1957 | any), and nextSibling() to traverse. QDomNode also provides | - | ||||||||||||||||||||||||
| 1958 | lastChild(), previousSibling() and parentNode(). To find the first | - | ||||||||||||||||||||||||
| 1959 | child node with a particular node name use namedItem(). | - | ||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||
| 1961 | To find out if a node has children use hasChildNodes() and to get | - | ||||||||||||||||||||||||
| 1962 | a list of all of a node's children use childNodes(). | - | ||||||||||||||||||||||||
| 1963 | - | |||||||||||||||||||||||||
| 1964 | The node's name and value (the meaning of which varies depending | - | ||||||||||||||||||||||||
| 1965 | on its type) is returned by nodeName() and nodeValue() | - | ||||||||||||||||||||||||
| 1966 | respectively. The node's type is returned by nodeType(). The | - | ||||||||||||||||||||||||
| 1967 | node's value can be set with setNodeValue(). | - | ||||||||||||||||||||||||
| 1968 | - | |||||||||||||||||||||||||
| 1969 | The document to which the node belongs is returned by | - | ||||||||||||||||||||||||
| 1970 | ownerDocument(). | - | ||||||||||||||||||||||||
| 1971 | - | |||||||||||||||||||||||||
| 1972 | Adjacent QDomText nodes can be merged into a single node with | - | ||||||||||||||||||||||||
| 1973 | normalize(). | - | ||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||
| 1975 | \l QDomElement nodes have attributes which can be retrieved with | - | ||||||||||||||||||||||||
| 1976 | attributes(). | - | ||||||||||||||||||||||||
| 1977 | - | |||||||||||||||||||||||||
| 1978 | QDomElement and QDomAttr nodes can have namespaces which can be | - | ||||||||||||||||||||||||
| 1979 | retrieved with namespaceURI(). Their local name is retrieved with | - | ||||||||||||||||||||||||
| 1980 | localName(), and their prefix with prefix(). The prefix can be set | - | ||||||||||||||||||||||||
| 1981 | with setPrefix(). | - | ||||||||||||||||||||||||
| 1982 | - | |||||||||||||||||||||||||
| 1983 | You can write the XML representation of the node to a text stream | - | ||||||||||||||||||||||||
| 1984 | with save(). | - | ||||||||||||||||||||||||
| 1985 | - | |||||||||||||||||||||||||
| 1986 | The following example looks for the first element in an XML document and | - | ||||||||||||||||||||||||
| 1987 | prints the names of all the elements that are its direct children. | - | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | \snippet code/src_xml_dom_qdom.cpp 1 | - | ||||||||||||||||||||||||
| 1990 | - | |||||||||||||||||||||||||
| 1991 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 1992 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 1993 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 1994 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 1995 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 1996 | */ | - | ||||||||||||||||||||||||
| 1997 | - | |||||||||||||||||||||||||
| 1998 | /*! | - | ||||||||||||||||||||||||
| 1999 | Constructs a \l{isNull()}{null} node. | - | ||||||||||||||||||||||||
| 2000 | */ | - | ||||||||||||||||||||||||
| 2001 | QDomNode::QDomNode() | - | ||||||||||||||||||||||||
| 2002 | { | - | ||||||||||||||||||||||||
| 2003 | impl = 0; | - | ||||||||||||||||||||||||
| 2004 | } executed 247 times by 5 tests: end of blockExecuted by:
| 247 | ||||||||||||||||||||||||
| 2005 | - | |||||||||||||||||||||||||
| 2006 | /*! | - | ||||||||||||||||||||||||
| 2007 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 2008 | - | |||||||||||||||||||||||||
| 2009 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 2010 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 2011 | cloneNode(). | - | ||||||||||||||||||||||||
| 2012 | */ | - | ||||||||||||||||||||||||
| 2013 | QDomNode::QDomNode(const QDomNode &n) | - | ||||||||||||||||||||||||
| 2014 | { | - | ||||||||||||||||||||||||
| 2015 | impl = n.impl; | - | ||||||||||||||||||||||||
| 2016 | if (impl)
| 0-193 | ||||||||||||||||||||||||
| 2017 | impl->ref.ref(); executed 193 times by 1 test: impl->ref.ref();Executed by:
| 193 | ||||||||||||||||||||||||
| 2018 | } executed 193 times by 1 test: end of blockExecuted by:
| 193 | ||||||||||||||||||||||||
| 2019 | - | |||||||||||||||||||||||||
| 2020 | /*! \internal | - | ||||||||||||||||||||||||
| 2021 | Constructs a new node for the data \a n. | - | ||||||||||||||||||||||||
| 2022 | */ | - | ||||||||||||||||||||||||
| 2023 | QDomNode::QDomNode(QDomNodePrivate *n) | - | ||||||||||||||||||||||||
| 2024 | { | - | ||||||||||||||||||||||||
| 2025 | impl = n; | - | ||||||||||||||||||||||||
| 2026 | if (impl)
| 0-418 | ||||||||||||||||||||||||
| 2027 | impl->ref.ref(); executed 418 times by 1 test: impl->ref.ref();Executed by:
| 418 | ||||||||||||||||||||||||
| 2028 | } executed 418 times by 1 test: end of blockExecuted by:
| 418 | ||||||||||||||||||||||||
| 2029 | - | |||||||||||||||||||||||||
| 2030 | /*! | - | ||||||||||||||||||||||||
| 2031 | Assigns a copy of \a n to this DOM node. | - | ||||||||||||||||||||||||
| 2032 | - | |||||||||||||||||||||||||
| 2033 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 2034 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 2035 | cloneNode(). | - | ||||||||||||||||||||||||
| 2036 | */ | - | ||||||||||||||||||||||||
| 2037 | QDomNode& QDomNode::operator=(const QDomNode &n) | - | ||||||||||||||||||||||||
| 2038 | { | - | ||||||||||||||||||||||||
| 2039 | if (n.impl)
| 0-71 | ||||||||||||||||||||||||
| 2040 | n.impl->ref.ref(); executed 71 times by 1 test: n.impl->ref.ref();Executed by:
| 71 | ||||||||||||||||||||||||
| 2041 | if (impl && !impl->ref.deref())
| 0-71 | ||||||||||||||||||||||||
| 2042 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 2043 | impl = n.impl; | - | ||||||||||||||||||||||||
| 2044 | return *this; executed 71 times by 1 test: return *this;Executed by:
| 71 | ||||||||||||||||||||||||
| 2045 | } | - | ||||||||||||||||||||||||
| 2046 | - | |||||||||||||||||||||||||
| 2047 | /*! | - | ||||||||||||||||||||||||
| 2048 | Returns \c true if \a n and this DOM node are equal; otherwise | - | ||||||||||||||||||||||||
| 2049 | returns \c false. | - | ||||||||||||||||||||||||
| 2050 | - | |||||||||||||||||||||||||
| 2051 | Any instance of QDomNode acts as a reference to an underlying data | - | ||||||||||||||||||||||||
| 2052 | structure in QDomDocument. The test for equality checks if the two | - | ||||||||||||||||||||||||
| 2053 | references point to the same underlying node. For example: | - | ||||||||||||||||||||||||
| 2054 | - | |||||||||||||||||||||||||
| 2055 | \snippet code/src_xml_dom_qdom.cpp 2 | - | ||||||||||||||||||||||||
| 2056 | - | |||||||||||||||||||||||||
| 2057 | The two nodes (QDomElement is a QDomNode subclass) both refer to | - | ||||||||||||||||||||||||
| 2058 | the document's root element, and \c {element1 == element2} will | - | ||||||||||||||||||||||||
| 2059 | return true. On the other hand: | - | ||||||||||||||||||||||||
| 2060 | - | |||||||||||||||||||||||||
| 2061 | \snippet code/src_xml_dom_qdom.cpp 3 | - | ||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||
| 2063 | Even though both nodes are empty elements carrying the same name, | - | ||||||||||||||||||||||||
| 2064 | \c {element3 == element4} will return false because they refer to | - | ||||||||||||||||||||||||
| 2065 | two different nodes in the underlying data structure. | - | ||||||||||||||||||||||||
| 2066 | */ | - | ||||||||||||||||||||||||
| 2067 | bool QDomNode::operator== (const QDomNode& n) const | - | ||||||||||||||||||||||||
| 2068 | { | - | ||||||||||||||||||||||||
| 2069 | return (impl == n.impl); never executed: return (impl == n.impl); | 0 | ||||||||||||||||||||||||
| 2070 | } | - | ||||||||||||||||||||||||
| 2071 | - | |||||||||||||||||||||||||
| 2072 | /*! | - | ||||||||||||||||||||||||
| 2073 | Returns \c true if \a n and this DOM node are not equal; otherwise | - | ||||||||||||||||||||||||
| 2074 | returns \c false. | - | ||||||||||||||||||||||||
| 2075 | */ | - | ||||||||||||||||||||||||
| 2076 | bool QDomNode::operator!= (const QDomNode& n) const | - | ||||||||||||||||||||||||
| 2077 | { | - | ||||||||||||||||||||||||
| 2078 | return (impl != n.impl); never executed: return (impl != n.impl); | 0 | ||||||||||||||||||||||||
| 2079 | } | - | ||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||
| 2081 | /*! | - | ||||||||||||||||||||||||
| 2082 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 2083 | */ | - | ||||||||||||||||||||||||
| 2084 | QDomNode::~QDomNode() | - | ||||||||||||||||||||||||
| 2085 | { | - | ||||||||||||||||||||||||
| 2086 | if (impl && !impl->ref.deref())
| 3-855 | ||||||||||||||||||||||||
| 2087 | delete impl; executed 244 times by 5 tests: delete impl;Executed by:
| 244 | ||||||||||||||||||||||||
| 2088 | } executed 858 times by 5 tests: end of blockExecuted by:
| 858 | ||||||||||||||||||||||||
| 2089 | - | |||||||||||||||||||||||||
| 2090 | /*! | - | ||||||||||||||||||||||||
| 2091 | Returns the name of the node. | - | ||||||||||||||||||||||||
| 2092 | - | |||||||||||||||||||||||||
| 2093 | The meaning of the name depends on the subclass: | - | ||||||||||||||||||||||||
| 2094 | - | |||||||||||||||||||||||||
| 2095 | \table | - | ||||||||||||||||||||||||
| 2096 | \header \li Name \li Meaning | - | ||||||||||||||||||||||||
| 2097 | \row \li QDomAttr \li The name of the attribute | - | ||||||||||||||||||||||||
| 2098 | \row \li QDomCDATASection \li The string "#cdata-section" | - | ||||||||||||||||||||||||
| 2099 | \row \li QDomComment \li The string "#comment" | - | ||||||||||||||||||||||||
| 2100 | \row \li QDomDocument \li The string "#document" | - | ||||||||||||||||||||||||
| 2101 | \row \li QDomDocumentFragment \li The string "#document-fragment" | - | ||||||||||||||||||||||||
| 2102 | \row \li QDomDocumentType \li The name of the document type | - | ||||||||||||||||||||||||
| 2103 | \row \li QDomElement \li The tag name | - | ||||||||||||||||||||||||
| 2104 | \row \li QDomEntity \li The name of the entity | - | ||||||||||||||||||||||||
| 2105 | \row \li QDomEntityReference \li The name of the referenced entity | - | ||||||||||||||||||||||||
| 2106 | \row \li QDomNotation \li The name of the notation | - | ||||||||||||||||||||||||
| 2107 | \row \li QDomProcessingInstruction \li The target of the processing instruction | - | ||||||||||||||||||||||||
| 2108 | \row \li QDomText \li The string "#text" | - | ||||||||||||||||||||||||
| 2109 | \endtable | - | ||||||||||||||||||||||||
| 2110 | - | |||||||||||||||||||||||||
| 2111 | \b{Note:} This function does not take the presence of namespaces into account | - | ||||||||||||||||||||||||
| 2112 | when processing the names of element and attribute nodes. As a result, the | - | ||||||||||||||||||||||||
| 2113 | returned name can contain any namespace prefix that may be present. | - | ||||||||||||||||||||||||
| 2114 | To obtain the node name of an element or attribute, use localName(); to | - | ||||||||||||||||||||||||
| 2115 | obtain the namespace prefix, use namespaceURI(). | - | ||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||
| 2117 | \sa nodeValue() | - | ||||||||||||||||||||||||
| 2118 | */ | - | ||||||||||||||||||||||||
| 2119 | QString QDomNode::nodeName() const | - | ||||||||||||||||||||||||
| 2120 | { | - | ||||||||||||||||||||||||
| 2121 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2122 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2123 | - | |||||||||||||||||||||||||
| 2124 | if (!IMPL->prefix.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2125 | return IMPL->prefix + QLatin1Char(':') + IMPL->name; never executed: return ((QDomNodePrivate*)impl)->prefix + QLatin1Char(':') + ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2126 | return IMPL->name; never executed: return ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2127 | } | - | ||||||||||||||||||||||||
| 2128 | - | |||||||||||||||||||||||||
| 2129 | /*! | - | ||||||||||||||||||||||||
| 2130 | Returns the value of the node. | - | ||||||||||||||||||||||||
| 2131 | - | |||||||||||||||||||||||||
| 2132 | The meaning of the value depends on the subclass: | - | ||||||||||||||||||||||||
| 2133 | \table | - | ||||||||||||||||||||||||
| 2134 | \header \li Name \li Meaning | - | ||||||||||||||||||||||||
| 2135 | \row \li QDomAttr \li The attribute value | - | ||||||||||||||||||||||||
| 2136 | \row \li QDomCDATASection \li The content of the CDATA section | - | ||||||||||||||||||||||||
| 2137 | \row \li QDomComment \li The comment | - | ||||||||||||||||||||||||
| 2138 | \row \li QDomProcessingInstruction \li The data of the processing instruction | - | ||||||||||||||||||||||||
| 2139 | \row \li QDomText \li The text | - | ||||||||||||||||||||||||
| 2140 | \endtable | - | ||||||||||||||||||||||||
| 2141 | - | |||||||||||||||||||||||||
| 2142 | All the other subclasses do not have a node value and will return | - | ||||||||||||||||||||||||
| 2143 | an empty string. | - | ||||||||||||||||||||||||
| 2144 | - | |||||||||||||||||||||||||
| 2145 | \sa setNodeValue(), nodeName() | - | ||||||||||||||||||||||||
| 2146 | */ | - | ||||||||||||||||||||||||
| 2147 | QString QDomNode::nodeValue() const | - | ||||||||||||||||||||||||
| 2148 | { | - | ||||||||||||||||||||||||
| 2149 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2150 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2151 | return IMPL->value; never executed: return ((QDomNodePrivate*)impl)->value; | 0 | ||||||||||||||||||||||||
| 2152 | } | - | ||||||||||||||||||||||||
| 2153 | - | |||||||||||||||||||||||||
| 2154 | /*! | - | ||||||||||||||||||||||||
| 2155 | Sets the node's value to \a v. | - | ||||||||||||||||||||||||
| 2156 | - | |||||||||||||||||||||||||
| 2157 | \sa nodeValue() | - | ||||||||||||||||||||||||
| 2158 | */ | - | ||||||||||||||||||||||||
| 2159 | void QDomNode::setNodeValue(const QString& v) | - | ||||||||||||||||||||||||
| 2160 | { | - | ||||||||||||||||||||||||
| 2161 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2162 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2163 | IMPL->setNodeValue(v); | - | ||||||||||||||||||||||||
| 2164 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||
| 2166 | /*! | - | ||||||||||||||||||||||||
| 2167 | \enum QDomNode::NodeType | - | ||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||
| 2169 | This enum defines the type of the node: | - | ||||||||||||||||||||||||
| 2170 | \value ElementNode | - | ||||||||||||||||||||||||
| 2171 | \value AttributeNode | - | ||||||||||||||||||||||||
| 2172 | \value TextNode | - | ||||||||||||||||||||||||
| 2173 | \value CDATASectionNode | - | ||||||||||||||||||||||||
| 2174 | \value EntityReferenceNode | - | ||||||||||||||||||||||||
| 2175 | \value EntityNode | - | ||||||||||||||||||||||||
| 2176 | \value ProcessingInstructionNode | - | ||||||||||||||||||||||||
| 2177 | \value CommentNode | - | ||||||||||||||||||||||||
| 2178 | \value DocumentNode | - | ||||||||||||||||||||||||
| 2179 | \value DocumentTypeNode | - | ||||||||||||||||||||||||
| 2180 | \value DocumentFragmentNode | - | ||||||||||||||||||||||||
| 2181 | \value NotationNode | - | ||||||||||||||||||||||||
| 2182 | \value BaseNode A QDomNode object, i.e. not a QDomNode subclass. | - | ||||||||||||||||||||||||
| 2183 | \value CharacterDataNode | - | ||||||||||||||||||||||||
| 2184 | */ | - | ||||||||||||||||||||||||
| 2185 | - | |||||||||||||||||||||||||
| 2186 | /*! | - | ||||||||||||||||||||||||
| 2187 | Returns the type of the node. | - | ||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||
| 2189 | \sa toAttr(), toCDATASection(), toDocumentFragment(), | - | ||||||||||||||||||||||||
| 2190 | toDocument(), toDocumentType(), toElement(), toEntityReference(), | - | ||||||||||||||||||||||||
| 2191 | toText(), toEntity(), toNotation(), toProcessingInstruction(), | - | ||||||||||||||||||||||||
| 2192 | toCharacterData(), toComment() | - | ||||||||||||||||||||||||
| 2193 | */ | - | ||||||||||||||||||||||||
| 2194 | QDomNode::NodeType QDomNode::nodeType() const | - | ||||||||||||||||||||||||
| 2195 | { | - | ||||||||||||||||||||||||
| 2196 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2197 | return QDomNode::BaseNode; never executed: return QDomNode::BaseNode; | 0 | ||||||||||||||||||||||||
| 2198 | return IMPL->nodeType(); never executed: return ((QDomNodePrivate*)impl)->nodeType(); | 0 | ||||||||||||||||||||||||
| 2199 | } | - | ||||||||||||||||||||||||
| 2200 | - | |||||||||||||||||||||||||
| 2201 | /*! | - | ||||||||||||||||||||||||
| 2202 | Returns the parent node. If this node has no parent, a null node | - | ||||||||||||||||||||||||
| 2203 | is returned (i.e. a node for which isNull() returns \c true). | - | ||||||||||||||||||||||||
| 2204 | */ | - | ||||||||||||||||||||||||
| 2205 | QDomNode QDomNode::parentNode() const | - | ||||||||||||||||||||||||
| 2206 | { | - | ||||||||||||||||||||||||
| 2207 | if (!impl)
| 0-33 | ||||||||||||||||||||||||
| 2208 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2209 | return QDomNode(IMPL->parent()); executed 33 times by 1 test: return QDomNode(((QDomNodePrivate*)impl)->parent());Executed by:
| 33 | ||||||||||||||||||||||||
| 2210 | } | - | ||||||||||||||||||||||||
| 2211 | - | |||||||||||||||||||||||||
| 2212 | /*! | - | ||||||||||||||||||||||||
| 2213 | Returns a list of all direct child nodes. | - | ||||||||||||||||||||||||
| 2214 | - | |||||||||||||||||||||||||
| 2215 | Most often you will call this function on a QDomElement object. | - | ||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||
| 2217 | For example, if the XML document looks like this: | - | ||||||||||||||||||||||||
| 2218 | - | |||||||||||||||||||||||||
| 2219 | \snippet code/src_xml_dom_qdom.cpp 4 | - | ||||||||||||||||||||||||
| 2220 | - | |||||||||||||||||||||||||
| 2221 | Then the list of child nodes for the "body"-element will contain | - | ||||||||||||||||||||||||
| 2222 | the node created by the <h1> tag and the node created by the | - | ||||||||||||||||||||||||
| 2223 | <p> tag. | - | ||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||
| 2225 | The nodes in the list are not copied; so changing the nodes in the | - | ||||||||||||||||||||||||
| 2226 | list will also change the children of this node. | - | ||||||||||||||||||||||||
| 2227 | - | |||||||||||||||||||||||||
| 2228 | \sa firstChild(), lastChild() | - | ||||||||||||||||||||||||
| 2229 | */ | - | ||||||||||||||||||||||||
| 2230 | QDomNodeList QDomNode::childNodes() const | - | ||||||||||||||||||||||||
| 2231 | { | - | ||||||||||||||||||||||||
| 2232 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2233 | return QDomNodeList(); never executed: return QDomNodeList(); | 0 | ||||||||||||||||||||||||
| 2234 | return QDomNodeList(new QDomNodeListPrivate(impl)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl)); | 0 | ||||||||||||||||||||||||
| 2235 | } | - | ||||||||||||||||||||||||
| 2236 | - | |||||||||||||||||||||||||
| 2237 | /*! | - | ||||||||||||||||||||||||
| 2238 | Returns the first child of the node. If there is no child node, a | - | ||||||||||||||||||||||||
| 2239 | \l{isNull()}{null node} is returned. Changing the | - | ||||||||||||||||||||||||
| 2240 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2241 | - | |||||||||||||||||||||||||
| 2242 | \sa lastChild(), childNodes() | - | ||||||||||||||||||||||||
| 2243 | */ | - | ||||||||||||||||||||||||
| 2244 | QDomNode QDomNode::firstChild() const | - | ||||||||||||||||||||||||
| 2245 | { | - | ||||||||||||||||||||||||
| 2246 | if (!impl)
| 0-79 | ||||||||||||||||||||||||
| 2247 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2248 | return QDomNode(IMPL->first); executed 79 times by 1 test: return QDomNode(((QDomNodePrivate*)impl)->first);Executed by:
| 79 | ||||||||||||||||||||||||
| 2249 | } | - | ||||||||||||||||||||||||
| 2250 | - | |||||||||||||||||||||||||
| 2251 | /*! | - | ||||||||||||||||||||||||
| 2252 | Returns the last child of the node. If there is no child node, a | - | ||||||||||||||||||||||||
| 2253 | \l{isNull()}{null node} is returned. Changing the | - | ||||||||||||||||||||||||
| 2254 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2255 | - | |||||||||||||||||||||||||
| 2256 | \sa firstChild(), childNodes() | - | ||||||||||||||||||||||||
| 2257 | */ | - | ||||||||||||||||||||||||
| 2258 | QDomNode QDomNode::lastChild() const | - | ||||||||||||||||||||||||
| 2259 | { | - | ||||||||||||||||||||||||
| 2260 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2261 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2262 | return QDomNode(IMPL->last); never executed: return QDomNode(((QDomNodePrivate*)impl)->last); | 0 | ||||||||||||||||||||||||
| 2263 | } | - | ||||||||||||||||||||||||
| 2264 | - | |||||||||||||||||||||||||
| 2265 | /*! | - | ||||||||||||||||||||||||
| 2266 | Returns the previous sibling in the document tree. Changing the | - | ||||||||||||||||||||||||
| 2267 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2268 | - | |||||||||||||||||||||||||
| 2269 | For example, if you have XML like this: | - | ||||||||||||||||||||||||
| 2270 | - | |||||||||||||||||||||||||
| 2271 | \snippet code/src_xml_dom_qdom.cpp 5 | - | ||||||||||||||||||||||||
| 2272 | - | |||||||||||||||||||||||||
| 2273 | and this QDomNode represents the <p> tag, previousSibling() | - | ||||||||||||||||||||||||
| 2274 | will return the node representing the <h1> tag. | - | ||||||||||||||||||||||||
| 2275 | - | |||||||||||||||||||||||||
| 2276 | \sa nextSibling() | - | ||||||||||||||||||||||||
| 2277 | */ | - | ||||||||||||||||||||||||
| 2278 | QDomNode QDomNode::previousSibling() const | - | ||||||||||||||||||||||||
| 2279 | { | - | ||||||||||||||||||||||||
| 2280 | if (!impl)
| 0-1 | ||||||||||||||||||||||||
| 2281 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2282 | return QDomNode(IMPL->prev); executed 1 time by 1 test: return QDomNode(((QDomNodePrivate*)impl)->prev);Executed by:
| 1 | ||||||||||||||||||||||||
| 2283 | } | - | ||||||||||||||||||||||||
| 2284 | - | |||||||||||||||||||||||||
| 2285 | /*! | - | ||||||||||||||||||||||||
| 2286 | Returns the next sibling in the document tree. Changing the | - | ||||||||||||||||||||||||
| 2287 | returned node will also change the node in the document tree. | - | ||||||||||||||||||||||||
| 2288 | - | |||||||||||||||||||||||||
| 2289 | If you have XML like this: | - | ||||||||||||||||||||||||
| 2290 | - | |||||||||||||||||||||||||
| 2291 | \snippet code/src_xml_dom_qdom.cpp 6 | - | ||||||||||||||||||||||||
| 2292 | - | |||||||||||||||||||||||||
| 2293 | and this QDomNode represents the <p> tag, nextSibling() will | - | ||||||||||||||||||||||||
| 2294 | return the node representing the <h2> tag. | - | ||||||||||||||||||||||||
| 2295 | - | |||||||||||||||||||||||||
| 2296 | \sa previousSibling() | - | ||||||||||||||||||||||||
| 2297 | */ | - | ||||||||||||||||||||||||
| 2298 | QDomNode QDomNode::nextSibling() const | - | ||||||||||||||||||||||||
| 2299 | { | - | ||||||||||||||||||||||||
| 2300 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2301 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2302 | return QDomNode(IMPL->next); never executed: return QDomNode(((QDomNodePrivate*)impl)->next); | 0 | ||||||||||||||||||||||||
| 2303 | } | - | ||||||||||||||||||||||||
| 2304 | - | |||||||||||||||||||||||||
| 2305 | - | |||||||||||||||||||||||||
| 2306 | // ###### don't think this is part of the DOM and | - | ||||||||||||||||||||||||
| 2307 | /*! | - | ||||||||||||||||||||||||
| 2308 | Returns a named node map of all attributes. Attributes are only | - | ||||||||||||||||||||||||
| 2309 | provided for \l{QDomElement}s. | - | ||||||||||||||||||||||||
| 2310 | - | |||||||||||||||||||||||||
| 2311 | Changing the attributes in the map will also change the attributes | - | ||||||||||||||||||||||||
| 2312 | of this QDomNode. | - | ||||||||||||||||||||||||
| 2313 | */ | - | ||||||||||||||||||||||||
| 2314 | QDomNamedNodeMap QDomNode::attributes() const | - | ||||||||||||||||||||||||
| 2315 | { | - | ||||||||||||||||||||||||
| 2316 | if (!impl || !impl->isElement())
| 0 | ||||||||||||||||||||||||
| 2317 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 2318 | - | |||||||||||||||||||||||||
| 2319 | return QDomNamedNodeMap(static_cast<QDomElementPrivate *>(impl)->attributes()); never executed: return QDomNamedNodeMap(static_cast<QDomElementPrivate *>(impl)->attributes()); | 0 | ||||||||||||||||||||||||
| 2320 | } | - | ||||||||||||||||||||||||
| 2321 | - | |||||||||||||||||||||||||
| 2322 | /*! | - | ||||||||||||||||||||||||
| 2323 | Returns the document to which this node belongs. | - | ||||||||||||||||||||||||
| 2324 | */ | - | ||||||||||||||||||||||||
| 2325 | QDomDocument QDomNode::ownerDocument() const | - | ||||||||||||||||||||||||
| 2326 | { | - | ||||||||||||||||||||||||
| 2327 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2328 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 2329 | return QDomDocument(IMPL->ownerDocument()); never executed: return QDomDocument(((QDomNodePrivate*)impl)->ownerDocument()); | 0 | ||||||||||||||||||||||||
| 2330 | } | - | ||||||||||||||||||||||||
| 2331 | - | |||||||||||||||||||||||||
| 2332 | /*! | - | ||||||||||||||||||||||||
| 2333 | Creates a deep (not shallow) copy of the QDomNode. | - | ||||||||||||||||||||||||
| 2334 | - | |||||||||||||||||||||||||
| 2335 | If \a deep is true, then the cloning is done recursively which | - | ||||||||||||||||||||||||
| 2336 | means that all the node's children are deep copied too. If \a deep | - | ||||||||||||||||||||||||
| 2337 | is false only the node itself is copied and the copy will have no | - | ||||||||||||||||||||||||
| 2338 | child nodes. | - | ||||||||||||||||||||||||
| 2339 | */ | - | ||||||||||||||||||||||||
| 2340 | QDomNode QDomNode::cloneNode(bool deep) const | - | ||||||||||||||||||||||||
| 2341 | { | - | ||||||||||||||||||||||||
| 2342 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2343 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2344 | return QDomNode(IMPL->cloneNode(deep)); never executed: return QDomNode(((QDomNodePrivate*)impl)->cloneNode(deep)); | 0 | ||||||||||||||||||||||||
| 2345 | } | - | ||||||||||||||||||||||||
| 2346 | - | |||||||||||||||||||||||||
| 2347 | /*! | - | ||||||||||||||||||||||||
| 2348 | Calling normalize() on an element converts all its children into a | - | ||||||||||||||||||||||||
| 2349 | standard form. This means that adjacent QDomText objects will be | - | ||||||||||||||||||||||||
| 2350 | merged into a single text object (QDomCDATASection nodes are not | - | ||||||||||||||||||||||||
| 2351 | merged). | - | ||||||||||||||||||||||||
| 2352 | */ | - | ||||||||||||||||||||||||
| 2353 | void QDomNode::normalize() | - | ||||||||||||||||||||||||
| 2354 | { | - | ||||||||||||||||||||||||
| 2355 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2356 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2357 | IMPL->normalize(); | - | ||||||||||||||||||||||||
| 2358 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2359 | - | |||||||||||||||||||||||||
| 2360 | /*! | - | ||||||||||||||||||||||||
| 2361 | Returns \c true if the DOM implementation implements the feature \a | - | ||||||||||||||||||||||||
| 2362 | feature and this feature is supported by this node in the version | - | ||||||||||||||||||||||||
| 2363 | \a version; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2364 | - | |||||||||||||||||||||||||
| 2365 | \sa QDomImplementation::hasFeature() | - | ||||||||||||||||||||||||
| 2366 | */ | - | ||||||||||||||||||||||||
| 2367 | bool QDomNode::isSupported(const QString& feature, const QString& version) const | - | ||||||||||||||||||||||||
| 2368 | { | - | ||||||||||||||||||||||||
| 2369 | QDomImplementation i; | - | ||||||||||||||||||||||||
| 2370 | return i.hasFeature(feature, version); never executed: return i.hasFeature(feature, version); | 0 | ||||||||||||||||||||||||
| 2371 | } | - | ||||||||||||||||||||||||
| 2372 | - | |||||||||||||||||||||||||
| 2373 | /*! | - | ||||||||||||||||||||||||
| 2374 | Returns the namespace URI of this node or an empty string if the | - | ||||||||||||||||||||||||
| 2375 | node has no namespace URI. | - | ||||||||||||||||||||||||
| 2376 | - | |||||||||||||||||||||||||
| 2377 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2378 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2379 | namespaces. A namespace URI must be specified at creation time and | - | ||||||||||||||||||||||||
| 2380 | cannot be changed later. | - | ||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||
| 2382 | \sa prefix(), localName(), QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2383 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2384 | */ | - | ||||||||||||||||||||||||
| 2385 | QString QDomNode::namespaceURI() const | - | ||||||||||||||||||||||||
| 2386 | { | - | ||||||||||||||||||||||||
| 2387 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2388 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2389 | return IMPL->namespaceURI; never executed: return ((QDomNodePrivate*)impl)->namespaceURI; | 0 | ||||||||||||||||||||||||
| 2390 | } | - | ||||||||||||||||||||||||
| 2391 | - | |||||||||||||||||||||||||
| 2392 | /*! | - | ||||||||||||||||||||||||
| 2393 | Returns the namespace prefix of the node or an empty string if the | - | ||||||||||||||||||||||||
| 2394 | node has no namespace prefix. | - | ||||||||||||||||||||||||
| 2395 | - | |||||||||||||||||||||||||
| 2396 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2397 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2398 | namespaces. A namespace prefix must be specified at creation time. | - | ||||||||||||||||||||||||
| 2399 | If a node was created with a namespace prefix, you can change it | - | ||||||||||||||||||||||||
| 2400 | later with setPrefix(). | - | ||||||||||||||||||||||||
| 2401 | - | |||||||||||||||||||||||||
| 2402 | If you create an element or attribute with | - | ||||||||||||||||||||||||
| 2403 | QDomDocument::createElement() or QDomDocument::createAttribute(), | - | ||||||||||||||||||||||||
| 2404 | the prefix will be an empty string. If you use | - | ||||||||||||||||||||||||
| 2405 | QDomDocument::createElementNS() or | - | ||||||||||||||||||||||||
| 2406 | QDomDocument::createAttributeNS() instead, the prefix will not be | - | ||||||||||||||||||||||||
| 2407 | an empty string; but it might be an empty string if the name does | - | ||||||||||||||||||||||||
| 2408 | not have a prefix. | - | ||||||||||||||||||||||||
| 2409 | - | |||||||||||||||||||||||||
| 2410 | \sa setPrefix(), localName(), namespaceURI(), | - | ||||||||||||||||||||||||
| 2411 | QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2412 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2413 | */ | - | ||||||||||||||||||||||||
| 2414 | QString QDomNode::prefix() const | - | ||||||||||||||||||||||||
| 2415 | { | - | ||||||||||||||||||||||||
| 2416 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2417 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2418 | return IMPL->prefix; never executed: return ((QDomNodePrivate*)impl)->prefix; | 0 | ||||||||||||||||||||||||
| 2419 | } | - | ||||||||||||||||||||||||
| 2420 | - | |||||||||||||||||||||||||
| 2421 | /*! | - | ||||||||||||||||||||||||
| 2422 | If the node has a namespace prefix, this function changes the | - | ||||||||||||||||||||||||
| 2423 | namespace prefix of the node to \a pre. Otherwise this function | - | ||||||||||||||||||||||||
| 2424 | does nothing. | - | ||||||||||||||||||||||||
| 2425 | - | |||||||||||||||||||||||||
| 2426 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2427 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2428 | namespaces. A namespace prefix must have be specified at creation | - | ||||||||||||||||||||||||
| 2429 | time; it is not possible to add a namespace prefix afterwards. | - | ||||||||||||||||||||||||
| 2430 | - | |||||||||||||||||||||||||
| 2431 | \sa prefix(), localName(), namespaceURI(), | - | ||||||||||||||||||||||||
| 2432 | QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2433 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2434 | */ | - | ||||||||||||||||||||||||
| 2435 | void QDomNode::setPrefix(const QString& pre) | - | ||||||||||||||||||||||||
| 2436 | { | - | ||||||||||||||||||||||||
| 2437 | if (!impl || IMPL->prefix.isNull())
| 0 | ||||||||||||||||||||||||
| 2438 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2439 | if (isAttr() || isElement())
| 0 | ||||||||||||||||||||||||
| 2440 | IMPL->prefix = pre; never executed: ((QDomNodePrivate*)impl)->prefix = pre; | 0 | ||||||||||||||||||||||||
| 2441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2442 | - | |||||||||||||||||||||||||
| 2443 | /*! | - | ||||||||||||||||||||||||
| 2444 | If the node uses namespaces, this function returns the local name | - | ||||||||||||||||||||||||
| 2445 | of the node; otherwise it returns an empty string. | - | ||||||||||||||||||||||||
| 2446 | - | |||||||||||||||||||||||||
| 2447 | Only nodes of type \l{QDomNode::NodeType}{ElementNode} or | - | ||||||||||||||||||||||||
| 2448 | \l{QDomNode::NodeType}{AttributeNode} can have | - | ||||||||||||||||||||||||
| 2449 | namespaces. A namespace must have been specified at creation time; | - | ||||||||||||||||||||||||
| 2450 | it is not possible to add a namespace afterwards. | - | ||||||||||||||||||||||||
| 2451 | - | |||||||||||||||||||||||||
| 2452 | \sa prefix(), namespaceURI(), QDomDocument::createElementNS(), | - | ||||||||||||||||||||||||
| 2453 | QDomDocument::createAttributeNS() | - | ||||||||||||||||||||||||
| 2454 | */ | - | ||||||||||||||||||||||||
| 2455 | QString QDomNode::localName() const | - | ||||||||||||||||||||||||
| 2456 | { | - | ||||||||||||||||||||||||
| 2457 | if (!impl || IMPL->createdWithDom1Interface)
| 0 | ||||||||||||||||||||||||
| 2458 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 2459 | return IMPL->name; never executed: return ((QDomNodePrivate*)impl)->name; | 0 | ||||||||||||||||||||||||
| 2460 | } | - | ||||||||||||||||||||||||
| 2461 | - | |||||||||||||||||||||||||
| 2462 | /*! | - | ||||||||||||||||||||||||
| 2463 | Returns \c true if the node has attributes; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2464 | - | |||||||||||||||||||||||||
| 2465 | \sa attributes() | - | ||||||||||||||||||||||||
| 2466 | */ | - | ||||||||||||||||||||||||
| 2467 | bool QDomNode::hasAttributes() const | - | ||||||||||||||||||||||||
| 2468 | { | - | ||||||||||||||||||||||||
| 2469 | if (!impl || !impl->isElement())
| 0-26 | ||||||||||||||||||||||||
| 2470 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2471 | return static_cast<QDomElementPrivate *>(impl)->hasAttributes(); executed 26 times by 1 test: return static_cast<QDomElementPrivate *>(impl)->hasAttributes();Executed by:
| 26 | ||||||||||||||||||||||||
| 2472 | } | - | ||||||||||||||||||||||||
| 2473 | - | |||||||||||||||||||||||||
| 2474 | /*! | - | ||||||||||||||||||||||||
| 2475 | Inserts the node \a newChild before the child node \a refChild. | - | ||||||||||||||||||||||||
| 2476 | \a refChild must be a direct child of this node. If \a refChild is | - | ||||||||||||||||||||||||
| 2477 | \l{isNull()}{null} then \a newChild is inserted as the | - | ||||||||||||||||||||||||
| 2478 | node's first child. | - | ||||||||||||||||||||||||
| 2479 | - | |||||||||||||||||||||||||
| 2480 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2481 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2482 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2483 | - | |||||||||||||||||||||||||
| 2484 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2485 | fragment are removed from the fragment and inserted before \a | - | ||||||||||||||||||||||||
| 2486 | refChild. | - | ||||||||||||||||||||||||
| 2487 | - | |||||||||||||||||||||||||
| 2488 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2489 | - | |||||||||||||||||||||||||
| 2490 | The DOM specification disallow inserting attribute nodes, but due | - | ||||||||||||||||||||||||
| 2491 | to historical reasons QDom accept them nevertheless. | - | ||||||||||||||||||||||||
| 2492 | - | |||||||||||||||||||||||||
| 2493 | \sa insertAfter(), replaceChild(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2494 | */ | - | ||||||||||||||||||||||||
| 2495 | QDomNode QDomNode::insertBefore(const QDomNode& newChild, const QDomNode& refChild) | - | ||||||||||||||||||||||||
| 2496 | { | - | ||||||||||||||||||||||||
| 2497 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2498 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2499 | return QDomNode(IMPL->insertBefore(newChild.impl, refChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->insertBefore(newChild.impl, refChild.impl)); | 0 | ||||||||||||||||||||||||
| 2500 | } | - | ||||||||||||||||||||||||
| 2501 | - | |||||||||||||||||||||||||
| 2502 | /*! | - | ||||||||||||||||||||||||
| 2503 | Inserts the node \a newChild after the child node \a refChild. \a | - | ||||||||||||||||||||||||
| 2504 | refChild must be a direct child of this node. If \a refChild is | - | ||||||||||||||||||||||||
| 2505 | \l{isNull()}{null} then \a newChild is appended as this | - | ||||||||||||||||||||||||
| 2506 | node's last child. | - | ||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||
| 2508 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2509 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2510 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2511 | - | |||||||||||||||||||||||||
| 2512 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2513 | fragment are removed from the fragment and inserted after \a | - | ||||||||||||||||||||||||
| 2514 | refChild. | - | ||||||||||||||||||||||||
| 2515 | - | |||||||||||||||||||||||||
| 2516 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2517 | - | |||||||||||||||||||||||||
| 2518 | The DOM specification disallow inserting attribute nodes, but due | - | ||||||||||||||||||||||||
| 2519 | to historical reasons QDom accept them nevertheless. | - | ||||||||||||||||||||||||
| 2520 | - | |||||||||||||||||||||||||
| 2521 | \sa insertBefore(), replaceChild(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2522 | */ | - | ||||||||||||||||||||||||
| 2523 | QDomNode QDomNode::insertAfter(const QDomNode& newChild, const QDomNode& refChild) | - | ||||||||||||||||||||||||
| 2524 | { | - | ||||||||||||||||||||||||
| 2525 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2526 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2527 | return QDomNode(IMPL->insertAfter(newChild.impl, refChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->insertAfter(newChild.impl, refChild.impl)); | 0 | ||||||||||||||||||||||||
| 2528 | } | - | ||||||||||||||||||||||||
| 2529 | - | |||||||||||||||||||||||||
| 2530 | /*! | - | ||||||||||||||||||||||||
| 2531 | Replaces \a oldChild with \a newChild. \a oldChild must be a | - | ||||||||||||||||||||||||
| 2532 | direct child of this node. | - | ||||||||||||||||||||||||
| 2533 | - | |||||||||||||||||||||||||
| 2534 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2535 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2536 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2537 | - | |||||||||||||||||||||||||
| 2538 | If \a newChild is a QDomDocumentFragment, then \a oldChild is | - | ||||||||||||||||||||||||
| 2539 | replaced by all of the children of the fragment. | - | ||||||||||||||||||||||||
| 2540 | - | |||||||||||||||||||||||||
| 2541 | Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} an failure. | - | ||||||||||||||||||||||||
| 2542 | - | |||||||||||||||||||||||||
| 2543 | \sa insertBefore(), insertAfter(), removeChild(), appendChild() | - | ||||||||||||||||||||||||
| 2544 | */ | - | ||||||||||||||||||||||||
| 2545 | QDomNode QDomNode::replaceChild(const QDomNode& newChild, const QDomNode& oldChild) | - | ||||||||||||||||||||||||
| 2546 | { | - | ||||||||||||||||||||||||
| 2547 | if (!impl || !newChild.impl || !oldChild.impl)
| 0 | ||||||||||||||||||||||||
| 2548 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2549 | return QDomNode(IMPL->replaceChild(newChild.impl, oldChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->replaceChild(newChild.impl, oldChild.impl)); | 0 | ||||||||||||||||||||||||
| 2550 | } | - | ||||||||||||||||||||||||
| 2551 | - | |||||||||||||||||||||||||
| 2552 | /*! | - | ||||||||||||||||||||||||
| 2553 | Removes \a oldChild from the list of children. \a oldChild must be | - | ||||||||||||||||||||||||
| 2554 | a direct child of this node. | - | ||||||||||||||||||||||||
| 2555 | - | |||||||||||||||||||||||||
| 2556 | Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2557 | - | |||||||||||||||||||||||||
| 2558 | \sa insertBefore(), insertAfter(), replaceChild(), appendChild() | - | ||||||||||||||||||||||||
| 2559 | */ | - | ||||||||||||||||||||||||
| 2560 | QDomNode QDomNode::removeChild(const QDomNode& oldChild) | - | ||||||||||||||||||||||||
| 2561 | { | - | ||||||||||||||||||||||||
| 2562 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2563 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2564 | - | |||||||||||||||||||||||||
| 2565 | if (oldChild.isNull())
| 0 | ||||||||||||||||||||||||
| 2566 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2567 | - | |||||||||||||||||||||||||
| 2568 | return QDomNode(IMPL->removeChild(oldChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->removeChild(oldChild.impl)); | 0 | ||||||||||||||||||||||||
| 2569 | } | - | ||||||||||||||||||||||||
| 2570 | - | |||||||||||||||||||||||||
| 2571 | /*! | - | ||||||||||||||||||||||||
| 2572 | Appends \a newChild as the node's last child. | - | ||||||||||||||||||||||||
| 2573 | - | |||||||||||||||||||||||||
| 2574 | If \a newChild is the child of another node, it is reparented to | - | ||||||||||||||||||||||||
| 2575 | this node. If \a newChild is a child of this node, then its | - | ||||||||||||||||||||||||
| 2576 | position in the list of children is changed. | - | ||||||||||||||||||||||||
| 2577 | - | |||||||||||||||||||||||||
| 2578 | If \a newChild is a QDomDocumentFragment, then the children of the | - | ||||||||||||||||||||||||
| 2579 | fragment are removed from the fragment and appended. | - | ||||||||||||||||||||||||
| 2580 | - | |||||||||||||||||||||||||
| 2581 | If \a newChild is a QDomElement and this node is a QDomDocument that | - | ||||||||||||||||||||||||
| 2582 | already has an element node as a child, \a newChild is not added as | - | ||||||||||||||||||||||||
| 2583 | a child and a null node is returned. | - | ||||||||||||||||||||||||
| 2584 | - | |||||||||||||||||||||||||
| 2585 | Returns a new reference to \a newChild on success or a \l{isNull()}{null node} on failure. | - | ||||||||||||||||||||||||
| 2586 | - | |||||||||||||||||||||||||
| 2587 | Calling this function on a null node(created, for example, with | - | ||||||||||||||||||||||||
| 2588 | the default constructor) does nothing and returns a \l{isNull()}{null node}. | - | ||||||||||||||||||||||||
| 2589 | - | |||||||||||||||||||||||||
| 2590 | The DOM specification disallow inserting attribute nodes, but for | - | ||||||||||||||||||||||||
| 2591 | historical reasons, QDom accepts them anyway. | - | ||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||
| 2593 | \sa insertBefore(), insertAfter(), replaceChild(), removeChild() | - | ||||||||||||||||||||||||
| 2594 | */ | - | ||||||||||||||||||||||||
| 2595 | QDomNode QDomNode::appendChild(const QDomNode& newChild) | - | ||||||||||||||||||||||||
| 2596 | { | - | ||||||||||||||||||||||||
| 2597 | if (!impl) {
| 0 | ||||||||||||||||||||||||
| 2598 | qWarning("Calling appendChild() on a null node does nothing."); | - | ||||||||||||||||||||||||
| 2599 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2600 | } | - | ||||||||||||||||||||||||
| 2601 | return QDomNode(IMPL->appendChild(newChild.impl)); never executed: return QDomNode(((QDomNodePrivate*)impl)->appendChild(newChild.impl)); | 0 | ||||||||||||||||||||||||
| 2602 | } | - | ||||||||||||||||||||||||
| 2603 | - | |||||||||||||||||||||||||
| 2604 | /*! | - | ||||||||||||||||||||||||
| 2605 | Returns \c true if the node has one or more children; otherwise | - | ||||||||||||||||||||||||
| 2606 | returns \c false. | - | ||||||||||||||||||||||||
| 2607 | */ | - | ||||||||||||||||||||||||
| 2608 | bool QDomNode::hasChildNodes() const | - | ||||||||||||||||||||||||
| 2609 | { | - | ||||||||||||||||||||||||
| 2610 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 2611 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2612 | return IMPL->first != 0; never executed: return ((QDomNodePrivate*)impl)->first != 0; | 0 | ||||||||||||||||||||||||
| 2613 | } | - | ||||||||||||||||||||||||
| 2614 | - | |||||||||||||||||||||||||
| 2615 | /*! | - | ||||||||||||||||||||||||
| 2616 | Returns \c true if this node is null (i.e. if it has no type or | - | ||||||||||||||||||||||||
| 2617 | contents); otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2618 | */ | - | ||||||||||||||||||||||||
| 2619 | bool QDomNode::isNull() const | - | ||||||||||||||||||||||||
| 2620 | { | - | ||||||||||||||||||||||||
| 2621 | return (impl == 0); executed 154 times by 1 test: return (impl == 0);Executed by:
| 154 | ||||||||||||||||||||||||
| 2622 | } | - | ||||||||||||||||||||||||
| 2623 | - | |||||||||||||||||||||||||
| 2624 | /*! | - | ||||||||||||||||||||||||
| 2625 | Converts the node into a null node; if it was not a null node | - | ||||||||||||||||||||||||
| 2626 | before, its type and contents are deleted. | - | ||||||||||||||||||||||||
| 2627 | - | |||||||||||||||||||||||||
| 2628 | \sa isNull() | - | ||||||||||||||||||||||||
| 2629 | */ | - | ||||||||||||||||||||||||
| 2630 | void QDomNode::clear() | - | ||||||||||||||||||||||||
| 2631 | { | - | ||||||||||||||||||||||||
| 2632 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 2633 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 2634 | impl = 0; | - | ||||||||||||||||||||||||
| 2635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||
| 2637 | /*! | - | ||||||||||||||||||||||||
| 2638 | Returns the first direct child node for which nodeName() equals \a | - | ||||||||||||||||||||||||
| 2639 | name. | - | ||||||||||||||||||||||||
| 2640 | - | |||||||||||||||||||||||||
| 2641 | If no such direct child exists, a \l{isNull()}{null node} | - | ||||||||||||||||||||||||
| 2642 | is returned. | - | ||||||||||||||||||||||||
| 2643 | - | |||||||||||||||||||||||||
| 2644 | \sa nodeName() | - | ||||||||||||||||||||||||
| 2645 | */ | - | ||||||||||||||||||||||||
| 2646 | QDomNode QDomNode::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 2647 | { | - | ||||||||||||||||||||||||
| 2648 | if (!impl)
| 0-49 | ||||||||||||||||||||||||
| 2649 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 2650 | return QDomNode(impl->namedItem(name)); executed 49 times by 1 test: return QDomNode(impl->namedItem(name));Executed by:
| 49 | ||||||||||||||||||||||||
| 2651 | } | - | ||||||||||||||||||||||||
| 2652 | - | |||||||||||||||||||||||||
| 2653 | /*! | - | ||||||||||||||||||||||||
| 2654 | Writes the XML representation of the node and all its children to | - | ||||||||||||||||||||||||
| 2655 | the stream \a stream. This function uses \a indent as the amount of | - | ||||||||||||||||||||||||
| 2656 | space to indent the node. | - | ||||||||||||||||||||||||
| 2657 | - | |||||||||||||||||||||||||
| 2658 | If the document contains invalid XML characters or characters that cannot be | - | ||||||||||||||||||||||||
| 2659 | encoded in the given encoding, the result and behavior is undefined. | - | ||||||||||||||||||||||||
| 2660 | - | |||||||||||||||||||||||||
| 2661 | If \a encodingPolicy is QDomNode::EncodingFromDocument and this node is a | - | ||||||||||||||||||||||||
| 2662 | document node, the encoding of text stream \a stream's encoding is set by | - | ||||||||||||||||||||||||
| 2663 | treating a processing instruction by name "xml" as an XML declaration, if | - | ||||||||||||||||||||||||
| 2664 | one exists, and otherwise defaults to UTF-8. XML declarations are not | - | ||||||||||||||||||||||||
| 2665 | processing instructions, but this behavior exists for historical | - | ||||||||||||||||||||||||
| 2666 | reasons. If this node is not a document node, the text stream's encoding | - | ||||||||||||||||||||||||
| 2667 | is used. | - | ||||||||||||||||||||||||
| 2668 | - | |||||||||||||||||||||||||
| 2669 | If \a encodingPolicy is EncodingFromTextStream and this node is a document node, this | - | ||||||||||||||||||||||||
| 2670 | function behaves as save(QTextStream &str, int indent) with the exception that the encoding | - | ||||||||||||||||||||||||
| 2671 | specified in the text stream \a stream is used. | - | ||||||||||||||||||||||||
| 2672 | - | |||||||||||||||||||||||||
| 2673 | If the document contains invalid XML characters or characters that cannot be | - | ||||||||||||||||||||||||
| 2674 | encoded in the given encoding, the result and behavior is undefined. | - | ||||||||||||||||||||||||
| 2675 | - | |||||||||||||||||||||||||
| 2676 | \since 4.2 | - | ||||||||||||||||||||||||
| 2677 | */ | - | ||||||||||||||||||||||||
| 2678 | void QDomNode::save(QTextStream& stream, int indent, EncodingPolicy encodingPolicy) const | - | ||||||||||||||||||||||||
| 2679 | { | - | ||||||||||||||||||||||||
| 2680 | if (!impl)
| 0-86 | ||||||||||||||||||||||||
| 2681 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2682 | - | |||||||||||||||||||||||||
| 2683 | if(isDocument())
| 0-86 | ||||||||||||||||||||||||
| 2684 | 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 | ||||||||||||||||||||||||
| 2685 | else | - | ||||||||||||||||||||||||
| 2686 | IMPL->save(stream, 1, indent); never executed: ((QDomNodePrivate*)impl)->save(stream, 1, indent); | 0 | ||||||||||||||||||||||||
| 2687 | } | - | ||||||||||||||||||||||||
| 2688 | - | |||||||||||||||||||||||||
| 2689 | /*! | - | ||||||||||||||||||||||||
| 2690 | \relates QDomNode | - | ||||||||||||||||||||||||
| 2691 | - | |||||||||||||||||||||||||
| 2692 | Writes the XML representation of the node \a node and all its | - | ||||||||||||||||||||||||
| 2693 | children to the stream \a str. | - | ||||||||||||||||||||||||
| 2694 | */ | - | ||||||||||||||||||||||||
| 2695 | QTextStream& operator<<(QTextStream& str, const QDomNode& node) | - | ||||||||||||||||||||||||
| 2696 | { | - | ||||||||||||||||||||||||
| 2697 | node.save(str, 1); | - | ||||||||||||||||||||||||
| 2698 | - | |||||||||||||||||||||||||
| 2699 | return str; never executed: return str; | 0 | ||||||||||||||||||||||||
| 2700 | } | - | ||||||||||||||||||||||||
| 2701 | - | |||||||||||||||||||||||||
| 2702 | /*! | - | ||||||||||||||||||||||||
| 2703 | Returns \c true if the node is an attribute; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2704 | - | |||||||||||||||||||||||||
| 2705 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2706 | is a QDomAttribute; you can get the QDomAttribute with | - | ||||||||||||||||||||||||
| 2707 | toAttribute(). | - | ||||||||||||||||||||||||
| 2708 | - | |||||||||||||||||||||||||
| 2709 | \sa toAttr() | - | ||||||||||||||||||||||||
| 2710 | */ | - | ||||||||||||||||||||||||
| 2711 | bool QDomNode::isAttr() const | - | ||||||||||||||||||||||||
| 2712 | { | - | ||||||||||||||||||||||||
| 2713 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2714 | return impl->isAttr(); never executed: return impl->isAttr(); | 0 | ||||||||||||||||||||||||
| 2715 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2716 | } | - | ||||||||||||||||||||||||
| 2717 | - | |||||||||||||||||||||||||
| 2718 | /*! | - | ||||||||||||||||||||||||
| 2719 | Returns \c true if the node is a CDATA section; otherwise returns | - | ||||||||||||||||||||||||
| 2720 | false. | - | ||||||||||||||||||||||||
| 2721 | - | |||||||||||||||||||||||||
| 2722 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2723 | is a QDomCDATASection; you can get the QDomCDATASection with | - | ||||||||||||||||||||||||
| 2724 | toCDATASection(). | - | ||||||||||||||||||||||||
| 2725 | - | |||||||||||||||||||||||||
| 2726 | \sa toCDATASection() | - | ||||||||||||||||||||||||
| 2727 | */ | - | ||||||||||||||||||||||||
| 2728 | bool QDomNode::isCDATASection() const | - | ||||||||||||||||||||||||
| 2729 | { | - | ||||||||||||||||||||||||
| 2730 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2731 | return impl->isCDATASection(); never executed: return impl->isCDATASection(); | 0 | ||||||||||||||||||||||||
| 2732 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2733 | } | - | ||||||||||||||||||||||||
| 2734 | - | |||||||||||||||||||||||||
| 2735 | /*! | - | ||||||||||||||||||||||||
| 2736 | Returns \c true if the node is a document fragment; otherwise returns | - | ||||||||||||||||||||||||
| 2737 | false. | - | ||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||
| 2739 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2740 | is a QDomDocumentFragment; you can get the QDomDocumentFragment | - | ||||||||||||||||||||||||
| 2741 | with toDocumentFragment(). | - | ||||||||||||||||||||||||
| 2742 | - | |||||||||||||||||||||||||
| 2743 | \sa toDocumentFragment() | - | ||||||||||||||||||||||||
| 2744 | */ | - | ||||||||||||||||||||||||
| 2745 | bool QDomNode::isDocumentFragment() const | - | ||||||||||||||||||||||||
| 2746 | { | - | ||||||||||||||||||||||||
| 2747 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2748 | return impl->isDocumentFragment(); never executed: return impl->isDocumentFragment(); | 0 | ||||||||||||||||||||||||
| 2749 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2750 | } | - | ||||||||||||||||||||||||
| 2751 | - | |||||||||||||||||||||||||
| 2752 | /*! | - | ||||||||||||||||||||||||
| 2753 | Returns \c true if the node is a document; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2754 | - | |||||||||||||||||||||||||
| 2755 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2756 | is a QDomDocument; you can get the QDomDocument with toDocument(). | - | ||||||||||||||||||||||||
| 2757 | - | |||||||||||||||||||||||||
| 2758 | \sa toDocument() | - | ||||||||||||||||||||||||
| 2759 | */ | - | ||||||||||||||||||||||||
| 2760 | bool QDomNode::isDocument() const | - | ||||||||||||||||||||||||
| 2761 | { | - | ||||||||||||||||||||||||
| 2762 | if(impl)
| 0-86 | ||||||||||||||||||||||||
| 2763 | return impl->isDocument(); executed 86 times by 2 tests: return impl->isDocument();Executed by:
| 86 | ||||||||||||||||||||||||
| 2764 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2765 | } | - | ||||||||||||||||||||||||
| 2766 | - | |||||||||||||||||||||||||
| 2767 | /*! | - | ||||||||||||||||||||||||
| 2768 | Returns \c true if the node is a document type; otherwise returns | - | ||||||||||||||||||||||||
| 2769 | false. | - | ||||||||||||||||||||||||
| 2770 | - | |||||||||||||||||||||||||
| 2771 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2772 | is a QDomDocumentType; you can get the QDomDocumentType with | - | ||||||||||||||||||||||||
| 2773 | toDocumentType(). | - | ||||||||||||||||||||||||
| 2774 | - | |||||||||||||||||||||||||
| 2775 | \sa toDocumentType() | - | ||||||||||||||||||||||||
| 2776 | */ | - | ||||||||||||||||||||||||
| 2777 | bool QDomNode::isDocumentType() const | - | ||||||||||||||||||||||||
| 2778 | { | - | ||||||||||||||||||||||||
| 2779 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2780 | return impl->isDocumentType(); never executed: return impl->isDocumentType(); | 0 | ||||||||||||||||||||||||
| 2781 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2782 | } | - | ||||||||||||||||||||||||
| 2783 | - | |||||||||||||||||||||||||
| 2784 | /*! | - | ||||||||||||||||||||||||
| 2785 | Returns \c true if the node is an element; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2786 | - | |||||||||||||||||||||||||
| 2787 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2788 | is a QDomElement; you can get the QDomElement with toElement(). | - | ||||||||||||||||||||||||
| 2789 | - | |||||||||||||||||||||||||
| 2790 | \sa toElement() | - | ||||||||||||||||||||||||
| 2791 | */ | - | ||||||||||||||||||||||||
| 2792 | bool QDomNode::isElement() const | - | ||||||||||||||||||||||||
| 2793 | { | - | ||||||||||||||||||||||||
| 2794 | if(impl)
| 0-80 | ||||||||||||||||||||||||
| 2795 | return impl->isElement(); executed 80 times by 1 test: return impl->isElement();Executed by:
| 80 | ||||||||||||||||||||||||
| 2796 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2797 | } | - | ||||||||||||||||||||||||
| 2798 | - | |||||||||||||||||||||||||
| 2799 | /*! | - | ||||||||||||||||||||||||
| 2800 | Returns \c true if the node is an entity reference; otherwise returns | - | ||||||||||||||||||||||||
| 2801 | false. | - | ||||||||||||||||||||||||
| 2802 | - | |||||||||||||||||||||||||
| 2803 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2804 | is a QDomEntityReference; you can get the QDomEntityReference with | - | ||||||||||||||||||||||||
| 2805 | toEntityReference(). | - | ||||||||||||||||||||||||
| 2806 | - | |||||||||||||||||||||||||
| 2807 | \sa toEntityReference() | - | ||||||||||||||||||||||||
| 2808 | */ | - | ||||||||||||||||||||||||
| 2809 | bool QDomNode::isEntityReference() const | - | ||||||||||||||||||||||||
| 2810 | { | - | ||||||||||||||||||||||||
| 2811 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2812 | return impl->isEntityReference(); never executed: return impl->isEntityReference(); | 0 | ||||||||||||||||||||||||
| 2813 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2814 | } | - | ||||||||||||||||||||||||
| 2815 | - | |||||||||||||||||||||||||
| 2816 | /*! | - | ||||||||||||||||||||||||
| 2817 | Returns \c true if the node is a text node; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2818 | - | |||||||||||||||||||||||||
| 2819 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2820 | is a QDomText; you can get the QDomText with toText(). | - | ||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||
| 2822 | \sa toText() | - | ||||||||||||||||||||||||
| 2823 | */ | - | ||||||||||||||||||||||||
| 2824 | bool QDomNode::isText() const | - | ||||||||||||||||||||||||
| 2825 | { | - | ||||||||||||||||||||||||
| 2826 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2827 | return impl->isText(); never executed: return impl->isText(); | 0 | ||||||||||||||||||||||||
| 2828 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2829 | } | - | ||||||||||||||||||||||||
| 2830 | - | |||||||||||||||||||||||||
| 2831 | /*! | - | ||||||||||||||||||||||||
| 2832 | Returns \c true if the node is an entity; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2833 | - | |||||||||||||||||||||||||
| 2834 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2835 | is a QDomEntity; you can get the QDomEntity with toEntity(). | - | ||||||||||||||||||||||||
| 2836 | - | |||||||||||||||||||||||||
| 2837 | \sa toEntity() | - | ||||||||||||||||||||||||
| 2838 | */ | - | ||||||||||||||||||||||||
| 2839 | bool QDomNode::isEntity() const | - | ||||||||||||||||||||||||
| 2840 | { | - | ||||||||||||||||||||||||
| 2841 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2842 | return impl->isEntity(); never executed: return impl->isEntity(); | 0 | ||||||||||||||||||||||||
| 2843 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2844 | } | - | ||||||||||||||||||||||||
| 2845 | - | |||||||||||||||||||||||||
| 2846 | /*! | - | ||||||||||||||||||||||||
| 2847 | Returns \c true if the node is a notation; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2848 | - | |||||||||||||||||||||||||
| 2849 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2850 | is a QDomNotation; you can get the QDomNotation with toNotation(). | - | ||||||||||||||||||||||||
| 2851 | - | |||||||||||||||||||||||||
| 2852 | \sa toNotation() | - | ||||||||||||||||||||||||
| 2853 | */ | - | ||||||||||||||||||||||||
| 2854 | bool QDomNode::isNotation() const | - | ||||||||||||||||||||||||
| 2855 | { | - | ||||||||||||||||||||||||
| 2856 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2857 | return impl->isNotation(); never executed: return impl->isNotation(); | 0 | ||||||||||||||||||||||||
| 2858 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2859 | } | - | ||||||||||||||||||||||||
| 2860 | - | |||||||||||||||||||||||||
| 2861 | /*! | - | ||||||||||||||||||||||||
| 2862 | Returns \c true if the node is a processing instruction; otherwise | - | ||||||||||||||||||||||||
| 2863 | returns \c false. | - | ||||||||||||||||||||||||
| 2864 | - | |||||||||||||||||||||||||
| 2865 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2866 | is a QDomProcessingInstruction; you can get the | - | ||||||||||||||||||||||||
| 2867 | QProcessingInstruction with toProcessingInstruction(). | - | ||||||||||||||||||||||||
| 2868 | - | |||||||||||||||||||||||||
| 2869 | \sa toProcessingInstruction() | - | ||||||||||||||||||||||||
| 2870 | */ | - | ||||||||||||||||||||||||
| 2871 | bool QDomNode::isProcessingInstruction() const | - | ||||||||||||||||||||||||
| 2872 | { | - | ||||||||||||||||||||||||
| 2873 | if(impl)
| 0 | ||||||||||||||||||||||||
| 2874 | return impl->isProcessingInstruction(); never executed: return impl->isProcessingInstruction(); | 0 | ||||||||||||||||||||||||
| 2875 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2876 | } | - | ||||||||||||||||||||||||
| 2877 | - | |||||||||||||||||||||||||
| 2878 | /*! | - | ||||||||||||||||||||||||
| 2879 | Returns \c true if the node is a character data node; otherwise | - | ||||||||||||||||||||||||
| 2880 | returns \c false. | - | ||||||||||||||||||||||||
| 2881 | - | |||||||||||||||||||||||||
| 2882 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2883 | is a QDomCharacterData; you can get the QDomCharacterData with | - | ||||||||||||||||||||||||
| 2884 | toCharacterData(). | - | ||||||||||||||||||||||||
| 2885 | - | |||||||||||||||||||||||||
| 2886 | \sa toCharacterData() | - | ||||||||||||||||||||||||
| 2887 | */ | - | ||||||||||||||||||||||||
| 2888 | bool QDomNode::isCharacterData() const | - | ||||||||||||||||||||||||
| 2889 | { | - | ||||||||||||||||||||||||
| 2890 | if (impl)
| 0 | ||||||||||||||||||||||||
| 2891 | return impl->isCharacterData(); never executed: return impl->isCharacterData(); | 0 | ||||||||||||||||||||||||
| 2892 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2893 | } | - | ||||||||||||||||||||||||
| 2894 | - | |||||||||||||||||||||||||
| 2895 | /*! | - | ||||||||||||||||||||||||
| 2896 | Returns \c true if the node is a comment; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2897 | - | |||||||||||||||||||||||||
| 2898 | If this function returns \c true, it does not imply that this object | - | ||||||||||||||||||||||||
| 2899 | is a QDomComment; you can get the QDomComment with toComment(). | - | ||||||||||||||||||||||||
| 2900 | - | |||||||||||||||||||||||||
| 2901 | \sa toComment() | - | ||||||||||||||||||||||||
| 2902 | */ | - | ||||||||||||||||||||||||
| 2903 | bool QDomNode::isComment() const | - | ||||||||||||||||||||||||
| 2904 | { | - | ||||||||||||||||||||||||
| 2905 | if (impl)
| 0 | ||||||||||||||||||||||||
| 2906 | return impl->isComment(); never executed: return impl->isComment(); | 0 | ||||||||||||||||||||||||
| 2907 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 2908 | } | - | ||||||||||||||||||||||||
| 2909 | - | |||||||||||||||||||||||||
| 2910 | #undef IMPL | - | ||||||||||||||||||||||||
| 2911 | - | |||||||||||||||||||||||||
| 2912 | /*! | - | ||||||||||||||||||||||||
| 2913 | Returns the first child element with tag name \a tagName if tagName is non-empty; | - | ||||||||||||||||||||||||
| 2914 | otherwise returns the first child element. Returns a null element if no | - | ||||||||||||||||||||||||
| 2915 | such child exists. | - | ||||||||||||||||||||||||
| 2916 | - | |||||||||||||||||||||||||
| 2917 | \sa lastChildElement(), previousSiblingElement(), nextSiblingElement() | - | ||||||||||||||||||||||||
| 2918 | */ | - | ||||||||||||||||||||||||
| 2919 | - | |||||||||||||||||||||||||
| 2920 | QDomElement QDomNode::firstChildElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2921 | { | - | ||||||||||||||||||||||||
| 2922 | for (QDomNode child = firstChild(); !child.isNull(); child = child.nextSibling()) {
| 0-79 | ||||||||||||||||||||||||
| 2923 | if (child.isElement()) {
| 0-79 | ||||||||||||||||||||||||
| 2924 | QDomElement elt = child.toElement(); | - | ||||||||||||||||||||||||
| 2925 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0-79 | ||||||||||||||||||||||||
| 2926 | return elt; executed 79 times by 1 test: return elt;Executed by:
| 79 | ||||||||||||||||||||||||
| 2927 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2929 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2930 | } | - | ||||||||||||||||||||||||
| 2931 | - | |||||||||||||||||||||||||
| 2932 | /*! | - | ||||||||||||||||||||||||
| 2933 | Returns the last child element with tag name \a tagName if tagName is non-empty; | - | ||||||||||||||||||||||||
| 2934 | otherwise returns the last child element. Returns a null element if no | - | ||||||||||||||||||||||||
| 2935 | such child exists. | - | ||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||
| 2937 | \sa firstChildElement(), previousSiblingElement(), nextSiblingElement() | - | ||||||||||||||||||||||||
| 2938 | */ | - | ||||||||||||||||||||||||
| 2939 | - | |||||||||||||||||||||||||
| 2940 | QDomElement QDomNode::lastChildElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2941 | { | - | ||||||||||||||||||||||||
| 2942 | for (QDomNode child = lastChild(); !child.isNull(); child = child.previousSibling()) {
| 0 | ||||||||||||||||||||||||
| 2943 | if (child.isElement()) {
| 0 | ||||||||||||||||||||||||
| 2944 | QDomElement elt = child.toElement(); | - | ||||||||||||||||||||||||
| 2945 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0 | ||||||||||||||||||||||||
| 2946 | return elt; never executed: return elt; | 0 | ||||||||||||||||||||||||
| 2947 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2948 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2949 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2950 | } | - | ||||||||||||||||||||||||
| 2951 | - | |||||||||||||||||||||||||
| 2952 | /*! | - | ||||||||||||||||||||||||
| 2953 | Returns the next sibling element with tag name \a tagName if \a tagName | - | ||||||||||||||||||||||||
| 2954 | is non-empty; otherwise returns any next sibling element. | - | ||||||||||||||||||||||||
| 2955 | Returns a null element if no such sibling exists. | - | ||||||||||||||||||||||||
| 2956 | - | |||||||||||||||||||||||||
| 2957 | \sa firstChildElement(), previousSiblingElement(), lastChildElement() | - | ||||||||||||||||||||||||
| 2958 | */ | - | ||||||||||||||||||||||||
| 2959 | - | |||||||||||||||||||||||||
| 2960 | QDomElement QDomNode::nextSiblingElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2961 | { | - | ||||||||||||||||||||||||
| 2962 | for (QDomNode sib = nextSibling(); !sib.isNull(); sib = sib.nextSibling()) {
| 0 | ||||||||||||||||||||||||
| 2963 | if (sib.isElement()) {
| 0 | ||||||||||||||||||||||||
| 2964 | QDomElement elt = sib.toElement(); | - | ||||||||||||||||||||||||
| 2965 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0 | ||||||||||||||||||||||||
| 2966 | return elt; never executed: return elt; | 0 | ||||||||||||||||||||||||
| 2967 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2969 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2970 | } | - | ||||||||||||||||||||||||
| 2971 | - | |||||||||||||||||||||||||
| 2972 | /*! | - | ||||||||||||||||||||||||
| 2973 | Returns the previous sibilng element with tag name \a tagName if \a tagName | - | ||||||||||||||||||||||||
| 2974 | is non-empty; otherwise returns any previous sibling element. | - | ||||||||||||||||||||||||
| 2975 | Returns a null element if no such sibling exists. | - | ||||||||||||||||||||||||
| 2976 | - | |||||||||||||||||||||||||
| 2977 | \sa firstChildElement(), nextSiblingElement(), lastChildElement() | - | ||||||||||||||||||||||||
| 2978 | */ | - | ||||||||||||||||||||||||
| 2979 | - | |||||||||||||||||||||||||
| 2980 | QDomElement QDomNode::previousSiblingElement(const QString &tagName) const | - | ||||||||||||||||||||||||
| 2981 | { | - | ||||||||||||||||||||||||
| 2982 | for (QDomNode sib = previousSibling(); !sib.isNull(); sib = sib.previousSibling()) {
| 0-1 | ||||||||||||||||||||||||
| 2983 | if (sib.isElement()) {
| 0-1 | ||||||||||||||||||||||||
| 2984 | QDomElement elt = sib.toElement(); | - | ||||||||||||||||||||||||
| 2985 | if (tagName.isEmpty() || elt.tagName() == tagName)
| 0-1 | ||||||||||||||||||||||||
| 2986 | return elt; executed 1 time by 1 test: return elt;Executed by:
| 1 | ||||||||||||||||||||||||
| 2987 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2988 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2989 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 2990 | } | - | ||||||||||||||||||||||||
| 2991 | - | |||||||||||||||||||||||||
| 2992 | /*! | - | ||||||||||||||||||||||||
| 2993 | \since 4.1 | - | ||||||||||||||||||||||||
| 2994 | - | |||||||||||||||||||||||||
| 2995 | For nodes created by QDomDocument::setContent(), this function | - | ||||||||||||||||||||||||
| 2996 | returns the line number in the XML document where the node was parsed. | - | ||||||||||||||||||||||||
| 2997 | Otherwise, -1 is returned. | - | ||||||||||||||||||||||||
| 2998 | - | |||||||||||||||||||||||||
| 2999 | \sa columnNumber(), QDomDocument::setContent() | - | ||||||||||||||||||||||||
| 3000 | */ | - | ||||||||||||||||||||||||
| 3001 | int QDomNode::lineNumber() const | - | ||||||||||||||||||||||||
| 3002 | { | - | ||||||||||||||||||||||||
| 3003 | return impl ? impl->lineNumber : -1; never executed: return impl ? impl->lineNumber : -1;
| 0 | ||||||||||||||||||||||||
| 3004 | } | - | ||||||||||||||||||||||||
| 3005 | - | |||||||||||||||||||||||||
| 3006 | /*! | - | ||||||||||||||||||||||||
| 3007 | \since 4.1 | - | ||||||||||||||||||||||||
| 3008 | - | |||||||||||||||||||||||||
| 3009 | For nodes created by QDomDocument::setContent(), this function | - | ||||||||||||||||||||||||
| 3010 | returns the column number in the XML document where the node was parsed. | - | ||||||||||||||||||||||||
| 3011 | Otherwise, -1 is returned. | - | ||||||||||||||||||||||||
| 3012 | - | |||||||||||||||||||||||||
| 3013 | \sa lineNumber(), QDomDocument::setContent() | - | ||||||||||||||||||||||||
| 3014 | */ | - | ||||||||||||||||||||||||
| 3015 | int QDomNode::columnNumber() const | - | ||||||||||||||||||||||||
| 3016 | { | - | ||||||||||||||||||||||||
| 3017 | return impl ? impl->columnNumber : -1; never executed: return impl ? impl->columnNumber : -1;
| 0 | ||||||||||||||||||||||||
| 3018 | } | - | ||||||||||||||||||||||||
| 3019 | - | |||||||||||||||||||||||||
| 3020 | - | |||||||||||||||||||||||||
| 3021 | /************************************************************** | - | ||||||||||||||||||||||||
| 3022 | * | - | ||||||||||||||||||||||||
| 3023 | * QDomNamedNodeMapPrivate | - | ||||||||||||||||||||||||
| 3024 | * | - | ||||||||||||||||||||||||
| 3025 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3026 | - | |||||||||||||||||||||||||
| 3027 | QDomNamedNodeMapPrivate::QDomNamedNodeMapPrivate(QDomNodePrivate* n) : ref(1) | - | ||||||||||||||||||||||||
| 3028 | { | - | ||||||||||||||||||||||||
| 3029 | readonly = false; | - | ||||||||||||||||||||||||
| 3030 | parent = n; | - | ||||||||||||||||||||||||
| 3031 | appendToParent = false; | - | ||||||||||||||||||||||||
| 3032 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3033 | - | |||||||||||||||||||||||||
| 3034 | QDomNamedNodeMapPrivate::~QDomNamedNodeMapPrivate() | - | ||||||||||||||||||||||||
| 3035 | { | - | ||||||||||||||||||||||||
| 3036 | clearMap(); | - | ||||||||||||||||||||||||
| 3037 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3038 | - | |||||||||||||||||||||||||
| 3039 | QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) | - | ||||||||||||||||||||||||
| 3040 | { | - | ||||||||||||||||||||||||
| 3041 | QScopedPointer<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(p)); | - | ||||||||||||||||||||||||
| 3042 | m->readonly = readonly; | - | ||||||||||||||||||||||||
| 3043 | m->appendToParent = appendToParent; | - | ||||||||||||||||||||||||
| 3044 | - | |||||||||||||||||||||||||
| 3045 | QHash<QString, QDomNodePrivate*>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3046 | for (; it != map.constEnd(); ++it) {
| 0 | ||||||||||||||||||||||||
| 3047 | QDomNodePrivate *new_node = (*it)->cloneNode(); | - | ||||||||||||||||||||||||
| 3048 | new_node->setParent(p); | - | ||||||||||||||||||||||||
| 3049 | m->setNamedItem(new_node); | - | ||||||||||||||||||||||||
| 3050 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3051 | - | |||||||||||||||||||||||||
| 3052 | // we are no longer interested in ownership | - | ||||||||||||||||||||||||
| 3053 | m->ref.deref(); | - | ||||||||||||||||||||||||
| 3054 | return m.take(); never executed: return m.take(); | 0 | ||||||||||||||||||||||||
| 3055 | } | - | ||||||||||||||||||||||||
| 3056 | - | |||||||||||||||||||||||||
| 3057 | void QDomNamedNodeMapPrivate::clearMap() | - | ||||||||||||||||||||||||
| 3058 | { | - | ||||||||||||||||||||||||
| 3059 | // Dereference all of our children if we took references | - | ||||||||||||||||||||||||
| 3060 | if (!appendToParent) {
| 976-1023 | ||||||||||||||||||||||||
| 3061 | QHash<QString, QDomNodePrivate *>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3062 | for (; it != map.constEnd(); ++it)
| 867-1023 | ||||||||||||||||||||||||
| 3063 | if (!(*it)->ref.deref())
| 0-867 | ||||||||||||||||||||||||
| 3064 | delete *it; executed 867 times by 4 tests: delete *it;Executed by:
| 867 | ||||||||||||||||||||||||
| 3065 | } executed 1023 times by 5 tests: end of blockExecuted by:
| 1023 | ||||||||||||||||||||||||
| 3066 | map.clear(); | - | ||||||||||||||||||||||||
| 3067 | } executed 1999 times by 5 tests: end of blockExecuted by:
| 1999 | ||||||||||||||||||||||||
| 3068 | - | |||||||||||||||||||||||||
| 3069 | QDomNodePrivate* QDomNamedNodeMapPrivate::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 3070 | { | - | ||||||||||||||||||||||||
| 3071 | QDomNodePrivate* p = map[name]; | - | ||||||||||||||||||||||||
| 3072 | return p; executed 900 times by 3 tests: return p;Executed by:
| 900 | ||||||||||||||||||||||||
| 3073 | } | - | ||||||||||||||||||||||||
| 3074 | - | |||||||||||||||||||||||||
| 3075 | QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 3076 | { | - | ||||||||||||||||||||||||
| 3077 | QHash<QString, QDomNodePrivate *>::const_iterator it = map.constBegin(); | - | ||||||||||||||||||||||||
| 3078 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 3079 | for (; it != map.constEnd(); ++it) {
| 0-2 | ||||||||||||||||||||||||
| 3080 | n = *it; | - | ||||||||||||||||||||||||
| 3081 | if (!n->prefix.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3082 | // node has a namespace | - | ||||||||||||||||||||||||
| 3083 | if (n->namespaceURI == nsURI && n->name == localName)
| 0 | ||||||||||||||||||||||||
| 3084 | return n; never executed: return n; | 0 | ||||||||||||||||||||||||
| 3085 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3086 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3087 | return 0; executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||||||||
| 3088 | } | - | ||||||||||||||||||||||||
| 3089 | - | |||||||||||||||||||||||||
| 3090 | QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg) | - | ||||||||||||||||||||||||
| 3091 | { | - | ||||||||||||||||||||||||
| 3092 | if (readonly || !arg)
| 0-867 | ||||||||||||||||||||||||
| 3093 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3094 | - | |||||||||||||||||||||||||
| 3095 | if (appendToParent)
| 0-867 | ||||||||||||||||||||||||
| 3096 | return parent->appendChild(arg); never executed: return parent->appendChild(arg); | 0 | ||||||||||||||||||||||||
| 3097 | - | |||||||||||||||||||||||||
| 3098 | QDomNodePrivate *n = map.value(arg->nodeName()); | - | ||||||||||||||||||||||||
| 3099 | // We take a reference | - | ||||||||||||||||||||||||
| 3100 | arg->ref.ref(); | - | ||||||||||||||||||||||||
| 3101 | map.insertMulti(arg->nodeName(), arg); | - | ||||||||||||||||||||||||
| 3102 | return n; executed 867 times by 4 tests: return n;Executed by:
| 867 | ||||||||||||||||||||||||
| 3103 | } | - | ||||||||||||||||||||||||
| 3104 | - | |||||||||||||||||||||||||
| 3105 | QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg) | - | ||||||||||||||||||||||||
| 3106 | { | - | ||||||||||||||||||||||||
| 3107 | if (readonly || !arg)
| 0 | ||||||||||||||||||||||||
| 3108 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3109 | - | |||||||||||||||||||||||||
| 3110 | if (appendToParent)
| 0 | ||||||||||||||||||||||||
| 3111 | return parent->appendChild(arg); never executed: return parent->appendChild(arg); | 0 | ||||||||||||||||||||||||
| 3112 | - | |||||||||||||||||||||||||
| 3113 | if (!arg->prefix.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3114 | // node has a namespace | - | ||||||||||||||||||||||||
| 3115 | QDomNodePrivate *n = namedItemNS(arg->namespaceURI, arg->name); | - | ||||||||||||||||||||||||
| 3116 | // We take a reference | - | ||||||||||||||||||||||||
| 3117 | arg->ref.ref(); | - | ||||||||||||||||||||||||
| 3118 | map.insertMulti(arg->nodeName(), arg); | - | ||||||||||||||||||||||||
| 3119 | return n; never executed: return n; | 0 | ||||||||||||||||||||||||
| 3120 | } else { | - | ||||||||||||||||||||||||
| 3121 | // ### check the following code if it is ok | - | ||||||||||||||||||||||||
| 3122 | return setNamedItem(arg); never executed: return setNamedItem(arg); | 0 | ||||||||||||||||||||||||
| 3123 | } | - | ||||||||||||||||||||||||
| 3124 | } | - | ||||||||||||||||||||||||
| 3125 | - | |||||||||||||||||||||||||
| 3126 | QDomNodePrivate* QDomNamedNodeMapPrivate::removeNamedItem(const QString& name) | - | ||||||||||||||||||||||||
| 3127 | { | - | ||||||||||||||||||||||||
| 3128 | if (readonly)
| 0 | ||||||||||||||||||||||||
| 3129 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3130 | - | |||||||||||||||||||||||||
| 3131 | QDomNodePrivate* p = namedItem(name); | - | ||||||||||||||||||||||||
| 3132 | if (p == 0)
| 0 | ||||||||||||||||||||||||
| 3133 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3134 | if (appendToParent)
| 0 | ||||||||||||||||||||||||
| 3135 | return parent->removeChild(p); never executed: return parent->removeChild(p); | 0 | ||||||||||||||||||||||||
| 3136 | - | |||||||||||||||||||||||||
| 3137 | map.remove(p->nodeName()); | - | ||||||||||||||||||||||||
| 3138 | // We took a reference, so we have to free one here | - | ||||||||||||||||||||||||
| 3139 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3140 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3141 | } | - | ||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||
| 3143 | QDomNodePrivate* QDomNamedNodeMapPrivate::item(int index) const | - | ||||||||||||||||||||||||
| 3144 | { | - | ||||||||||||||||||||||||
| 3145 | if (index >= length() || index < 0)
| 0 | ||||||||||||||||||||||||
| 3146 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3147 | return *(map.constBegin() + index); never executed: return *(map.constBegin() + index); | 0 | ||||||||||||||||||||||||
| 3148 | } | - | ||||||||||||||||||||||||
| 3149 | - | |||||||||||||||||||||||||
| 3150 | int QDomNamedNodeMapPrivate::length() const | - | ||||||||||||||||||||||||
| 3151 | { | - | ||||||||||||||||||||||||
| 3152 | return map.count(); executed 26 times by 1 test: return map.count();Executed by:
| 26 | ||||||||||||||||||||||||
| 3153 | } | - | ||||||||||||||||||||||||
| 3154 | - | |||||||||||||||||||||||||
| 3155 | bool QDomNamedNodeMapPrivate::contains(const QString& name) const | - | ||||||||||||||||||||||||
| 3156 | { | - | ||||||||||||||||||||||||
| 3157 | return map.value(name) != 0; never executed: return map.value(name) != 0; | 0 | ||||||||||||||||||||||||
| 3158 | } | - | ||||||||||||||||||||||||
| 3159 | - | |||||||||||||||||||||||||
| 3160 | bool QDomNamedNodeMapPrivate::containsNS(const QString& nsURI, const QString & localName) const | - | ||||||||||||||||||||||||
| 3161 | { | - | ||||||||||||||||||||||||
| 3162 | return namedItemNS(nsURI, localName) != 0; never executed: return namedItemNS(nsURI, localName) != 0; | 0 | ||||||||||||||||||||||||
| 3163 | } | - | ||||||||||||||||||||||||
| 3164 | - | |||||||||||||||||||||||||
| 3165 | /************************************************************** | - | ||||||||||||||||||||||||
| 3166 | * | - | ||||||||||||||||||||||||
| 3167 | * QDomNamedNodeMap | - | ||||||||||||||||||||||||
| 3168 | * | - | ||||||||||||||||||||||||
| 3169 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3170 | - | |||||||||||||||||||||||||
| 3171 | #define IMPL ((QDomNamedNodeMapPrivate*)impl) | - | ||||||||||||||||||||||||
| 3172 | - | |||||||||||||||||||||||||
| 3173 | /*! | - | ||||||||||||||||||||||||
| 3174 | \class QDomNamedNodeMap | - | ||||||||||||||||||||||||
| 3175 | \reentrant | - | ||||||||||||||||||||||||
| 3176 | \brief The QDomNamedNodeMap class contains a collection of nodes | - | ||||||||||||||||||||||||
| 3177 | that can be accessed by name. | - | ||||||||||||||||||||||||
| 3178 | - | |||||||||||||||||||||||||
| 3179 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3180 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3181 | - | |||||||||||||||||||||||||
| 3182 | Note that QDomNamedNodeMap does not inherit from QDomNodeList. | - | ||||||||||||||||||||||||
| 3183 | QDomNamedNodeMaps do not provide any specific node ordering. | - | ||||||||||||||||||||||||
| 3184 | Although nodes in a QDomNamedNodeMap may be accessed by an ordinal | - | ||||||||||||||||||||||||
| 3185 | index, this is simply to allow a convenient enumeration of the | - | ||||||||||||||||||||||||
| 3186 | contents of a QDomNamedNodeMap, and does not imply that the DOM | - | ||||||||||||||||||||||||
| 3187 | specifies an ordering of the nodes. | - | ||||||||||||||||||||||||
| 3188 | - | |||||||||||||||||||||||||
| 3189 | The QDomNamedNodeMap is used in three places: | - | ||||||||||||||||||||||||
| 3190 | \list 1 | - | ||||||||||||||||||||||||
| 3191 | \li QDomDocumentType::entities() returns a map of all entities | - | ||||||||||||||||||||||||
| 3192 | described in the DTD. | - | ||||||||||||||||||||||||
| 3193 | \li QDomDocumentType::notations() returns a map of all notations | - | ||||||||||||||||||||||||
| 3194 | described in the DTD. | - | ||||||||||||||||||||||||
| 3195 | \li QDomNode::attributes() returns a map of all attributes of an | - | ||||||||||||||||||||||||
| 3196 | element. | - | ||||||||||||||||||||||||
| 3197 | \endlist | - | ||||||||||||||||||||||||
| 3198 | - | |||||||||||||||||||||||||
| 3199 | Items in the map are identified by the name which QDomNode::name() | - | ||||||||||||||||||||||||
| 3200 | returns. Nodes are retrieved using namedItem(), namedItemNS() or | - | ||||||||||||||||||||||||
| 3201 | item(). New nodes are inserted with setNamedItem() or | - | ||||||||||||||||||||||||
| 3202 | setNamedItemNS() and removed with removeNamedItem() or | - | ||||||||||||||||||||||||
| 3203 | removeNamedItemNS(). Use contains() to see if an item with the | - | ||||||||||||||||||||||||
| 3204 | given name is in the named node map. The number of items is | - | ||||||||||||||||||||||||
| 3205 | returned by length(). | - | ||||||||||||||||||||||||
| 3206 | - | |||||||||||||||||||||||||
| 3207 | Terminology: in this class we use "item" and "node" | - | ||||||||||||||||||||||||
| 3208 | interchangeably. | - | ||||||||||||||||||||||||
| 3209 | */ | - | ||||||||||||||||||||||||
| 3210 | - | |||||||||||||||||||||||||
| 3211 | /*! | - | ||||||||||||||||||||||||
| 3212 | Constructs an empty named node map. | - | ||||||||||||||||||||||||
| 3213 | */ | - | ||||||||||||||||||||||||
| 3214 | QDomNamedNodeMap::QDomNamedNodeMap() | - | ||||||||||||||||||||||||
| 3215 | { | - | ||||||||||||||||||||||||
| 3216 | impl = 0; | - | ||||||||||||||||||||||||
| 3217 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3218 | - | |||||||||||||||||||||||||
| 3219 | /*! | - | ||||||||||||||||||||||||
| 3220 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 3221 | */ | - | ||||||||||||||||||||||||
| 3222 | QDomNamedNodeMap::QDomNamedNodeMap(const QDomNamedNodeMap &n) | - | ||||||||||||||||||||||||
| 3223 | { | - | ||||||||||||||||||||||||
| 3224 | impl = n.impl; | - | ||||||||||||||||||||||||
| 3225 | if (impl)
| 0 | ||||||||||||||||||||||||
| 3226 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3227 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3228 | - | |||||||||||||||||||||||||
| 3229 | QDomNamedNodeMap::QDomNamedNodeMap(QDomNamedNodeMapPrivate *n) | - | ||||||||||||||||||||||||
| 3230 | { | - | ||||||||||||||||||||||||
| 3231 | impl = n; | - | ||||||||||||||||||||||||
| 3232 | if (impl)
| 0 | ||||||||||||||||||||||||
| 3233 | impl->ref.ref(); never executed: impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3235 | - | |||||||||||||||||||||||||
| 3236 | /*! | - | ||||||||||||||||||||||||
| 3237 | Assigns \a n to this named node map. | - | ||||||||||||||||||||||||
| 3238 | */ | - | ||||||||||||||||||||||||
| 3239 | QDomNamedNodeMap& QDomNamedNodeMap::operator=(const QDomNamedNodeMap &n) | - | ||||||||||||||||||||||||
| 3240 | { | - | ||||||||||||||||||||||||
| 3241 | if (n.impl)
| 0 | ||||||||||||||||||||||||
| 3242 | n.impl->ref.ref(); never executed: n.impl->ref.ref(); | 0 | ||||||||||||||||||||||||
| 3243 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 3244 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 3245 | impl = n.impl; | - | ||||||||||||||||||||||||
| 3246 | return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||
| 3247 | } | - | ||||||||||||||||||||||||
| 3248 | - | |||||||||||||||||||||||||
| 3249 | /*! | - | ||||||||||||||||||||||||
| 3250 | Returns \c true if \a n and this named node map are equal; otherwise | - | ||||||||||||||||||||||||
| 3251 | returns \c false. | - | ||||||||||||||||||||||||
| 3252 | */ | - | ||||||||||||||||||||||||
| 3253 | bool QDomNamedNodeMap::operator== (const QDomNamedNodeMap& n) const | - | ||||||||||||||||||||||||
| 3254 | { | - | ||||||||||||||||||||||||
| 3255 | return (impl == n.impl); never executed: return (impl == n.impl); | 0 | ||||||||||||||||||||||||
| 3256 | } | - | ||||||||||||||||||||||||
| 3257 | - | |||||||||||||||||||||||||
| 3258 | /*! | - | ||||||||||||||||||||||||
| 3259 | Returns \c true if \a n and this named node map are not equal; | - | ||||||||||||||||||||||||
| 3260 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 3261 | */ | - | ||||||||||||||||||||||||
| 3262 | bool QDomNamedNodeMap::operator!= (const QDomNamedNodeMap& n) const | - | ||||||||||||||||||||||||
| 3263 | { | - | ||||||||||||||||||||||||
| 3264 | return (impl != n.impl); never executed: return (impl != n.impl); | 0 | ||||||||||||||||||||||||
| 3265 | } | - | ||||||||||||||||||||||||
| 3266 | - | |||||||||||||||||||||||||
| 3267 | /*! | - | ||||||||||||||||||||||||
| 3268 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 3269 | */ | - | ||||||||||||||||||||||||
| 3270 | QDomNamedNodeMap::~QDomNamedNodeMap() | - | ||||||||||||||||||||||||
| 3271 | { | - | ||||||||||||||||||||||||
| 3272 | if (impl && !impl->ref.deref())
| 0 | ||||||||||||||||||||||||
| 3273 | delete impl; never executed: delete impl; | 0 | ||||||||||||||||||||||||
| 3274 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3275 | - | |||||||||||||||||||||||||
| 3276 | /*! | - | ||||||||||||||||||||||||
| 3277 | Returns the node called \a name. | - | ||||||||||||||||||||||||
| 3278 | - | |||||||||||||||||||||||||
| 3279 | If the named node map does not contain such a node, a | - | ||||||||||||||||||||||||
| 3280 | \l{QDomNode::isNull()}{null node} is returned. A node's name is | - | ||||||||||||||||||||||||
| 3281 | the name returned by QDomNode::nodeName(). | - | ||||||||||||||||||||||||
| 3282 | - | |||||||||||||||||||||||||
| 3283 | \sa setNamedItem(), namedItemNS() | - | ||||||||||||||||||||||||
| 3284 | */ | - | ||||||||||||||||||||||||
| 3285 | QDomNode QDomNamedNodeMap::namedItem(const QString& name) const | - | ||||||||||||||||||||||||
| 3286 | { | - | ||||||||||||||||||||||||
| 3287 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3288 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3289 | return QDomNode(IMPL->namedItem(name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->namedItem(name)); | 0 | ||||||||||||||||||||||||
| 3290 | } | - | ||||||||||||||||||||||||
| 3291 | - | |||||||||||||||||||||||||
| 3292 | /*! | - | ||||||||||||||||||||||||
| 3293 | Inserts the node \a newNode into the named node map. The name used | - | ||||||||||||||||||||||||
| 3294 | by the map is the node name of \a newNode as returned by | - | ||||||||||||||||||||||||
| 3295 | QDomNode::nodeName(). | - | ||||||||||||||||||||||||
| 3296 | - | |||||||||||||||||||||||||
| 3297 | If the new node replaces an existing node, i.e. the map contains a | - | ||||||||||||||||||||||||
| 3298 | node with the same name, the replaced node is returned. | - | ||||||||||||||||||||||||
| 3299 | - | |||||||||||||||||||||||||
| 3300 | \sa namedItem(), removeNamedItem(), setNamedItemNS() | - | ||||||||||||||||||||||||
| 3301 | */ | - | ||||||||||||||||||||||||
| 3302 | QDomNode QDomNamedNodeMap::setNamedItem(const QDomNode& newNode) | - | ||||||||||||||||||||||||
| 3303 | { | - | ||||||||||||||||||||||||
| 3304 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3305 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3306 | return QDomNode(IMPL->setNamedItem((QDomNodePrivate*)newNode.impl)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->setNamedItem((QDomNodePrivate*)newNode.impl)); | 0 | ||||||||||||||||||||||||
| 3307 | } | - | ||||||||||||||||||||||||
| 3308 | - | |||||||||||||||||||||||||
| 3309 | /*! | - | ||||||||||||||||||||||||
| 3310 | Removes the node called \a name from the map. | - | ||||||||||||||||||||||||
| 3311 | - | |||||||||||||||||||||||||
| 3312 | The function returns the removed node or a | - | ||||||||||||||||||||||||
| 3313 | \l{QDomNode::isNull()}{null node} if the map did not contain a | - | ||||||||||||||||||||||||
| 3314 | node called \a name. | - | ||||||||||||||||||||||||
| 3315 | - | |||||||||||||||||||||||||
| 3316 | \sa setNamedItem(), namedItem(), removeNamedItemNS() | - | ||||||||||||||||||||||||
| 3317 | */ | - | ||||||||||||||||||||||||
| 3318 | QDomNode QDomNamedNodeMap::removeNamedItem(const QString& name) | - | ||||||||||||||||||||||||
| 3319 | { | - | ||||||||||||||||||||||||
| 3320 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3321 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3322 | return QDomNode(IMPL->removeNamedItem(name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->removeNamedItem(name)); | 0 | ||||||||||||||||||||||||
| 3323 | } | - | ||||||||||||||||||||||||
| 3324 | - | |||||||||||||||||||||||||
| 3325 | /*! | - | ||||||||||||||||||||||||
| 3326 | Retrieves the node at position \a index. | - | ||||||||||||||||||||||||
| 3327 | - | |||||||||||||||||||||||||
| 3328 | This can be used to iterate over the map. Note that the nodes in | - | ||||||||||||||||||||||||
| 3329 | the map are ordered arbitrarily. | - | ||||||||||||||||||||||||
| 3330 | - | |||||||||||||||||||||||||
| 3331 | \sa length() | - | ||||||||||||||||||||||||
| 3332 | */ | - | ||||||||||||||||||||||||
| 3333 | QDomNode QDomNamedNodeMap::item(int index) const | - | ||||||||||||||||||||||||
| 3334 | { | - | ||||||||||||||||||||||||
| 3335 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3336 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3337 | return QDomNode(IMPL->item(index)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->item(index)); | 0 | ||||||||||||||||||||||||
| 3338 | } | - | ||||||||||||||||||||||||
| 3339 | - | |||||||||||||||||||||||||
| 3340 | /*! | - | ||||||||||||||||||||||||
| 3341 | Returns the node associated with the local name \a localName and | - | ||||||||||||||||||||||||
| 3342 | the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 3343 | - | |||||||||||||||||||||||||
| 3344 | If the map does not contain such a node, | - | ||||||||||||||||||||||||
| 3345 | a \l{QDomNode::isNull()}{null node} is returned. | - | ||||||||||||||||||||||||
| 3346 | - | |||||||||||||||||||||||||
| 3347 | \sa setNamedItemNS(), namedItem() | - | ||||||||||||||||||||||||
| 3348 | */ | - | ||||||||||||||||||||||||
| 3349 | QDomNode QDomNamedNodeMap::namedItemNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 3350 | { | - | ||||||||||||||||||||||||
| 3351 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3352 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3353 | return QDomNode(IMPL->namedItemNS(nsURI, localName)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->namedItemNS(nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 3354 | } | - | ||||||||||||||||||||||||
| 3355 | - | |||||||||||||||||||||||||
| 3356 | /*! | - | ||||||||||||||||||||||||
| 3357 | Inserts the node \a newNode in the map. If a node with the same | - | ||||||||||||||||||||||||
| 3358 | namespace URI and the same local name already exists in the map, | - | ||||||||||||||||||||||||
| 3359 | it is replaced by \a newNode. If the new node replaces an existing | - | ||||||||||||||||||||||||
| 3360 | node, the replaced node is returned. | - | ||||||||||||||||||||||||
| 3361 | - | |||||||||||||||||||||||||
| 3362 | \sa namedItemNS(), removeNamedItemNS(), setNamedItem() | - | ||||||||||||||||||||||||
| 3363 | */ | - | ||||||||||||||||||||||||
| 3364 | QDomNode QDomNamedNodeMap::setNamedItemNS(const QDomNode& newNode) | - | ||||||||||||||||||||||||
| 3365 | { | - | ||||||||||||||||||||||||
| 3366 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3367 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3368 | return QDomNode(IMPL->setNamedItemNS((QDomNodePrivate*)newNode.impl)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->setNamedItemNS((QDomNodePrivate*)newNode.impl)); | 0 | ||||||||||||||||||||||||
| 3369 | } | - | ||||||||||||||||||||||||
| 3370 | - | |||||||||||||||||||||||||
| 3371 | /*! | - | ||||||||||||||||||||||||
| 3372 | Removes the node with the local name \a localName and the | - | ||||||||||||||||||||||||
| 3373 | namespace URI \a nsURI from the map. | - | ||||||||||||||||||||||||
| 3374 | - | |||||||||||||||||||||||||
| 3375 | The function returns the removed node or a | - | ||||||||||||||||||||||||
| 3376 | \l{QDomNode::isNull()}{null node} if the map did not contain a | - | ||||||||||||||||||||||||
| 3377 | node with the local name \a localName and the namespace URI \a | - | ||||||||||||||||||||||||
| 3378 | nsURI. | - | ||||||||||||||||||||||||
| 3379 | - | |||||||||||||||||||||||||
| 3380 | \sa setNamedItemNS(), namedItemNS(), removeNamedItem() | - | ||||||||||||||||||||||||
| 3381 | */ | - | ||||||||||||||||||||||||
| 3382 | QDomNode QDomNamedNodeMap::removeNamedItemNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 3383 | { | - | ||||||||||||||||||||||||
| 3384 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3385 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3386 | QDomNodePrivate *n = IMPL->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 3387 | if (!n)
| 0 | ||||||||||||||||||||||||
| 3388 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 3389 | return QDomNode(IMPL->removeNamedItem(n->name)); never executed: return QDomNode(((QDomNamedNodeMapPrivate*)impl)->removeNamedItem(n->name)); | 0 | ||||||||||||||||||||||||
| 3390 | } | - | ||||||||||||||||||||||||
| 3391 | - | |||||||||||||||||||||||||
| 3392 | /*! | - | ||||||||||||||||||||||||
| 3393 | Returns the number of nodes in the map. | - | ||||||||||||||||||||||||
| 3394 | - | |||||||||||||||||||||||||
| 3395 | \sa item() | - | ||||||||||||||||||||||||
| 3396 | */ | - | ||||||||||||||||||||||||
| 3397 | int QDomNamedNodeMap::length() const | - | ||||||||||||||||||||||||
| 3398 | { | - | ||||||||||||||||||||||||
| 3399 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3400 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 3401 | return IMPL->length(); never executed: return ((QDomNamedNodeMapPrivate*)impl)->length(); | 0 | ||||||||||||||||||||||||
| 3402 | } | - | ||||||||||||||||||||||||
| 3403 | - | |||||||||||||||||||||||||
| 3404 | /*! | - | ||||||||||||||||||||||||
| 3405 | \fn bool QDomNamedNodeMap::isEmpty() const | - | ||||||||||||||||||||||||
| 3406 | - | |||||||||||||||||||||||||
| 3407 | Returns \c true if the map is empty; otherwise returns \c false. This function is | - | ||||||||||||||||||||||||
| 3408 | provided for Qt API consistency. | - | ||||||||||||||||||||||||
| 3409 | */ | - | ||||||||||||||||||||||||
| 3410 | - | |||||||||||||||||||||||||
| 3411 | /*! | - | ||||||||||||||||||||||||
| 3412 | \fn int QDomNamedNodeMap::count() const | - | ||||||||||||||||||||||||
| 3413 | - | |||||||||||||||||||||||||
| 3414 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 3415 | */ | - | ||||||||||||||||||||||||
| 3416 | - | |||||||||||||||||||||||||
| 3417 | /*! | - | ||||||||||||||||||||||||
| 3418 | \fn int QDomNamedNodeMap::size() const | - | ||||||||||||||||||||||||
| 3419 | - | |||||||||||||||||||||||||
| 3420 | This function is provided for Qt API consistency. It is equivalent to length(). | - | ||||||||||||||||||||||||
| 3421 | */ | - | ||||||||||||||||||||||||
| 3422 | - | |||||||||||||||||||||||||
| 3423 | /*! | - | ||||||||||||||||||||||||
| 3424 | Returns \c true if the map contains a node called \a name; otherwise | - | ||||||||||||||||||||||||
| 3425 | returns \c false. | - | ||||||||||||||||||||||||
| 3426 | - | |||||||||||||||||||||||||
| 3427 | \b{Note:} This function does not take the presence of namespaces into account. | - | ||||||||||||||||||||||||
| 3428 | Use namedItemNS() to test whether the map contains a node with a specific namespace | - | ||||||||||||||||||||||||
| 3429 | URI and name. | - | ||||||||||||||||||||||||
| 3430 | */ | - | ||||||||||||||||||||||||
| 3431 | bool QDomNamedNodeMap::contains(const QString& name) const | - | ||||||||||||||||||||||||
| 3432 | { | - | ||||||||||||||||||||||||
| 3433 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3434 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 3435 | return IMPL->contains(name); never executed: return ((QDomNamedNodeMapPrivate*)impl)->contains(name); | 0 | ||||||||||||||||||||||||
| 3436 | } | - | ||||||||||||||||||||||||
| 3437 | - | |||||||||||||||||||||||||
| 3438 | #undef IMPL | - | ||||||||||||||||||||||||
| 3439 | - | |||||||||||||||||||||||||
| 3440 | /************************************************************** | - | ||||||||||||||||||||||||
| 3441 | * | - | ||||||||||||||||||||||||
| 3442 | * QDomDocumentTypePrivate | - | ||||||||||||||||||||||||
| 3443 | * | - | ||||||||||||||||||||||||
| 3444 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||
| 3446 | QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentPrivate* doc, QDomNodePrivate* parent) | - | ||||||||||||||||||||||||
| 3447 | : QDomNodePrivate(doc, parent) | - | ||||||||||||||||||||||||
| 3448 | { | - | ||||||||||||||||||||||||
| 3449 | init(); | - | ||||||||||||||||||||||||
| 3450 | } executed 488 times by 5 tests: end of blockExecuted by:
| 488 | ||||||||||||||||||||||||
| 3451 | - | |||||||||||||||||||||||||
| 3452 | QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3453 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3454 | { | - | ||||||||||||||||||||||||
| 3455 | init(); | - | ||||||||||||||||||||||||
| 3456 | // Refill the maps with our new children | - | ||||||||||||||||||||||||
| 3457 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 3458 | while (p) {
| 0 | ||||||||||||||||||||||||
| 3459 | if (p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3460 | // Don't use normal insert function since we would create infinite recursion | - | ||||||||||||||||||||||||
| 3461 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3462 | if (p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3463 | // Don't use normal insert function since we would create infinite recursion | - | ||||||||||||||||||||||||
| 3464 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3465 | p = p->next; | - | ||||||||||||||||||||||||
| 3466 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3468 | - | |||||||||||||||||||||||||
| 3469 | QDomDocumentTypePrivate::~QDomDocumentTypePrivate() | - | ||||||||||||||||||||||||
| 3470 | { | - | ||||||||||||||||||||||||
| 3471 | if (!entities->ref.deref())
| 0-488 | ||||||||||||||||||||||||
| 3472 | delete entities; executed 488 times by 5 tests: delete entities;Executed by:
| 488 | ||||||||||||||||||||||||
| 3473 | if (!notations->ref.deref())
| 0-488 | ||||||||||||||||||||||||
| 3474 | delete notations; executed 488 times by 5 tests: delete notations;Executed by:
| 488 | ||||||||||||||||||||||||
| 3475 | } executed 488 times by 5 tests: end of blockExecuted by:
| 488 | ||||||||||||||||||||||||
| 3476 | - | |||||||||||||||||||||||||
| 3477 | void QDomDocumentTypePrivate::init() | - | ||||||||||||||||||||||||
| 3478 | { | - | ||||||||||||||||||||||||
| 3479 | entities = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 3480 | QT_TRY { | - | ||||||||||||||||||||||||
| 3481 | notations = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 3482 | publicId.clear(); | - | ||||||||||||||||||||||||
| 3483 | systemId.clear(); | - | ||||||||||||||||||||||||
| 3484 | internalSubset.clear(); | - | ||||||||||||||||||||||||
| 3485 | - | |||||||||||||||||||||||||
| 3486 | entities->setAppendToParent(true); | - | ||||||||||||||||||||||||
| 3487 | notations->setAppendToParent(true); | - | ||||||||||||||||||||||||
| 3488 | } QT_CATCH(...) { executed 488 times by 5 tests: end of blockExecuted by:
dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3489 | delete entities; dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3490 | QT_RETHROW; dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3491 | } dead code: { delete entities; qt_noop(); } | - | ||||||||||||||||||||||||
| 3492 | } | - | ||||||||||||||||||||||||
| 3493 | - | |||||||||||||||||||||||||
| 3494 | QDomNodePrivate* QDomDocumentTypePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3495 | { | - | ||||||||||||||||||||||||
| 3496 | QDomNodePrivate* p = new QDomDocumentTypePrivate(this, deep); | - | ||||||||||||||||||||||||
| 3497 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3498 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3499 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3500 | } | - | ||||||||||||||||||||||||
| 3501 | - | |||||||||||||||||||||||||
| 3502 | QDomNodePrivate* QDomDocumentTypePrivate::insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 3503 | { | - | ||||||||||||||||||||||||
| 3504 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3505 | QDomNodePrivate* p = QDomNodePrivate::insertBefore(newChild, refChild); | - | ||||||||||||||||||||||||
| 3506 | // Update the maps | - | ||||||||||||||||||||||||
| 3507 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3508 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3509 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3510 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3511 | - | |||||||||||||||||||||||||
| 3512 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3513 | } | - | ||||||||||||||||||||||||
| 3514 | - | |||||||||||||||||||||||||
| 3515 | QDomNodePrivate* QDomDocumentTypePrivate::insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) | - | ||||||||||||||||||||||||
| 3516 | { | - | ||||||||||||||||||||||||
| 3517 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3518 | QDomNodePrivate* p = QDomNodePrivate::insertAfter(newChild, refChild); | - | ||||||||||||||||||||||||
| 3519 | // Update the maps | - | ||||||||||||||||||||||||
| 3520 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3521 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3522 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3523 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3524 | - | |||||||||||||||||||||||||
| 3525 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3526 | } | - | ||||||||||||||||||||||||
| 3527 | - | |||||||||||||||||||||||||
| 3528 | QDomNodePrivate* QDomDocumentTypePrivate::replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 3529 | { | - | ||||||||||||||||||||||||
| 3530 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3531 | QDomNodePrivate* p = QDomNodePrivate::replaceChild(newChild, oldChild); | - | ||||||||||||||||||||||||
| 3532 | // Update the maps | - | ||||||||||||||||||||||||
| 3533 | if (p) {
| 0 | ||||||||||||||||||||||||
| 3534 | if (oldChild && oldChild->isEntity())
| 0 | ||||||||||||||||||||||||
| 3535 | entities->map.remove(oldChild->nodeName()); never executed: entities->map.remove(oldChild->nodeName()); | 0 | ||||||||||||||||||||||||
| 3536 | else if (oldChild && oldChild->isNotation())
| 0 | ||||||||||||||||||||||||
| 3537 | notations->map.remove(oldChild->nodeName()); never executed: notations->map.remove(oldChild->nodeName()); | 0 | ||||||||||||||||||||||||
| 3538 | - | |||||||||||||||||||||||||
| 3539 | if (p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3540 | entities->map.insertMulti(p->nodeName(), p); never executed: entities->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3541 | else if (p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3542 | notations->map.insertMulti(p->nodeName(), p); never executed: notations->map.insertMulti(p->nodeName(), p); | 0 | ||||||||||||||||||||||||
| 3543 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3544 | - | |||||||||||||||||||||||||
| 3545 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3546 | } | - | ||||||||||||||||||||||||
| 3547 | - | |||||||||||||||||||||||||
| 3548 | QDomNodePrivate* QDomDocumentTypePrivate::removeChild(QDomNodePrivate* oldChild) | - | ||||||||||||||||||||||||
| 3549 | { | - | ||||||||||||||||||||||||
| 3550 | // Call the origianl implementation | - | ||||||||||||||||||||||||
| 3551 | QDomNodePrivate* p = QDomNodePrivate::removeChild( oldChild); | - | ||||||||||||||||||||||||
| 3552 | // Update the maps | - | ||||||||||||||||||||||||
| 3553 | if (p && p->isEntity())
| 0 | ||||||||||||||||||||||||
| 3554 | entities->map.remove(p->nodeName()); never executed: entities->map.remove(p->nodeName()); | 0 | ||||||||||||||||||||||||
| 3555 | else if (p && p->isNotation())
| 0 | ||||||||||||||||||||||||
| 3556 | notations->map.remove(p ->nodeName()); never executed: notations->map.remove(p ->nodeName()); | 0 | ||||||||||||||||||||||||
| 3557 | - | |||||||||||||||||||||||||
| 3558 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3559 | } | - | ||||||||||||||||||||||||
| 3560 | - | |||||||||||||||||||||||||
| 3561 | QDomNodePrivate* QDomDocumentTypePrivate::appendChild(QDomNodePrivate* newChild) | - | ||||||||||||||||||||||||
| 3562 | { | - | ||||||||||||||||||||||||
| 3563 | return insertAfter(newChild, 0); never executed: return insertAfter(newChild, 0); | 0 | ||||||||||||||||||||||||
| 3564 | } | - | ||||||||||||||||||||||||
| 3565 | - | |||||||||||||||||||||||||
| 3566 | static QString quotedValue(const QString &data) | - | ||||||||||||||||||||||||
| 3567 | { | - | ||||||||||||||||||||||||
| 3568 | QChar quote = data.indexOf(QLatin1Char('\'')) == -1
| 0 | ||||||||||||||||||||||||
| 3569 | ? QLatin1Char('\'') | - | ||||||||||||||||||||||||
| 3570 | : QLatin1Char('"'); | - | ||||||||||||||||||||||||
| 3571 | return quote + data + quote; never executed: return quote + data + quote; | 0 | ||||||||||||||||||||||||
| 3572 | } | - | ||||||||||||||||||||||||
| 3573 | - | |||||||||||||||||||||||||
| 3574 | void QDomDocumentTypePrivate::save(QTextStream& s, int, int indent) const | - | ||||||||||||||||||||||||
| 3575 | { | - | ||||||||||||||||||||||||
| 3576 | if (name.isEmpty())
| 0-86 | ||||||||||||||||||||||||
| 3577 | return; executed 86 times by 2 tests: return;Executed by:
| 86 | ||||||||||||||||||||||||
| 3578 | - | |||||||||||||||||||||||||
| 3579 | s << "<!DOCTYPE " << name; | - | ||||||||||||||||||||||||
| 3580 | - | |||||||||||||||||||||||||
| 3581 | if (!publicId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3582 | s << " PUBLIC " << quotedValue(publicId); | - | ||||||||||||||||||||||||
| 3583 | if (!systemId.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3584 | s << ' ' << quotedValue(systemId); | - | ||||||||||||||||||||||||
| 3585 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3586 | } else if (!systemId.isNull()) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3587 | s << " SYSTEM " << quotedValue(systemId); | - | ||||||||||||||||||||||||
| 3588 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3589 | - | |||||||||||||||||||||||||
| 3590 | if (entities->length()>0 || notations->length()>0) {
| 0 | ||||||||||||||||||||||||
| 3591 | s << " [" << endl; | - | ||||||||||||||||||||||||
| 3592 | - | |||||||||||||||||||||||||
| 3593 | QHash<QString, QDomNodePrivate *>::const_iterator it2 = notations->map.constBegin(); | - | ||||||||||||||||||||||||
| 3594 | for (; it2 != notations->map.constEnd(); ++it2)
| 0 | ||||||||||||||||||||||||
| 3595 | (*it2)->save(s, 0, indent); never executed: (*it2)->save(s, 0, indent); | 0 | ||||||||||||||||||||||||
| 3596 | - | |||||||||||||||||||||||||
| 3597 | QHash<QString, QDomNodePrivate *>::const_iterator it = entities->map.constBegin(); | - | ||||||||||||||||||||||||
| 3598 | for (; it != entities->map.constEnd(); ++it)
| 0 | ||||||||||||||||||||||||
| 3599 | (*it)->save(s, 0, indent); never executed: (*it)->save(s, 0, indent); | 0 | ||||||||||||||||||||||||
| 3600 | - | |||||||||||||||||||||||||
| 3601 | s << ']'; | - | ||||||||||||||||||||||||
| 3602 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3603 | - | |||||||||||||||||||||||||
| 3604 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 3605 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3606 | - | |||||||||||||||||||||||||
| 3607 | /************************************************************** | - | ||||||||||||||||||||||||
| 3608 | * | - | ||||||||||||||||||||||||
| 3609 | * QDomDocumentType | - | ||||||||||||||||||||||||
| 3610 | * | - | ||||||||||||||||||||||||
| 3611 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3612 | - | |||||||||||||||||||||||||
| 3613 | #define IMPL ((QDomDocumentTypePrivate*)impl) | - | ||||||||||||||||||||||||
| 3614 | - | |||||||||||||||||||||||||
| 3615 | /*! | - | ||||||||||||||||||||||||
| 3616 | \class QDomDocumentType | - | ||||||||||||||||||||||||
| 3617 | \reentrant | - | ||||||||||||||||||||||||
| 3618 | \brief The QDomDocumentType class is the representation of the DTD | - | ||||||||||||||||||||||||
| 3619 | in the document tree. | - | ||||||||||||||||||||||||
| 3620 | - | |||||||||||||||||||||||||
| 3621 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3622 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3623 | - | |||||||||||||||||||||||||
| 3624 | The QDomDocumentType class allows read-only access to some of the | - | ||||||||||||||||||||||||
| 3625 | data structures in the DTD: it can return a map of all entities() | - | ||||||||||||||||||||||||
| 3626 | and notations(). In addition the function name() returns the name | - | ||||||||||||||||||||||||
| 3627 | of the document type as specified in the <!DOCTYPE name> | - | ||||||||||||||||||||||||
| 3628 | tag. This class also provides the publicId(), systemId() and | - | ||||||||||||||||||||||||
| 3629 | internalSubset() functions. | - | ||||||||||||||||||||||||
| 3630 | - | |||||||||||||||||||||||||
| 3631 | \sa QDomDocument | - | ||||||||||||||||||||||||
| 3632 | */ | - | ||||||||||||||||||||||||
| 3633 | - | |||||||||||||||||||||||||
| 3634 | /*! | - | ||||||||||||||||||||||||
| 3635 | Creates an empty QDomDocumentType object. | - | ||||||||||||||||||||||||
| 3636 | */ | - | ||||||||||||||||||||||||
| 3637 | QDomDocumentType::QDomDocumentType() : QDomNode() | - | ||||||||||||||||||||||||
| 3638 | { | - | ||||||||||||||||||||||||
| 3639 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3640 | - | |||||||||||||||||||||||||
| 3641 | /*! | - | ||||||||||||||||||||||||
| 3642 | Constructs a copy of \a n. | - | ||||||||||||||||||||||||
| 3643 | - | |||||||||||||||||||||||||
| 3644 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3645 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3646 | cloneNode(). | - | ||||||||||||||||||||||||
| 3647 | */ | - | ||||||||||||||||||||||||
| 3648 | QDomDocumentType::QDomDocumentType(const QDomDocumentType& n) | - | ||||||||||||||||||||||||
| 3649 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3650 | { | - | ||||||||||||||||||||||||
| 3651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3652 | - | |||||||||||||||||||||||||
| 3653 | QDomDocumentType::QDomDocumentType(QDomDocumentTypePrivate* n) | - | ||||||||||||||||||||||||
| 3654 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3655 | { | - | ||||||||||||||||||||||||
| 3656 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3657 | - | |||||||||||||||||||||||||
| 3658 | /*! | - | ||||||||||||||||||||||||
| 3659 | Assigns \a n to this document type. | - | ||||||||||||||||||||||||
| 3660 | - | |||||||||||||||||||||||||
| 3661 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3662 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3663 | cloneNode(). | - | ||||||||||||||||||||||||
| 3664 | */ | - | ||||||||||||||||||||||||
| 3665 | QDomDocumentType& QDomDocumentType::operator= (const QDomDocumentType& n) | - | ||||||||||||||||||||||||
| 3666 | { | - | ||||||||||||||||||||||||
| 3667 | return (QDomDocumentType&) QDomNode::operator=(n); never executed: return (QDomDocumentType&) QDomNode::operator=(n); | 0 | ||||||||||||||||||||||||
| 3668 | } | - | ||||||||||||||||||||||||
| 3669 | - | |||||||||||||||||||||||||
| 3670 | /*! | - | ||||||||||||||||||||||||
| 3671 | Returns the name of the document type as specified in the | - | ||||||||||||||||||||||||
| 3672 | <!DOCTYPE name> tag. | - | ||||||||||||||||||||||||
| 3673 | - | |||||||||||||||||||||||||
| 3674 | \sa nodeName() | - | ||||||||||||||||||||||||
| 3675 | */ | - | ||||||||||||||||||||||||
| 3676 | QString QDomDocumentType::name() const | - | ||||||||||||||||||||||||
| 3677 | { | - | ||||||||||||||||||||||||
| 3678 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3679 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3680 | return IMPL->nodeName(); never executed: return ((QDomDocumentTypePrivate*)impl)->nodeName(); | 0 | ||||||||||||||||||||||||
| 3681 | } | - | ||||||||||||||||||||||||
| 3682 | - | |||||||||||||||||||||||||
| 3683 | /*! | - | ||||||||||||||||||||||||
| 3684 | Returns a map of all entities described in the DTD. | - | ||||||||||||||||||||||||
| 3685 | */ | - | ||||||||||||||||||||||||
| 3686 | QDomNamedNodeMap QDomDocumentType::entities() const | - | ||||||||||||||||||||||||
| 3687 | { | - | ||||||||||||||||||||||||
| 3688 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3689 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 3690 | return QDomNamedNodeMap(IMPL->entities); never executed: return QDomNamedNodeMap(((QDomDocumentTypePrivate*)impl)->entities); | 0 | ||||||||||||||||||||||||
| 3691 | } | - | ||||||||||||||||||||||||
| 3692 | - | |||||||||||||||||||||||||
| 3693 | /*! | - | ||||||||||||||||||||||||
| 3694 | Returns a map of all notations described in the DTD. | - | ||||||||||||||||||||||||
| 3695 | */ | - | ||||||||||||||||||||||||
| 3696 | QDomNamedNodeMap QDomDocumentType::notations() const | - | ||||||||||||||||||||||||
| 3697 | { | - | ||||||||||||||||||||||||
| 3698 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3699 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 3700 | return QDomNamedNodeMap(IMPL->notations); never executed: return QDomNamedNodeMap(((QDomDocumentTypePrivate*)impl)->notations); | 0 | ||||||||||||||||||||||||
| 3701 | } | - | ||||||||||||||||||||||||
| 3702 | - | |||||||||||||||||||||||||
| 3703 | /*! | - | ||||||||||||||||||||||||
| 3704 | Returns the public identifier of the external DTD subset or | - | ||||||||||||||||||||||||
| 3705 | an empty string if there is no public identifier. | - | ||||||||||||||||||||||||
| 3706 | - | |||||||||||||||||||||||||
| 3707 | \sa systemId(), internalSubset(), QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 3708 | */ | - | ||||||||||||||||||||||||
| 3709 | QString QDomDocumentType::publicId() const | - | ||||||||||||||||||||||||
| 3710 | { | - | ||||||||||||||||||||||||
| 3711 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3712 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3713 | return IMPL->publicId; never executed: return ((QDomDocumentTypePrivate*)impl)->publicId; | 0 | ||||||||||||||||||||||||
| 3714 | } | - | ||||||||||||||||||||||||
| 3715 | - | |||||||||||||||||||||||||
| 3716 | /*! | - | ||||||||||||||||||||||||
| 3717 | Returns the system identifier of the external DTD subset or | - | ||||||||||||||||||||||||
| 3718 | an empty string if there is no system identifier. | - | ||||||||||||||||||||||||
| 3719 | - | |||||||||||||||||||||||||
| 3720 | \sa publicId(), internalSubset(), QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 3721 | */ | - | ||||||||||||||||||||||||
| 3722 | QString QDomDocumentType::systemId() const | - | ||||||||||||||||||||||||
| 3723 | { | - | ||||||||||||||||||||||||
| 3724 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3725 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3726 | return IMPL->systemId; never executed: return ((QDomDocumentTypePrivate*)impl)->systemId; | 0 | ||||||||||||||||||||||||
| 3727 | } | - | ||||||||||||||||||||||||
| 3728 | - | |||||||||||||||||||||||||
| 3729 | /*! | - | ||||||||||||||||||||||||
| 3730 | Returns the internal subset of the document type or an empty | - | ||||||||||||||||||||||||
| 3731 | string if there is no internal subset. | - | ||||||||||||||||||||||||
| 3732 | - | |||||||||||||||||||||||||
| 3733 | \sa publicId(), systemId() | - | ||||||||||||||||||||||||
| 3734 | */ | - | ||||||||||||||||||||||||
| 3735 | QString QDomDocumentType::internalSubset() const | - | ||||||||||||||||||||||||
| 3736 | { | - | ||||||||||||||||||||||||
| 3737 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3738 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3739 | return IMPL->internalSubset; never executed: return ((QDomDocumentTypePrivate*)impl)->internalSubset; | 0 | ||||||||||||||||||||||||
| 3740 | } | - | ||||||||||||||||||||||||
| 3741 | - | |||||||||||||||||||||||||
| 3742 | /* | - | ||||||||||||||||||||||||
| 3743 | Are these needed at all? The only difference when removing these | - | ||||||||||||||||||||||||
| 3744 | two methods in all subclasses is that we'd get a different type | - | ||||||||||||||||||||||||
| 3745 | for null nodes. | - | ||||||||||||||||||||||||
| 3746 | */ | - | ||||||||||||||||||||||||
| 3747 | - | |||||||||||||||||||||||||
| 3748 | /*! | - | ||||||||||||||||||||||||
| 3749 | \fn QDomNode::NodeType QDomDocumentType::nodeType() const | - | ||||||||||||||||||||||||
| 3750 | - | |||||||||||||||||||||||||
| 3751 | Returns \c DocumentTypeNode. | - | ||||||||||||||||||||||||
| 3752 | - | |||||||||||||||||||||||||
| 3753 | \sa isDocumentType(), QDomNode::toDocumentType() | - | ||||||||||||||||||||||||
| 3754 | */ | - | ||||||||||||||||||||||||
| 3755 | - | |||||||||||||||||||||||||
| 3756 | #undef IMPL | - | ||||||||||||||||||||||||
| 3757 | - | |||||||||||||||||||||||||
| 3758 | /************************************************************** | - | ||||||||||||||||||||||||
| 3759 | * | - | ||||||||||||||||||||||||
| 3760 | * QDomDocumentFragmentPrivate | - | ||||||||||||||||||||||||
| 3761 | * | - | ||||||||||||||||||||||||
| 3762 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3763 | - | |||||||||||||||||||||||||
| 3764 | QDomDocumentFragmentPrivate::QDomDocumentFragmentPrivate(QDomDocumentPrivate* doc, QDomNodePrivate* parent) | - | ||||||||||||||||||||||||
| 3765 | : QDomNodePrivate(doc, parent) | - | ||||||||||||||||||||||||
| 3766 | { | - | ||||||||||||||||||||||||
| 3767 | name = QLatin1String("#document-fragment"); | - | ||||||||||||||||||||||||
| 3768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3769 | - | |||||||||||||||||||||||||
| 3770 | QDomDocumentFragmentPrivate::QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3771 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3772 | { | - | ||||||||||||||||||||||||
| 3773 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3774 | - | |||||||||||||||||||||||||
| 3775 | QDomNodePrivate* QDomDocumentFragmentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3776 | { | - | ||||||||||||||||||||||||
| 3777 | QDomNodePrivate* p = new QDomDocumentFragmentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 3778 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3779 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3780 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3781 | } | - | ||||||||||||||||||||||||
| 3782 | - | |||||||||||||||||||||||||
| 3783 | /************************************************************** | - | ||||||||||||||||||||||||
| 3784 | * | - | ||||||||||||||||||||||||
| 3785 | * QDomDocumentFragment | - | ||||||||||||||||||||||||
| 3786 | * | - | ||||||||||||||||||||||||
| 3787 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3788 | - | |||||||||||||||||||||||||
| 3789 | /*! | - | ||||||||||||||||||||||||
| 3790 | \class QDomDocumentFragment | - | ||||||||||||||||||||||||
| 3791 | \reentrant | - | ||||||||||||||||||||||||
| 3792 | \brief The QDomDocumentFragment class is a tree of QDomNodes which is not usually a complete QDomDocument. | - | ||||||||||||||||||||||||
| 3793 | - | |||||||||||||||||||||||||
| 3794 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3795 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3796 | - | |||||||||||||||||||||||||
| 3797 | If you want to do complex tree operations it is useful to have a | - | ||||||||||||||||||||||||
| 3798 | lightweight class to store nodes and their relations. | - | ||||||||||||||||||||||||
| 3799 | QDomDocumentFragment stores a subtree of a document which does not | - | ||||||||||||||||||||||||
| 3800 | necessarily represent a well-formed XML document. | - | ||||||||||||||||||||||||
| 3801 | - | |||||||||||||||||||||||||
| 3802 | QDomDocumentFragment is also useful if you want to group several | - | ||||||||||||||||||||||||
| 3803 | nodes in a list and insert them all together as children of some | - | ||||||||||||||||||||||||
| 3804 | node. In these cases QDomDocumentFragment can be used as a | - | ||||||||||||||||||||||||
| 3805 | temporary container for this list of children. | - | ||||||||||||||||||||||||
| 3806 | - | |||||||||||||||||||||||||
| 3807 | The most important feature of QDomDocumentFragment is that it is | - | ||||||||||||||||||||||||
| 3808 | treated in a special way by QDomNode::insertAfter(), | - | ||||||||||||||||||||||||
| 3809 | QDomNode::insertBefore(), QDomNode::replaceChild() and | - | ||||||||||||||||||||||||
| 3810 | QDomNode::appendChild(): instead of inserting the fragment itself, all | - | ||||||||||||||||||||||||
| 3811 | the fragment's children are inserted. | - | ||||||||||||||||||||||||
| 3812 | */ | - | ||||||||||||||||||||||||
| 3813 | - | |||||||||||||||||||||||||
| 3814 | /*! | - | ||||||||||||||||||||||||
| 3815 | Constructs an empty document fragment. | - | ||||||||||||||||||||||||
| 3816 | */ | - | ||||||||||||||||||||||||
| 3817 | QDomDocumentFragment::QDomDocumentFragment() | - | ||||||||||||||||||||||||
| 3818 | { | - | ||||||||||||||||||||||||
| 3819 | } | - | ||||||||||||||||||||||||
| 3820 | - | |||||||||||||||||||||||||
| 3821 | QDomDocumentFragment::QDomDocumentFragment(QDomDocumentFragmentPrivate* n) | - | ||||||||||||||||||||||||
| 3822 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3823 | { | - | ||||||||||||||||||||||||
| 3824 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3825 | - | |||||||||||||||||||||||||
| 3826 | /*! | - | ||||||||||||||||||||||||
| 3827 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 3828 | - | |||||||||||||||||||||||||
| 3829 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3830 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3831 | cloneNode(). | - | ||||||||||||||||||||||||
| 3832 | */ | - | ||||||||||||||||||||||||
| 3833 | QDomDocumentFragment::QDomDocumentFragment(const QDomDocumentFragment& x) | - | ||||||||||||||||||||||||
| 3834 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 3835 | { | - | ||||||||||||||||||||||||
| 3836 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3837 | - | |||||||||||||||||||||||||
| 3838 | /*! | - | ||||||||||||||||||||||||
| 3839 | Assigns \a x to this DOM document fragment. | - | ||||||||||||||||||||||||
| 3840 | - | |||||||||||||||||||||||||
| 3841 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3842 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3843 | cloneNode(). | - | ||||||||||||||||||||||||
| 3844 | */ | - | ||||||||||||||||||||||||
| 3845 | QDomDocumentFragment& QDomDocumentFragment::operator= (const QDomDocumentFragment& x) | - | ||||||||||||||||||||||||
| 3846 | { | - | ||||||||||||||||||||||||
| 3847 | return (QDomDocumentFragment&) QDomNode::operator=(x); never executed: return (QDomDocumentFragment&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 3848 | } | - | ||||||||||||||||||||||||
| 3849 | - | |||||||||||||||||||||||||
| 3850 | /*! | - | ||||||||||||||||||||||||
| 3851 | \fn QDomNode::NodeType QDomDocumentFragment::nodeType() const | - | ||||||||||||||||||||||||
| 3852 | - | |||||||||||||||||||||||||
| 3853 | Returns \c DocumentFragment. | - | ||||||||||||||||||||||||
| 3854 | - | |||||||||||||||||||||||||
| 3855 | \sa isDocumentFragment(), QDomNode::toDocumentFragment() | - | ||||||||||||||||||||||||
| 3856 | */ | - | ||||||||||||||||||||||||
| 3857 | - | |||||||||||||||||||||||||
| 3858 | /************************************************************** | - | ||||||||||||||||||||||||
| 3859 | * | - | ||||||||||||||||||||||||
| 3860 | * QDomCharacterDataPrivate | - | ||||||||||||||||||||||||
| 3861 | * | - | ||||||||||||||||||||||||
| 3862 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3863 | - | |||||||||||||||||||||||||
| 3864 | QDomCharacterDataPrivate::QDomCharacterDataPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 3865 | const QString& data) | - | ||||||||||||||||||||||||
| 3866 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 3867 | { | - | ||||||||||||||||||||||||
| 3868 | value = data; | - | ||||||||||||||||||||||||
| 3869 | name = QLatin1String("#character-data"); | - | ||||||||||||||||||||||||
| 3870 | } executed 993 times by 5 tests: end of blockExecuted by:
| 993 | ||||||||||||||||||||||||
| 3871 | - | |||||||||||||||||||||||||
| 3872 | QDomCharacterDataPrivate::QDomCharacterDataPrivate(QDomCharacterDataPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 3873 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 3874 | { | - | ||||||||||||||||||||||||
| 3875 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3876 | - | |||||||||||||||||||||||||
| 3877 | QDomNodePrivate* QDomCharacterDataPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 3878 | { | - | ||||||||||||||||||||||||
| 3879 | QDomNodePrivate* p = new QDomCharacterDataPrivate(this, deep); | - | ||||||||||||||||||||||||
| 3880 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 3881 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 3882 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 3883 | } | - | ||||||||||||||||||||||||
| 3884 | - | |||||||||||||||||||||||||
| 3885 | int QDomCharacterDataPrivate::dataLength() const | - | ||||||||||||||||||||||||
| 3886 | { | - | ||||||||||||||||||||||||
| 3887 | return value.length(); never executed: return value.length(); | 0 | ||||||||||||||||||||||||
| 3888 | } | - | ||||||||||||||||||||||||
| 3889 | - | |||||||||||||||||||||||||
| 3890 | QString QDomCharacterDataPrivate::substringData(unsigned long offset, unsigned long n) const | - | ||||||||||||||||||||||||
| 3891 | { | - | ||||||||||||||||||||||||
| 3892 | return value.mid(offset, n); never executed: return value.mid(offset, n); | 0 | ||||||||||||||||||||||||
| 3893 | } | - | ||||||||||||||||||||||||
| 3894 | - | |||||||||||||||||||||||||
| 3895 | void QDomCharacterDataPrivate::insertData(unsigned long offset, const QString& arg) | - | ||||||||||||||||||||||||
| 3896 | { | - | ||||||||||||||||||||||||
| 3897 | value.insert(offset, arg); | - | ||||||||||||||||||||||||
| 3898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3899 | - | |||||||||||||||||||||||||
| 3900 | void QDomCharacterDataPrivate::deleteData(unsigned long offset, unsigned long n) | - | ||||||||||||||||||||||||
| 3901 | { | - | ||||||||||||||||||||||||
| 3902 | value.remove(offset, n); | - | ||||||||||||||||||||||||
| 3903 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3904 | - | |||||||||||||||||||||||||
| 3905 | void QDomCharacterDataPrivate::replaceData(unsigned long offset, unsigned long n, const QString& arg) | - | ||||||||||||||||||||||||
| 3906 | { | - | ||||||||||||||||||||||||
| 3907 | value.replace(offset, n, arg); | - | ||||||||||||||||||||||||
| 3908 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3909 | - | |||||||||||||||||||||||||
| 3910 | void QDomCharacterDataPrivate::appendData(const QString& arg) | - | ||||||||||||||||||||||||
| 3911 | { | - | ||||||||||||||||||||||||
| 3912 | value += arg; | - | ||||||||||||||||||||||||
| 3913 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3914 | - | |||||||||||||||||||||||||
| 3915 | /************************************************************** | - | ||||||||||||||||||||||||
| 3916 | * | - | ||||||||||||||||||||||||
| 3917 | * QDomCharacterData | - | ||||||||||||||||||||||||
| 3918 | * | - | ||||||||||||||||||||||||
| 3919 | **************************************************************/ | - | ||||||||||||||||||||||||
| 3920 | - | |||||||||||||||||||||||||
| 3921 | #define IMPL ((QDomCharacterDataPrivate*)impl) | - | ||||||||||||||||||||||||
| 3922 | - | |||||||||||||||||||||||||
| 3923 | /*! | - | ||||||||||||||||||||||||
| 3924 | \class QDomCharacterData | - | ||||||||||||||||||||||||
| 3925 | \reentrant | - | ||||||||||||||||||||||||
| 3926 | \brief The QDomCharacterData class represents a generic string in the DOM. | - | ||||||||||||||||||||||||
| 3927 | - | |||||||||||||||||||||||||
| 3928 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 3929 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 3930 | - | |||||||||||||||||||||||||
| 3931 | Character data as used in XML specifies a generic data string. | - | ||||||||||||||||||||||||
| 3932 | More specialized versions of this class are QDomText, QDomComment | - | ||||||||||||||||||||||||
| 3933 | and QDomCDATASection. | - | ||||||||||||||||||||||||
| 3934 | - | |||||||||||||||||||||||||
| 3935 | The data string is set with setData() and retrieved with data(). | - | ||||||||||||||||||||||||
| 3936 | You can retrieve a portion of the data string using | - | ||||||||||||||||||||||||
| 3937 | substringData(). Extra data can be appended with appendData(), or | - | ||||||||||||||||||||||||
| 3938 | inserted with insertData(). Portions of the data string can be | - | ||||||||||||||||||||||||
| 3939 | deleted with deleteData() or replaced with replaceData(). The | - | ||||||||||||||||||||||||
| 3940 | length of the data string is returned by length(). | - | ||||||||||||||||||||||||
| 3941 | - | |||||||||||||||||||||||||
| 3942 | The node type of the node containing this character data is | - | ||||||||||||||||||||||||
| 3943 | returned by nodeType(). | - | ||||||||||||||||||||||||
| 3944 | - | |||||||||||||||||||||||||
| 3945 | \sa QDomText, QDomComment, QDomCDATASection | - | ||||||||||||||||||||||||
| 3946 | */ | - | ||||||||||||||||||||||||
| 3947 | - | |||||||||||||||||||||||||
| 3948 | /*! | - | ||||||||||||||||||||||||
| 3949 | Constructs an empty character data object. | - | ||||||||||||||||||||||||
| 3950 | */ | - | ||||||||||||||||||||||||
| 3951 | QDomCharacterData::QDomCharacterData() | - | ||||||||||||||||||||||||
| 3952 | { | - | ||||||||||||||||||||||||
| 3953 | } | - | ||||||||||||||||||||||||
| 3954 | - | |||||||||||||||||||||||||
| 3955 | /*! | - | ||||||||||||||||||||||||
| 3956 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 3957 | - | |||||||||||||||||||||||||
| 3958 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3959 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3960 | cloneNode(). | - | ||||||||||||||||||||||||
| 3961 | */ | - | ||||||||||||||||||||||||
| 3962 | QDomCharacterData::QDomCharacterData(const QDomCharacterData& x) | - | ||||||||||||||||||||||||
| 3963 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 3964 | { | - | ||||||||||||||||||||||||
| 3965 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3966 | - | |||||||||||||||||||||||||
| 3967 | QDomCharacterData::QDomCharacterData(QDomCharacterDataPrivate* n) | - | ||||||||||||||||||||||||
| 3968 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 3969 | { | - | ||||||||||||||||||||||||
| 3970 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3971 | - | |||||||||||||||||||||||||
| 3972 | /*! | - | ||||||||||||||||||||||||
| 3973 | Assigns \a x to this character data. | - | ||||||||||||||||||||||||
| 3974 | - | |||||||||||||||||||||||||
| 3975 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 3976 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 3977 | cloneNode(). | - | ||||||||||||||||||||||||
| 3978 | */ | - | ||||||||||||||||||||||||
| 3979 | QDomCharacterData& QDomCharacterData::operator= (const QDomCharacterData& x) | - | ||||||||||||||||||||||||
| 3980 | { | - | ||||||||||||||||||||||||
| 3981 | return (QDomCharacterData&) QDomNode::operator=(x); never executed: return (QDomCharacterData&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 3982 | } | - | ||||||||||||||||||||||||
| 3983 | - | |||||||||||||||||||||||||
| 3984 | /*! | - | ||||||||||||||||||||||||
| 3985 | Returns the string stored in this object. | - | ||||||||||||||||||||||||
| 3986 | - | |||||||||||||||||||||||||
| 3987 | If the node is a \l{isNull()}{null node}, it will return | - | ||||||||||||||||||||||||
| 3988 | an empty string. | - | ||||||||||||||||||||||||
| 3989 | */ | - | ||||||||||||||||||||||||
| 3990 | QString QDomCharacterData::data() const | - | ||||||||||||||||||||||||
| 3991 | { | - | ||||||||||||||||||||||||
| 3992 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 3993 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 3994 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 3995 | } | - | ||||||||||||||||||||||||
| 3996 | - | |||||||||||||||||||||||||
| 3997 | /*! | - | ||||||||||||||||||||||||
| 3998 | Sets this object's string to \a v. | - | ||||||||||||||||||||||||
| 3999 | */ | - | ||||||||||||||||||||||||
| 4000 | void QDomCharacterData::setData(const QString& v) | - | ||||||||||||||||||||||||
| 4001 | { | - | ||||||||||||||||||||||||
| 4002 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4003 | impl->setNodeValue(v); never executed: impl->setNodeValue(v); | 0 | ||||||||||||||||||||||||
| 4004 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4005 | - | |||||||||||||||||||||||||
| 4006 | /*! | - | ||||||||||||||||||||||||
| 4007 | Returns the length of the stored string. | - | ||||||||||||||||||||||||
| 4008 | */ | - | ||||||||||||||||||||||||
| 4009 | int QDomCharacterData::length() const | - | ||||||||||||||||||||||||
| 4010 | { | - | ||||||||||||||||||||||||
| 4011 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4012 | return IMPL->dataLength(); never executed: return ((QDomCharacterDataPrivate*)impl)->dataLength(); | 0 | ||||||||||||||||||||||||
| 4013 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 4014 | } | - | ||||||||||||||||||||||||
| 4015 | - | |||||||||||||||||||||||||
| 4016 | /*! | - | ||||||||||||||||||||||||
| 4017 | Returns the substring of length \a count from position \a offset. | - | ||||||||||||||||||||||||
| 4018 | */ | - | ||||||||||||||||||||||||
| 4019 | QString QDomCharacterData::substringData(unsigned long offset, unsigned long count) | - | ||||||||||||||||||||||||
| 4020 | { | - | ||||||||||||||||||||||||
| 4021 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4022 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4023 | return IMPL->substringData(offset, count); never executed: return ((QDomCharacterDataPrivate*)impl)->substringData(offset, count); | 0 | ||||||||||||||||||||||||
| 4024 | } | - | ||||||||||||||||||||||||
| 4025 | - | |||||||||||||||||||||||||
| 4026 | /*! | - | ||||||||||||||||||||||||
| 4027 | Appends the string \a arg to the stored string. | - | ||||||||||||||||||||||||
| 4028 | */ | - | ||||||||||||||||||||||||
| 4029 | void QDomCharacterData::appendData(const QString& arg) | - | ||||||||||||||||||||||||
| 4030 | { | - | ||||||||||||||||||||||||
| 4031 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4032 | IMPL->appendData(arg); never executed: ((QDomCharacterDataPrivate*)impl)->appendData(arg); | 0 | ||||||||||||||||||||||||
| 4033 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4034 | - | |||||||||||||||||||||||||
| 4035 | /*! | - | ||||||||||||||||||||||||
| 4036 | Inserts the string \a arg into the stored string at position \a offset. | - | ||||||||||||||||||||||||
| 4037 | */ | - | ||||||||||||||||||||||||
| 4038 | void QDomCharacterData::insertData(unsigned long offset, const QString& arg) | - | ||||||||||||||||||||||||
| 4039 | { | - | ||||||||||||||||||||||||
| 4040 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4041 | IMPL->insertData(offset, arg); never executed: ((QDomCharacterDataPrivate*)impl)->insertData(offset, arg); | 0 | ||||||||||||||||||||||||
| 4042 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4043 | - | |||||||||||||||||||||||||
| 4044 | /*! | - | ||||||||||||||||||||||||
| 4045 | Deletes a substring of length \a count from position \a offset. | - | ||||||||||||||||||||||||
| 4046 | */ | - | ||||||||||||||||||||||||
| 4047 | void QDomCharacterData::deleteData(unsigned long offset, unsigned long count) | - | ||||||||||||||||||||||||
| 4048 | { | - | ||||||||||||||||||||||||
| 4049 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4050 | IMPL->deleteData(offset, count); never executed: ((QDomCharacterDataPrivate*)impl)->deleteData(offset, count); | 0 | ||||||||||||||||||||||||
| 4051 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4052 | - | |||||||||||||||||||||||||
| 4053 | /*! | - | ||||||||||||||||||||||||
| 4054 | Replaces the substring of length \a count starting at position \a | - | ||||||||||||||||||||||||
| 4055 | offset with the string \a arg. | - | ||||||||||||||||||||||||
| 4056 | */ | - | ||||||||||||||||||||||||
| 4057 | void QDomCharacterData::replaceData(unsigned long offset, unsigned long count, const QString& arg) | - | ||||||||||||||||||||||||
| 4058 | { | - | ||||||||||||||||||||||||
| 4059 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4060 | IMPL->replaceData(offset, count, arg); never executed: ((QDomCharacterDataPrivate*)impl)->replaceData(offset, count, arg); | 0 | ||||||||||||||||||||||||
| 4061 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4062 | - | |||||||||||||||||||||||||
| 4063 | /*! | - | ||||||||||||||||||||||||
| 4064 | Returns the type of node this object refers to (i.e. \c TextNode, | - | ||||||||||||||||||||||||
| 4065 | \c CDATASectionNode, \c CommentNode or \c CharacterDataNode). For | - | ||||||||||||||||||||||||
| 4066 | a \l{isNull()}{null node}, returns \c CharacterDataNode. | - | ||||||||||||||||||||||||
| 4067 | */ | - | ||||||||||||||||||||||||
| 4068 | QDomNode::NodeType QDomCharacterData::nodeType() const | - | ||||||||||||||||||||||||
| 4069 | { | - | ||||||||||||||||||||||||
| 4070 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4071 | return CharacterDataNode; never executed: return CharacterDataNode; | 0 | ||||||||||||||||||||||||
| 4072 | return QDomNode::nodeType(); never executed: return QDomNode::nodeType(); | 0 | ||||||||||||||||||||||||
| 4073 | } | - | ||||||||||||||||||||||||
| 4074 | - | |||||||||||||||||||||||||
| 4075 | #undef IMPL | - | ||||||||||||||||||||||||
| 4076 | - | |||||||||||||||||||||||||
| 4077 | /************************************************************** | - | ||||||||||||||||||||||||
| 4078 | * | - | ||||||||||||||||||||||||
| 4079 | * QDomAttrPrivate | - | ||||||||||||||||||||||||
| 4080 | * | - | ||||||||||||||||||||||||
| 4081 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4082 | - | |||||||||||||||||||||||||
| 4083 | QDomAttrPrivate::QDomAttrPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& name_) | - | ||||||||||||||||||||||||
| 4084 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 4085 | { | - | ||||||||||||||||||||||||
| 4086 | name = name_; | - | ||||||||||||||||||||||||
| 4087 | m_specified = false; | - | ||||||||||||||||||||||||
| 4088 | } executed 865 times by 3 tests: end of blockExecuted by:
| 865 | ||||||||||||||||||||||||
| 4089 | - | |||||||||||||||||||||||||
| 4090 | QDomAttrPrivate::QDomAttrPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 4091 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4092 | { | - | ||||||||||||||||||||||||
| 4093 | qt_split_namespace(prefix, name, qName, !nsURI.isNull()); | - | ||||||||||||||||||||||||
| 4094 | namespaceURI = nsURI; | - | ||||||||||||||||||||||||
| 4095 | createdWithDom1Interface = false; | - | ||||||||||||||||||||||||
| 4096 | m_specified = false; | - | ||||||||||||||||||||||||
| 4097 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4098 | - | |||||||||||||||||||||||||
| 4099 | QDomAttrPrivate::QDomAttrPrivate(QDomAttrPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 4100 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 4101 | { | - | ||||||||||||||||||||||||
| 4102 | m_specified = n->specified(); | - | ||||||||||||||||||||||||
| 4103 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4104 | - | |||||||||||||||||||||||||
| 4105 | void QDomAttrPrivate::setNodeValue(const QString& v) | - | ||||||||||||||||||||||||
| 4106 | { | - | ||||||||||||||||||||||||
| 4107 | value = v; | - | ||||||||||||||||||||||||
| 4108 | QDomTextPrivate *t = new QDomTextPrivate(0, this, v); | - | ||||||||||||||||||||||||
| 4109 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 4110 | t->ref.deref(); | - | ||||||||||||||||||||||||
| 4111 | if (first) {
| 1-867 | ||||||||||||||||||||||||
| 4112 | delete removeChild(first); | - | ||||||||||||||||||||||||
| 4113 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 4114 | appendChild(t); | - | ||||||||||||||||||||||||
| 4115 | } executed 868 times by 4 tests: end of blockExecuted by:
| 868 | ||||||||||||||||||||||||
| 4116 | - | |||||||||||||||||||||||||
| 4117 | QDomNodePrivate* QDomAttrPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 4118 | { | - | ||||||||||||||||||||||||
| 4119 | QDomNodePrivate* p = new QDomAttrPrivate(this, deep); | - | ||||||||||||||||||||||||
| 4120 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 4121 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 4122 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 4123 | } | - | ||||||||||||||||||||||||
| 4124 | - | |||||||||||||||||||||||||
| 4125 | bool QDomAttrPrivate::specified() const | - | ||||||||||||||||||||||||
| 4126 | { | - | ||||||||||||||||||||||||
| 4127 | return m_specified; never executed: return m_specified; | 0 | ||||||||||||||||||||||||
| 4128 | } | - | ||||||||||||||||||||||||
| 4129 | - | |||||||||||||||||||||||||
| 4130 | /* \internal | - | ||||||||||||||||||||||||
| 4131 | Encode & escape \a str. Yes, it makes no sense to return a QString, | - | ||||||||||||||||||||||||
| 4132 | but is so for legacy reasons. | - | ||||||||||||||||||||||||
| 4133 | - | |||||||||||||||||||||||||
| 4134 | Remember that content produced should be able to roundtrip with 2.11 End-of-Line Handling | - | ||||||||||||||||||||||||
| 4135 | and 3.3.3 Attribute-Value Normalization. | - | ||||||||||||||||||||||||
| 4136 | - | |||||||||||||||||||||||||
| 4137 | If \a performAVN is true, characters will be escaped to survive Attribute Value Normalization. | - | ||||||||||||||||||||||||
| 4138 | If \a encodeEOLs is true, characters will be escaped to survive End-of-Line Handling. | - | ||||||||||||||||||||||||
| 4139 | */ | - | ||||||||||||||||||||||||
| 4140 | static QString encodeText(const QString &str, | - | ||||||||||||||||||||||||
| 4141 | QTextStream &s, | - | ||||||||||||||||||||||||
| 4142 | const bool encodeQuotes = true, | - | ||||||||||||||||||||||||
| 4143 | const bool performAVN = false, | - | ||||||||||||||||||||||||
| 4144 | const bool encodeEOLs = false) | - | ||||||||||||||||||||||||
| 4145 | { | - | ||||||||||||||||||||||||
| 4146 | #ifdef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 4147 | Q_UNUSED(s); | - | ||||||||||||||||||||||||
| 4148 | #else | - | ||||||||||||||||||||||||
| 4149 | const QTextCodec *const codec = s.codec(); | - | ||||||||||||||||||||||||
| 4150 | Q_ASSERT(codec); | - | ||||||||||||||||||||||||
| 4151 | #endif | - | ||||||||||||||||||||||||
| 4152 | QString retval(str); | - | ||||||||||||||||||||||||
| 4153 | int len = retval.length(); | - | ||||||||||||||||||||||||
| 4154 | int i = 0; | - | ||||||||||||||||||||||||
| 4155 | - | |||||||||||||||||||||||||
| 4156 | while (i < len) {
| 396-2468 | ||||||||||||||||||||||||
| 4157 | const QChar ati(retval.at(i)); | - | ||||||||||||||||||||||||
| 4158 | - | |||||||||||||||||||||||||
| 4159 | if (ati == QLatin1Char('<')) {
| 0-2468 | ||||||||||||||||||||||||
| 4160 | retval.replace(i, 1, QLatin1String("<")); | - | ||||||||||||||||||||||||
| 4161 | len += 3; | - | ||||||||||||||||||||||||
| 4162 | i += 4; | - | ||||||||||||||||||||||||
| 4163 | } else if (encodeQuotes && (ati == QLatin1Char('"'))) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4164 | retval.replace(i, 1, QLatin1String(""")); | - | ||||||||||||||||||||||||
| 4165 | len += 5; | - | ||||||||||||||||||||||||
| 4166 | i += 6; | - | ||||||||||||||||||||||||
| 4167 | } else if (ati == QLatin1Char('&')) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4168 | retval.replace(i, 1, QLatin1String("&")); | - | ||||||||||||||||||||||||
| 4169 | len += 4; | - | ||||||||||||||||||||||||
| 4170 | i += 5; | - | ||||||||||||||||||||||||
| 4171 | } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4172 | retval.replace(i, 1, QLatin1String(">")); | - | ||||||||||||||||||||||||
| 4173 | len += 3; | - | ||||||||||||||||||||||||
| 4174 | i += 4; | - | ||||||||||||||||||||||||
| 4175 | } else if (performAVN && never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4176 | (ati == QChar(0xA) ||
| 0-2468 | ||||||||||||||||||||||||
| 4177 | ati == QChar(0xD) ||
| 0-2468 | ||||||||||||||||||||||||
| 4178 | ati == QChar(0x9))) {
| 0-2468 | ||||||||||||||||||||||||
| 4179 | const QString replacement(QLatin1String("&#x") + QString::number(ati.unicode(), 16) + QLatin1Char(';')); | - | ||||||||||||||||||||||||
| 4180 | retval.replace(i, 1, replacement); | - | ||||||||||||||||||||||||
| 4181 | i += replacement.length(); | - | ||||||||||||||||||||||||
| 4182 | len += replacement.length() - 1; | - | ||||||||||||||||||||||||
| 4183 | } else if (encodeEOLs && ati == QChar(0xD)) { never executed: end of block
| 0-2468 | ||||||||||||||||||||||||
| 4184 | retval.replace(i, 1, QLatin1String("
")); // Replace a single 0xD with a ref for 0xD | - | ||||||||||||||||||||||||
| 4185 | len += 4; | - | ||||||||||||||||||||||||
| 4186 | i += 5; | - | ||||||||||||||||||||||||
| 4187 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4188 | #ifndef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 4189 | if(codec->canEncode(ati))
| 0-2468 | ||||||||||||||||||||||||
| 4190 | ++i; executed 2468 times by 2 tests: ++i;Executed by:
| 2468 | ||||||||||||||||||||||||
| 4191 | else | - | ||||||||||||||||||||||||
| 4192 | #endif | - | ||||||||||||||||||||||||
| 4193 | { | - | ||||||||||||||||||||||||
| 4194 | // We have to use a character reference to get it through. | - | ||||||||||||||||||||||||
| 4195 | const ushort codepoint(ati.unicode()); | - | ||||||||||||||||||||||||
| 4196 | const QString replacement(QLatin1String("&#x") + QString::number(codepoint, 16) + QLatin1Char(';')); | - | ||||||||||||||||||||||||
| 4197 | retval.replace(i, 1, replacement); | - | ||||||||||||||||||||||||
| 4198 | i += replacement.length(); | - | ||||||||||||||||||||||||
| 4199 | len += replacement.length() - 1; | - | ||||||||||||||||||||||||
| 4200 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4201 | } | - | ||||||||||||||||||||||||
| 4202 | } | - | ||||||||||||||||||||||||
| 4203 | - | |||||||||||||||||||||||||
| 4204 | return retval; executed 396 times by 2 tests: return retval;Executed by:
| 396 | ||||||||||||||||||||||||
| 4205 | } | - | ||||||||||||||||||||||||
| 4206 | - | |||||||||||||||||||||||||
| 4207 | void QDomAttrPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 4208 | { | - | ||||||||||||||||||||||||
| 4209 | if (namespaceURI.isNull()) {
| 0 | ||||||||||||||||||||||||
| 4210 | s << name << "=\"" << encodeText(value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4211 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4212 | s << prefix << ':' << name << "=\"" << encodeText(value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4213 | /* This is a fix for 138243, as good as it gets. | - | ||||||||||||||||||||||||
| 4214 | * | - | ||||||||||||||||||||||||
| 4215 | * QDomElementPrivate::save() output a namespace declaration if | - | ||||||||||||||||||||||||
| 4216 | * the element is in a namespace, no matter what. This function do as well, meaning | - | ||||||||||||||||||||||||
| 4217 | * that we get two identical namespace declaration if we don't have the if- | - | ||||||||||||||||||||||||
| 4218 | * statement below. | - | ||||||||||||||||||||||||
| 4219 | * | - | ||||||||||||||||||||||||
| 4220 | * This doesn't work when the parent element has the same prefix as us but | - | ||||||||||||||||||||||||
| 4221 | * a different namespace. However, this can only occur by the user modifying the element, | - | ||||||||||||||||||||||||
| 4222 | * and we don't do fixups by that anyway, and hence it's the user responsibility to not | - | ||||||||||||||||||||||||
| 4223 | * arrive in those situations. */ | - | ||||||||||||||||||||||||
| 4224 | if(!ownerNode ||
| 0 | ||||||||||||||||||||||||
| 4225 | ownerNode->prefix != prefix) {
| 0 | ||||||||||||||||||||||||
| 4226 | s << " xmlns:" << prefix << "=\"" << encodeText(namespaceURI, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4227 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4229 | } | - | ||||||||||||||||||||||||
| 4230 | - | |||||||||||||||||||||||||
| 4231 | /************************************************************** | - | ||||||||||||||||||||||||
| 4232 | * | - | ||||||||||||||||||||||||
| 4233 | * QDomAttr | - | ||||||||||||||||||||||||
| 4234 | * | - | ||||||||||||||||||||||||
| 4235 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4236 | - | |||||||||||||||||||||||||
| 4237 | #define IMPL ((QDomAttrPrivate*)impl) | - | ||||||||||||||||||||||||
| 4238 | - | |||||||||||||||||||||||||
| 4239 | /*! | - | ||||||||||||||||||||||||
| 4240 | \class QDomAttr | - | ||||||||||||||||||||||||
| 4241 | \reentrant | - | ||||||||||||||||||||||||
| 4242 | \brief The QDomAttr class represents one attribute of a QDomElement. | - | ||||||||||||||||||||||||
| 4243 | - | |||||||||||||||||||||||||
| 4244 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 4245 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 4246 | - | |||||||||||||||||||||||||
| 4247 | For example, the following piece of XML produces an element with | - | ||||||||||||||||||||||||
| 4248 | no children, but two attributes: | - | ||||||||||||||||||||||||
| 4249 | - | |||||||||||||||||||||||||
| 4250 | \snippet code/src_xml_dom_qdom.cpp 7 | - | ||||||||||||||||||||||||
| 4251 | - | |||||||||||||||||||||||||
| 4252 | You can access the attributes of an element with code like this: | - | ||||||||||||||||||||||||
| 4253 | - | |||||||||||||||||||||||||
| 4254 | \snippet code/src_xml_dom_qdom.cpp 8 | - | ||||||||||||||||||||||||
| 4255 | - | |||||||||||||||||||||||||
| 4256 | This example also shows that changing an attribute received from | - | ||||||||||||||||||||||||
| 4257 | an element changes the attribute of the element. If you do not | - | ||||||||||||||||||||||||
| 4258 | want to change the value of the element's attribute you must | - | ||||||||||||||||||||||||
| 4259 | use cloneNode() to get an independent copy of the attribute. | - | ||||||||||||||||||||||||
| 4260 | - | |||||||||||||||||||||||||
| 4261 | QDomAttr can return the name() and value() of an attribute. An | - | ||||||||||||||||||||||||
| 4262 | attribute's value is set with setValue(). If specified() returns | - | ||||||||||||||||||||||||
| 4263 | true the value was set with setValue(). The node this | - | ||||||||||||||||||||||||
| 4264 | attribute is attached to (if any) is returned by ownerElement(). | - | ||||||||||||||||||||||||
| 4265 | - | |||||||||||||||||||||||||
| 4266 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 4267 | \l{http://www.w3.org/TR/REC-DOM-Level-1/} and | - | ||||||||||||||||||||||||
| 4268 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}. | - | ||||||||||||||||||||||||
| 4269 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 4270 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 4271 | */ | - | ||||||||||||||||||||||||
| 4272 | - | |||||||||||||||||||||||||
| 4273 | - | |||||||||||||||||||||||||
| 4274 | /*! | - | ||||||||||||||||||||||||
| 4275 | Constructs an empty attribute. | - | ||||||||||||||||||||||||
| 4276 | */ | - | ||||||||||||||||||||||||
| 4277 | QDomAttr::QDomAttr() | - | ||||||||||||||||||||||||
| 4278 | { | - | ||||||||||||||||||||||||
| 4279 | } | - | ||||||||||||||||||||||||
| 4280 | - | |||||||||||||||||||||||||
| 4281 | /*! | - | ||||||||||||||||||||||||
| 4282 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 4283 | - | |||||||||||||||||||||||||
| 4284 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4285 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4286 | cloneNode(). | - | ||||||||||||||||||||||||
| 4287 | */ | - | ||||||||||||||||||||||||
| 4288 | QDomAttr::QDomAttr(const QDomAttr& x) | - | ||||||||||||||||||||||||
| 4289 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 4290 | { | - | ||||||||||||||||||||||||
| 4291 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4292 | - | |||||||||||||||||||||||||
| 4293 | QDomAttr::QDomAttr(QDomAttrPrivate* n) | - | ||||||||||||||||||||||||
| 4294 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 4295 | { | - | ||||||||||||||||||||||||
| 4296 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4297 | - | |||||||||||||||||||||||||
| 4298 | /*! | - | ||||||||||||||||||||||||
| 4299 | Assigns \a x to this DOM attribute. | - | ||||||||||||||||||||||||
| 4300 | - | |||||||||||||||||||||||||
| 4301 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4302 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4303 | cloneNode(). | - | ||||||||||||||||||||||||
| 4304 | */ | - | ||||||||||||||||||||||||
| 4305 | QDomAttr& QDomAttr::operator= (const QDomAttr& x) | - | ||||||||||||||||||||||||
| 4306 | { | - | ||||||||||||||||||||||||
| 4307 | return (QDomAttr&) QDomNode::operator=(x); never executed: return (QDomAttr&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 4308 | } | - | ||||||||||||||||||||||||
| 4309 | - | |||||||||||||||||||||||||
| 4310 | /*! | - | ||||||||||||||||||||||||
| 4311 | Returns the attribute's name. | - | ||||||||||||||||||||||||
| 4312 | */ | - | ||||||||||||||||||||||||
| 4313 | QString QDomAttr::name() const | - | ||||||||||||||||||||||||
| 4314 | { | - | ||||||||||||||||||||||||
| 4315 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4316 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4317 | return impl->nodeName(); never executed: return impl->nodeName(); | 0 | ||||||||||||||||||||||||
| 4318 | } | - | ||||||||||||||||||||||||
| 4319 | - | |||||||||||||||||||||||||
| 4320 | /*! | - | ||||||||||||||||||||||||
| 4321 | Returns \c true if the attribute has been set by the user with setValue(). | - | ||||||||||||||||||||||||
| 4322 | Returns \c false if the value hasn't been specified or set. | - | ||||||||||||||||||||||||
| 4323 | - | |||||||||||||||||||||||||
| 4324 | \sa setValue() | - | ||||||||||||||||||||||||
| 4325 | */ | - | ||||||||||||||||||||||||
| 4326 | bool QDomAttr::specified() const | - | ||||||||||||||||||||||||
| 4327 | { | - | ||||||||||||||||||||||||
| 4328 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4329 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 4330 | return IMPL->specified(); never executed: return ((QDomAttrPrivate*)impl)->specified(); | 0 | ||||||||||||||||||||||||
| 4331 | } | - | ||||||||||||||||||||||||
| 4332 | - | |||||||||||||||||||||||||
| 4333 | /*! | - | ||||||||||||||||||||||||
| 4334 | Returns the element node this attribute is attached to or a | - | ||||||||||||||||||||||||
| 4335 | \l{QDomNode::isNull()}{null node} if this attribute is not | - | ||||||||||||||||||||||||
| 4336 | attached to any element. | - | ||||||||||||||||||||||||
| 4337 | */ | - | ||||||||||||||||||||||||
| 4338 | QDomElement QDomAttr::ownerElement() const | - | ||||||||||||||||||||||||
| 4339 | { | - | ||||||||||||||||||||||||
| 4340 | Q_ASSERT(impl->parent()); | - | ||||||||||||||||||||||||
| 4341 | if (!impl->parent()->isElement())
| 0 | ||||||||||||||||||||||||
| 4342 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 4343 | return QDomElement((QDomElementPrivate*)(impl->parent())); never executed: return QDomElement((QDomElementPrivate*)(impl->parent())); | 0 | ||||||||||||||||||||||||
| 4344 | } | - | ||||||||||||||||||||||||
| 4345 | - | |||||||||||||||||||||||||
| 4346 | /*! | - | ||||||||||||||||||||||||
| 4347 | Returns the value of the attribute or an empty string if the | - | ||||||||||||||||||||||||
| 4348 | attribute has not been specified. | - | ||||||||||||||||||||||||
| 4349 | - | |||||||||||||||||||||||||
| 4350 | \sa specified(), setValue() | - | ||||||||||||||||||||||||
| 4351 | */ | - | ||||||||||||||||||||||||
| 4352 | QString QDomAttr::value() const | - | ||||||||||||||||||||||||
| 4353 | { | - | ||||||||||||||||||||||||
| 4354 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4355 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4356 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4357 | } | - | ||||||||||||||||||||||||
| 4358 | - | |||||||||||||||||||||||||
| 4359 | /*! | - | ||||||||||||||||||||||||
| 4360 | Sets the attribute's value to \a v. | - | ||||||||||||||||||||||||
| 4361 | - | |||||||||||||||||||||||||
| 4362 | \sa value() | - | ||||||||||||||||||||||||
| 4363 | */ | - | ||||||||||||||||||||||||
| 4364 | void QDomAttr::setValue(const QString& v) | - | ||||||||||||||||||||||||
| 4365 | { | - | ||||||||||||||||||||||||
| 4366 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4367 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4368 | impl->setNodeValue(v); | - | ||||||||||||||||||||||||
| 4369 | IMPL->m_specified = true; | - | ||||||||||||||||||||||||
| 4370 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4371 | - | |||||||||||||||||||||||||
| 4372 | /*! | - | ||||||||||||||||||||||||
| 4373 | \fn QDomNode::NodeType QDomAttr::nodeType() const | - | ||||||||||||||||||||||||
| 4374 | - | |||||||||||||||||||||||||
| 4375 | Returns \l{QDomNode::NodeType}{AttributeNode}. | - | ||||||||||||||||||||||||
| 4376 | */ | - | ||||||||||||||||||||||||
| 4377 | - | |||||||||||||||||||||||||
| 4378 | #undef IMPL | - | ||||||||||||||||||||||||
| 4379 | - | |||||||||||||||||||||||||
| 4380 | /************************************************************** | - | ||||||||||||||||||||||||
| 4381 | * | - | ||||||||||||||||||||||||
| 4382 | * QDomElementPrivate | - | ||||||||||||||||||||||||
| 4383 | * | - | ||||||||||||||||||||||||
| 4384 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4385 | - | |||||||||||||||||||||||||
| 4386 | QDomElementPrivate::QDomElementPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 4387 | const QString& tagname) | - | ||||||||||||||||||||||||
| 4388 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4389 | { | - | ||||||||||||||||||||||||
| 4390 | name = tagname; | - | ||||||||||||||||||||||||
| 4391 | m_attr = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 4392 | } executed 1021 times by 4 tests: end of blockExecuted by:
| 1021 | ||||||||||||||||||||||||
| 4393 | - | |||||||||||||||||||||||||
| 4394 | QDomElementPrivate::QDomElementPrivate(QDomDocumentPrivate* d, QDomNodePrivate* p, | - | ||||||||||||||||||||||||
| 4395 | const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 4396 | : QDomNodePrivate(d, p) | - | ||||||||||||||||||||||||
| 4397 | { | - | ||||||||||||||||||||||||
| 4398 | qt_split_namespace(prefix, name, qName, !nsURI.isNull()); | - | ||||||||||||||||||||||||
| 4399 | namespaceURI = nsURI; | - | ||||||||||||||||||||||||
| 4400 | createdWithDom1Interface = false; | - | ||||||||||||||||||||||||
| 4401 | m_attr = new QDomNamedNodeMapPrivate(this); | - | ||||||||||||||||||||||||
| 4402 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4403 | - | |||||||||||||||||||||||||
| 4404 | QDomElementPrivate::QDomElementPrivate(QDomElementPrivate* n, bool deep) : | - | ||||||||||||||||||||||||
| 4405 | QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 4406 | { | - | ||||||||||||||||||||||||
| 4407 | m_attr = n->m_attr->clone(this); | - | ||||||||||||||||||||||||
| 4408 | // Reference is down to 0, so we set it to 1 here. | - | ||||||||||||||||||||||||
| 4409 | m_attr->ref.ref(); | - | ||||||||||||||||||||||||
| 4410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4411 | - | |||||||||||||||||||||||||
| 4412 | QDomElementPrivate::~QDomElementPrivate() | - | ||||||||||||||||||||||||
| 4413 | { | - | ||||||||||||||||||||||||
| 4414 | if (!m_attr->ref.deref())
| 0-1023 | ||||||||||||||||||||||||
| 4415 | delete m_attr; executed 1023 times by 5 tests: delete m_attr;Executed by:
| 1023 | ||||||||||||||||||||||||
| 4416 | } executed 1023 times by 5 tests: end of blockExecuted by:
| 1023 | ||||||||||||||||||||||||
| 4417 | - | |||||||||||||||||||||||||
| 4418 | QDomNodePrivate* QDomElementPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 4419 | { | - | ||||||||||||||||||||||||
| 4420 | QDomNodePrivate* p = new QDomElementPrivate(this, deep); | - | ||||||||||||||||||||||||
| 4421 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 4422 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 4423 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 4424 | } | - | ||||||||||||||||||||||||
| 4425 | - | |||||||||||||||||||||||||
| 4426 | QString QDomElementPrivate::attribute(const QString& name_, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4427 | { | - | ||||||||||||||||||||||||
| 4428 | QDomNodePrivate* n = m_attr->namedItem(name_); | - | ||||||||||||||||||||||||
| 4429 | if (!n)
| 1-33 | ||||||||||||||||||||||||
| 4430 | return defValue; executed 1 time by 1 test: return defValue;Executed by:
| 1 | ||||||||||||||||||||||||
| 4431 | - | |||||||||||||||||||||||||
| 4432 | return n->nodeValue(); executed 33 times by 1 test: return n->nodeValue();Executed by:
| 33 | ||||||||||||||||||||||||
| 4433 | } | - | ||||||||||||||||||||||||
| 4434 | - | |||||||||||||||||||||||||
| 4435 | QString QDomElementPrivate::attributeNS(const QString& nsURI, const QString& localName, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4436 | { | - | ||||||||||||||||||||||||
| 4437 | QDomNodePrivate* n = m_attr->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 4438 | if (!n)
| 0 | ||||||||||||||||||||||||
| 4439 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4440 | - | |||||||||||||||||||||||||
| 4441 | return n->nodeValue(); never executed: return n->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4442 | } | - | ||||||||||||||||||||||||
| 4443 | - | |||||||||||||||||||||||||
| 4444 | void QDomElementPrivate::setAttribute(const QString& aname, const QString& newValue) | - | ||||||||||||||||||||||||
| 4445 | { | - | ||||||||||||||||||||||||
| 4446 | QDomNodePrivate* n = m_attr->namedItem(aname); | - | ||||||||||||||||||||||||
| 4447 | if (!n) {
| 1-865 | ||||||||||||||||||||||||
| 4448 | n = new QDomAttrPrivate(ownerDocument(), this, aname); | - | ||||||||||||||||||||||||
| 4449 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4450 | - | |||||||||||||||||||||||||
| 4451 | // Referencing is done by the map, so we set the reference counter back | - | ||||||||||||||||||||||||
| 4452 | // to 0 here. This is ok since we created the QDomAttrPrivate. | - | ||||||||||||||||||||||||
| 4453 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 4454 | m_attr->setNamedItem(n); | - | ||||||||||||||||||||||||
| 4455 | } else { executed 865 times by 3 tests: end of blockExecuted by:
| 865 | ||||||||||||||||||||||||
| 4456 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4457 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 4458 | } | - | ||||||||||||||||||||||||
| 4459 | - | |||||||||||||||||||||||||
| 4460 | void QDomElementPrivate::setAttributeNS(const QString& nsURI, const QString& qName, const QString& newValue) | - | ||||||||||||||||||||||||
| 4461 | { | - | ||||||||||||||||||||||||
| 4462 | QString prefix, localName; | - | ||||||||||||||||||||||||
| 4463 | qt_split_namespace(prefix, localName, qName, true); | - | ||||||||||||||||||||||||
| 4464 | QDomNodePrivate* n = m_attr->namedItemNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 4465 | if (!n) {
| 0-2 | ||||||||||||||||||||||||
| 4466 | n = new QDomAttrPrivate(ownerDocument(), this, nsURI, qName); | - | ||||||||||||||||||||||||
| 4467 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4468 | - | |||||||||||||||||||||||||
| 4469 | // Referencing is done by the map, so we set the reference counter back | - | ||||||||||||||||||||||||
| 4470 | // to 0 here. This is ok since we created the QDomAttrPrivate. | - | ||||||||||||||||||||||||
| 4471 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 4472 | m_attr->setNamedItem(n); | - | ||||||||||||||||||||||||
| 4473 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4474 | n->setNodeValue(newValue); | - | ||||||||||||||||||||||||
| 4475 | n->prefix = prefix; | - | ||||||||||||||||||||||||
| 4476 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4477 | } | - | ||||||||||||||||||||||||
| 4478 | - | |||||||||||||||||||||||||
| 4479 | void QDomElementPrivate::removeAttribute(const QString& aname) | - | ||||||||||||||||||||||||
| 4480 | { | - | ||||||||||||||||||||||||
| 4481 | QDomNodePrivate* p = m_attr->removeNamedItem(aname); | - | ||||||||||||||||||||||||
| 4482 | if (p && p->ref.load() == 0)
| 0 | ||||||||||||||||||||||||
| 4483 | delete p; never executed: delete p; | 0 | ||||||||||||||||||||||||
| 4484 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4485 | - | |||||||||||||||||||||||||
| 4486 | QDomAttrPrivate* QDomElementPrivate::attributeNode(const QString& aname) | - | ||||||||||||||||||||||||
| 4487 | { | - | ||||||||||||||||||||||||
| 4488 | return (QDomAttrPrivate*)m_attr->namedItem(aname); never executed: return (QDomAttrPrivate*)m_attr->namedItem(aname); | 0 | ||||||||||||||||||||||||
| 4489 | } | - | ||||||||||||||||||||||||
| 4490 | - | |||||||||||||||||||||||||
| 4491 | QDomAttrPrivate* QDomElementPrivate::attributeNodeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 4492 | { | - | ||||||||||||||||||||||||
| 4493 | return (QDomAttrPrivate*)m_attr->namedItemNS(nsURI, localName); never executed: return (QDomAttrPrivate*)m_attr->namedItemNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 4494 | } | - | ||||||||||||||||||||||||
| 4495 | - | |||||||||||||||||||||||||
| 4496 | QDomAttrPrivate* QDomElementPrivate::setAttributeNode(QDomAttrPrivate* newAttr) | - | ||||||||||||||||||||||||
| 4497 | { | - | ||||||||||||||||||||||||
| 4498 | QDomNodePrivate* n = m_attr->namedItem(newAttr->nodeName()); | - | ||||||||||||||||||||||||
| 4499 | - | |||||||||||||||||||||||||
| 4500 | // Referencing is done by the maps | - | ||||||||||||||||||||||||
| 4501 | m_attr->setNamedItem(newAttr); | - | ||||||||||||||||||||||||
| 4502 | - | |||||||||||||||||||||||||
| 4503 | newAttr->setParent(this); | - | ||||||||||||||||||||||||
| 4504 | - | |||||||||||||||||||||||||
| 4505 | return (QDomAttrPrivate*)n; never executed: return (QDomAttrPrivate*)n; | 0 | ||||||||||||||||||||||||
| 4506 | } | - | ||||||||||||||||||||||||
| 4507 | - | |||||||||||||||||||||||||
| 4508 | QDomAttrPrivate* QDomElementPrivate::setAttributeNodeNS(QDomAttrPrivate* newAttr) | - | ||||||||||||||||||||||||
| 4509 | { | - | ||||||||||||||||||||||||
| 4510 | QDomNodePrivate* n = 0; | - | ||||||||||||||||||||||||
| 4511 | if (!newAttr->prefix.isNull())
| 0 | ||||||||||||||||||||||||
| 4512 | n = m_attr->namedItemNS(newAttr->namespaceURI, newAttr->name); never executed: n = m_attr->namedItemNS(newAttr->namespaceURI, newAttr->name); | 0 | ||||||||||||||||||||||||
| 4513 | - | |||||||||||||||||||||||||
| 4514 | // Referencing is done by the maps | - | ||||||||||||||||||||||||
| 4515 | m_attr->setNamedItem(newAttr); | - | ||||||||||||||||||||||||
| 4516 | - | |||||||||||||||||||||||||
| 4517 | return (QDomAttrPrivate*)n; never executed: return (QDomAttrPrivate*)n; | 0 | ||||||||||||||||||||||||
| 4518 | } | - | ||||||||||||||||||||||||
| 4519 | - | |||||||||||||||||||||||||
| 4520 | QDomAttrPrivate* QDomElementPrivate::removeAttributeNode(QDomAttrPrivate* oldAttr) | - | ||||||||||||||||||||||||
| 4521 | { | - | ||||||||||||||||||||||||
| 4522 | return (QDomAttrPrivate*)m_attr->removeNamedItem(oldAttr->nodeName()); never executed: return (QDomAttrPrivate*)m_attr->removeNamedItem(oldAttr->nodeName()); | 0 | ||||||||||||||||||||||||
| 4523 | } | - | ||||||||||||||||||||||||
| 4524 | - | |||||||||||||||||||||||||
| 4525 | bool QDomElementPrivate::hasAttribute(const QString& aname) | - | ||||||||||||||||||||||||
| 4526 | { | - | ||||||||||||||||||||||||
| 4527 | return m_attr->contains(aname); never executed: return m_attr->contains(aname); | 0 | ||||||||||||||||||||||||
| 4528 | } | - | ||||||||||||||||||||||||
| 4529 | - | |||||||||||||||||||||||||
| 4530 | bool QDomElementPrivate::hasAttributeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 4531 | { | - | ||||||||||||||||||||||||
| 4532 | return m_attr->containsNS(nsURI, localName); never executed: return m_attr->containsNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 4533 | } | - | ||||||||||||||||||||||||
| 4534 | - | |||||||||||||||||||||||||
| 4535 | QString QDomElementPrivate::text() | - | ||||||||||||||||||||||||
| 4536 | { | - | ||||||||||||||||||||||||
| 4537 | QString t(QLatin1String("")); | - | ||||||||||||||||||||||||
| 4538 | - | |||||||||||||||||||||||||
| 4539 | QDomNodePrivate* p = first; | - | ||||||||||||||||||||||||
| 4540 | while (p) {
| 0 | ||||||||||||||||||||||||
| 4541 | if (p->isText() || p->isCDATASection())
| 0 | ||||||||||||||||||||||||
| 4542 | t += p->nodeValue(); never executed: t += p->nodeValue(); | 0 | ||||||||||||||||||||||||
| 4543 | else if (p->isElement())
| 0 | ||||||||||||||||||||||||
| 4544 | t += ((QDomElementPrivate*)p)->text(); never executed: t += ((QDomElementPrivate*)p)->text(); | 0 | ||||||||||||||||||||||||
| 4545 | p = p->next; | - | ||||||||||||||||||||||||
| 4546 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4547 | - | |||||||||||||||||||||||||
| 4548 | return t; never executed: return t; | 0 | ||||||||||||||||||||||||
| 4549 | } | - | ||||||||||||||||||||||||
| 4550 | - | |||||||||||||||||||||||||
| 4551 | void QDomElementPrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 4552 | { | - | ||||||||||||||||||||||||
| 4553 | if (!(prev && prev->isText()))
| 0-180 | ||||||||||||||||||||||||
| 4554 | 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 | ||||||||||||||||||||||||
| 4555 | - | |||||||||||||||||||||||||
| 4556 | QString qName(name); | - | ||||||||||||||||||||||||
| 4557 | QString nsDecl(QLatin1String("")); | - | ||||||||||||||||||||||||
| 4558 | if (!namespaceURI.isNull()) {
| 0-246 | ||||||||||||||||||||||||
| 4559 | /** ### | - | ||||||||||||||||||||||||
| 4560 | * | - | ||||||||||||||||||||||||
| 4561 | * If we still have QDom, optimize this so that we only declare namespaces that are not | - | ||||||||||||||||||||||||
| 4562 | * yet declared. We loose default namespace mappings, so maybe we should rather store | - | ||||||||||||||||||||||||
| 4563 | * the information that we get from startPrefixMapping()/endPrefixMapping() and use them. | - | ||||||||||||||||||||||||
| 4564 | * Modifications becomes more complex then, however. | - | ||||||||||||||||||||||||
| 4565 | * | - | ||||||||||||||||||||||||
| 4566 | * We cannot do this in a patch release because it would require too invasive changes, and | - | ||||||||||||||||||||||||
| 4567 | * hence possibly behavioral changes. | - | ||||||||||||||||||||||||
| 4568 | */ | - | ||||||||||||||||||||||||
| 4569 | if (prefix.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 4570 | nsDecl = QLatin1String(" xmlns"); | - | ||||||||||||||||||||||||
| 4571 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4572 | qName = prefix + QLatin1Char(':') + name; | - | ||||||||||||||||||||||||
| 4573 | nsDecl = QLatin1String(" xmlns:") + prefix; | - | ||||||||||||||||||||||||
| 4574 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4575 | nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1Char('\"'); | - | ||||||||||||||||||||||||
| 4576 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4577 | s << '<' << qName << nsDecl; | - | ||||||||||||||||||||||||
| 4578 | - | |||||||||||||||||||||||||
| 4579 | QSet<QString> outputtedPrefixes; | - | ||||||||||||||||||||||||
| 4580 | - | |||||||||||||||||||||||||
| 4581 | /* Write out attributes. */ | - | ||||||||||||||||||||||||
| 4582 | if (!m_attr->map.isEmpty()) {
| 0-246 | ||||||||||||||||||||||||
| 4583 | QHash<QString, QDomNodePrivate *>::const_iterator it = m_attr->map.constBegin(); | - | ||||||||||||||||||||||||
| 4584 | for (; it != m_attr->map.constEnd(); ++it) {
| 246-394 | ||||||||||||||||||||||||
| 4585 | s << ' '; | - | ||||||||||||||||||||||||
| 4586 | if (it.value()->namespaceURI.isNull()) {
| 2-392 | ||||||||||||||||||||||||
| 4587 | s << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4588 | } else { executed 392 times by 1 test: end of blockExecuted by:
| 392 | ||||||||||||||||||||||||
| 4589 | s << it.value()->prefix << ':' << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4590 | /* This is a fix for 138243, as good as it gets. | - | ||||||||||||||||||||||||
| 4591 | * | - | ||||||||||||||||||||||||
| 4592 | * QDomElementPrivate::save() output a namespace declaration if | - | ||||||||||||||||||||||||
| 4593 | * the element is in a namespace, no matter what. This function do as well, meaning | - | ||||||||||||||||||||||||
| 4594 | * that we get two identical namespace declaration if we don't have the if- | - | ||||||||||||||||||||||||
| 4595 | * statement below. | - | ||||||||||||||||||||||||
| 4596 | * | - | ||||||||||||||||||||||||
| 4597 | * This doesn't work when the parent element has the same prefix as us but | - | ||||||||||||||||||||||||
| 4598 | * a different namespace. However, this can only occur by the user modifying the element, | - | ||||||||||||||||||||||||
| 4599 | * and we don't do fixups by that anyway, and hence it's the user responsibility to not | - | ||||||||||||||||||||||||
| 4600 | * arrive in those situations. */ | - | ||||||||||||||||||||||||
| 4601 | if((!it.value()->ownerNode ||
| 0-2 | ||||||||||||||||||||||||
| 4602 | it.value()->ownerNode->prefix != it.value()->prefix) &&
| 0-2 | ||||||||||||||||||||||||
| 4603 | !outputtedPrefixes.contains(it.value()->prefix)) {
| 0-2 | ||||||||||||||||||||||||
| 4604 | s << " xmlns:" << it.value()->prefix << "=\"" << encodeText(it.value()->namespaceURI, s, true, true) << '\"'; | - | ||||||||||||||||||||||||
| 4605 | outputtedPrefixes.insert(it.value()->prefix); | - | ||||||||||||||||||||||||
| 4606 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4607 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 4608 | } | - | ||||||||||||||||||||||||
| 4609 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4610 | - | |||||||||||||||||||||||||
| 4611 | if (last) {
| 94-152 | ||||||||||||||||||||||||
| 4612 | // has child nodes | - | ||||||||||||||||||||||||
| 4613 | if (first->isText())
| 0-94 | ||||||||||||||||||||||||
| 4614 | s << '>'; never executed: s << '>'; | 0 | ||||||||||||||||||||||||
| 4615 | else { | - | ||||||||||||||||||||||||
| 4616 | s << '>'; | - | ||||||||||||||||||||||||
| 4617 | - | |||||||||||||||||||||||||
| 4618 | /* -1 disables new lines. */ | - | ||||||||||||||||||||||||
| 4619 | if (indent != -1)
| 0-94 | ||||||||||||||||||||||||
| 4620 | s << endl; executed 94 times by 1 test: s << endl;Executed by:
| 94 | ||||||||||||||||||||||||
| 4621 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 4622 | QDomNodePrivate::save(s, depth + 1, indent); if (!last->isText())
| 0-94 | ||||||||||||||||||||||||
| 4623 | 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 | ||||||||||||||||||||||||
| 4624 | - | |||||||||||||||||||||||||
| 4625 | s << "</" << qName << '>'; | - | ||||||||||||||||||||||||
| 4626 | } else { executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||||||||
| 4627 | s << "/>"; | - | ||||||||||||||||||||||||
| 4628 | } executed 152 times by 2 tests: end of blockExecuted by:
| 152 | ||||||||||||||||||||||||
| 4629 | if (!(next && next->isText())) {
| 0-180 | ||||||||||||||||||||||||
| 4630 | /* -1 disables new lines. */ | - | ||||||||||||||||||||||||
| 4631 | if (indent != -1)
| 0-246 | ||||||||||||||||||||||||
| 4632 | s << endl; executed 246 times by 2 tests: s << endl;Executed by:
| 246 | ||||||||||||||||||||||||
| 4633 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4634 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||||||||
| 4635 | - | |||||||||||||||||||||||||
| 4636 | /************************************************************** | - | ||||||||||||||||||||||||
| 4637 | * | - | ||||||||||||||||||||||||
| 4638 | * QDomElement | - | ||||||||||||||||||||||||
| 4639 | * | - | ||||||||||||||||||||||||
| 4640 | **************************************************************/ | - | ||||||||||||||||||||||||
| 4641 | - | |||||||||||||||||||||||||
| 4642 | #define IMPL ((QDomElementPrivate*)impl) | - | ||||||||||||||||||||||||
| 4643 | - | |||||||||||||||||||||||||
| 4644 | /*! | - | ||||||||||||||||||||||||
| 4645 | \class QDomElement | - | ||||||||||||||||||||||||
| 4646 | \reentrant | - | ||||||||||||||||||||||||
| 4647 | \brief The QDomElement class represents one element in the DOM tree. | - | ||||||||||||||||||||||||
| 4648 | - | |||||||||||||||||||||||||
| 4649 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 4650 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 4651 | - | |||||||||||||||||||||||||
| 4652 | Elements have a tagName() and zero or more attributes associated | - | ||||||||||||||||||||||||
| 4653 | with them. The tag name can be changed with setTagName(). | - | ||||||||||||||||||||||||
| 4654 | - | |||||||||||||||||||||||||
| 4655 | Element attributes are represented by QDomAttr objects that can | - | ||||||||||||||||||||||||
| 4656 | be queried using the attribute() and attributeNode() functions. | - | ||||||||||||||||||||||||
| 4657 | You can set attributes with the setAttribute() and | - | ||||||||||||||||||||||||
| 4658 | setAttributeNode() functions. Attributes can be removed with | - | ||||||||||||||||||||||||
| 4659 | removeAttribute(). There are namespace-aware equivalents to these | - | ||||||||||||||||||||||||
| 4660 | functions, i.e. setAttributeNS(), setAttributeNodeNS() and | - | ||||||||||||||||||||||||
| 4661 | removeAttributeNS(). | - | ||||||||||||||||||||||||
| 4662 | - | |||||||||||||||||||||||||
| 4663 | If you want to access the text of a node use text(), e.g. | - | ||||||||||||||||||||||||
| 4664 | - | |||||||||||||||||||||||||
| 4665 | \snippet code/src_xml_dom_qdom.cpp 9 | - | ||||||||||||||||||||||||
| 4666 | - | |||||||||||||||||||||||||
| 4667 | The text() function operates recursively to find the text (since | - | ||||||||||||||||||||||||
| 4668 | not all elements contain text). If you want to find all the text | - | ||||||||||||||||||||||||
| 4669 | in all of a node's children, iterate over the children looking for | - | ||||||||||||||||||||||||
| 4670 | QDomText nodes, e.g. | - | ||||||||||||||||||||||||
| 4671 | - | |||||||||||||||||||||||||
| 4672 | \snippet code/src_xml_dom_qdom.cpp 10 | - | ||||||||||||||||||||||||
| 4673 | - | |||||||||||||||||||||||||
| 4674 | Note that we attempt to convert each node to a text node and use | - | ||||||||||||||||||||||||
| 4675 | text() rather than using firstChild().toText().data() or | - | ||||||||||||||||||||||||
| 4676 | n.toText().data() directly on the node, because the node may not | - | ||||||||||||||||||||||||
| 4677 | be a text element. | - | ||||||||||||||||||||||||
| 4678 | - | |||||||||||||||||||||||||
| 4679 | You can get a list of all the decendents of an element which have | - | ||||||||||||||||||||||||
| 4680 | a specified tag name with elementsByTagName() or | - | ||||||||||||||||||||||||
| 4681 | elementsByTagNameNS(). | - | ||||||||||||||||||||||||
| 4682 | - | |||||||||||||||||||||||||
| 4683 | To browse the elements of a dom document use firstChildElement(), lastChildElement(), | - | ||||||||||||||||||||||||
| 4684 | nextSiblingElement() and previousSiblingElement(). For example, to iterate over all | - | ||||||||||||||||||||||||
| 4685 | child elements called "entry" in a root element called "database", you can use: | - | ||||||||||||||||||||||||
| 4686 | - | |||||||||||||||||||||||||
| 4687 | \snippet code/src_xml_dom_qdom.cpp 11 | - | ||||||||||||||||||||||||
| 4688 | - | |||||||||||||||||||||||||
| 4689 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 4690 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 4691 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 4692 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 4693 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 4694 | */ | - | ||||||||||||||||||||||||
| 4695 | - | |||||||||||||||||||||||||
| 4696 | /*! | - | ||||||||||||||||||||||||
| 4697 | Constructs an empty element. Use the QDomDocument::createElement() | - | ||||||||||||||||||||||||
| 4698 | function to construct elements with content. | - | ||||||||||||||||||||||||
| 4699 | */ | - | ||||||||||||||||||||||||
| 4700 | QDomElement::QDomElement() | - | ||||||||||||||||||||||||
| 4701 | : QDomNode() | - | ||||||||||||||||||||||||
| 4702 | { | - | ||||||||||||||||||||||||
| 4703 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 4704 | - | |||||||||||||||||||||||||
| 4705 | /*! | - | ||||||||||||||||||||||||
| 4706 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 4707 | - | |||||||||||||||||||||||||
| 4708 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4709 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4710 | cloneNode(). | - | ||||||||||||||||||||||||
| 4711 | */ | - | ||||||||||||||||||||||||
| 4712 | QDomElement::QDomElement(const QDomElement& x) | - | ||||||||||||||||||||||||
| 4713 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 4714 | { | - | ||||||||||||||||||||||||
| 4715 | } executed 96 times by 1 test: end of blockExecuted by:
| 96 | ||||||||||||||||||||||||
| 4716 | - | |||||||||||||||||||||||||
| 4717 | QDomElement::QDomElement(QDomElementPrivate* n) | - | ||||||||||||||||||||||||
| 4718 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 4719 | { | - | ||||||||||||||||||||||||
| 4720 | } executed 256 times by 1 test: end of blockExecuted by:
| 256 | ||||||||||||||||||||||||
| 4721 | - | |||||||||||||||||||||||||
| 4722 | /*! | - | ||||||||||||||||||||||||
| 4723 | Assigns \a x to this DOM element. | - | ||||||||||||||||||||||||
| 4724 | - | |||||||||||||||||||||||||
| 4725 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 4726 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 4727 | cloneNode(). | - | ||||||||||||||||||||||||
| 4728 | */ | - | ||||||||||||||||||||||||
| 4729 | QDomElement& QDomElement::operator= (const QDomElement& x) | - | ||||||||||||||||||||||||
| 4730 | { | - | ||||||||||||||||||||||||
| 4731 | return (QDomElement&) QDomNode::operator=(x); executed 71 times by 1 test: return (QDomElement&) QDomNode::operator=(x);Executed by:
| 71 | ||||||||||||||||||||||||
| 4732 | } | - | ||||||||||||||||||||||||
| 4733 | - | |||||||||||||||||||||||||
| 4734 | /*! | - | ||||||||||||||||||||||||
| 4735 | \fn QDomNode::NodeType QDomElement::nodeType() const | - | ||||||||||||||||||||||||
| 4736 | - | |||||||||||||||||||||||||
| 4737 | Returns \c ElementNode. | - | ||||||||||||||||||||||||
| 4738 | */ | - | ||||||||||||||||||||||||
| 4739 | - | |||||||||||||||||||||||||
| 4740 | /*! | - | ||||||||||||||||||||||||
| 4741 | Sets this element's tag name to \a name. | - | ||||||||||||||||||||||||
| 4742 | - | |||||||||||||||||||||||||
| 4743 | \sa tagName() | - | ||||||||||||||||||||||||
| 4744 | */ | - | ||||||||||||||||||||||||
| 4745 | void QDomElement::setTagName(const QString& name) | - | ||||||||||||||||||||||||
| 4746 | { | - | ||||||||||||||||||||||||
| 4747 | if (impl)
| 0 | ||||||||||||||||||||||||
| 4748 | impl->name = name; never executed: impl->name = name; | 0 | ||||||||||||||||||||||||
| 4749 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4750 | - | |||||||||||||||||||||||||
| 4751 | /*! | - | ||||||||||||||||||||||||
| 4752 | Returns the tag name of this element. For an XML element like this: | - | ||||||||||||||||||||||||
| 4753 | - | |||||||||||||||||||||||||
| 4754 | \snippet code/src_xml_dom_qdom.cpp 12 | - | ||||||||||||||||||||||||
| 4755 | - | |||||||||||||||||||||||||
| 4756 | the tagname would return "img". | - | ||||||||||||||||||||||||
| 4757 | - | |||||||||||||||||||||||||
| 4758 | \sa setTagName() | - | ||||||||||||||||||||||||
| 4759 | */ | - | ||||||||||||||||||||||||
| 4760 | QString QDomElement::tagName() const | - | ||||||||||||||||||||||||
| 4761 | { | - | ||||||||||||||||||||||||
| 4762 | if (!impl)
| 0-197 | ||||||||||||||||||||||||
| 4763 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 4764 | return impl->nodeName(); executed 197 times by 1 test: return impl->nodeName();Executed by:
| 197 | ||||||||||||||||||||||||
| 4765 | } | - | ||||||||||||||||||||||||
| 4766 | - | |||||||||||||||||||||||||
| 4767 | - | |||||||||||||||||||||||||
| 4768 | /*! | - | ||||||||||||||||||||||||
| 4769 | Returns a QDomNamedNodeMap containing all this element's attributes. | - | ||||||||||||||||||||||||
| 4770 | - | |||||||||||||||||||||||||
| 4771 | \sa attribute(), setAttribute(), attributeNode(), setAttributeNode() | - | ||||||||||||||||||||||||
| 4772 | */ | - | ||||||||||||||||||||||||
| 4773 | QDomNamedNodeMap QDomElement::attributes() const | - | ||||||||||||||||||||||||
| 4774 | { | - | ||||||||||||||||||||||||
| 4775 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4776 | return QDomNamedNodeMap(); never executed: return QDomNamedNodeMap(); | 0 | ||||||||||||||||||||||||
| 4777 | return QDomNamedNodeMap(IMPL->attributes()); never executed: return QDomNamedNodeMap(((QDomElementPrivate*)impl)->attributes()); | 0 | ||||||||||||||||||||||||
| 4778 | } | - | ||||||||||||||||||||||||
| 4779 | - | |||||||||||||||||||||||||
| 4780 | /*! | - | ||||||||||||||||||||||||
| 4781 | Returns the attribute called \a name. If the attribute does not | - | ||||||||||||||||||||||||
| 4782 | exist \a defValue is returned. | - | ||||||||||||||||||||||||
| 4783 | - | |||||||||||||||||||||||||
| 4784 | \sa setAttribute(), attributeNode(), setAttributeNode(), attributeNS() | - | ||||||||||||||||||||||||
| 4785 | */ | - | ||||||||||||||||||||||||
| 4786 | QString QDomElement::attribute(const QString& name, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4787 | { | - | ||||||||||||||||||||||||
| 4788 | if (!impl)
| 0-34 | ||||||||||||||||||||||||
| 4789 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4790 | return IMPL->attribute(name, defValue); executed 34 times by 1 test: return ((QDomElementPrivate*)impl)->attribute(name, defValue);Executed by:
| 34 | ||||||||||||||||||||||||
| 4791 | } | - | ||||||||||||||||||||||||
| 4792 | - | |||||||||||||||||||||||||
| 4793 | /*! | - | ||||||||||||||||||||||||
| 4794 | Adds an attribute called \a name with value \a value. If an | - | ||||||||||||||||||||||||
| 4795 | attribute with the same name exists, its value is replaced by \a | - | ||||||||||||||||||||||||
| 4796 | value. | - | ||||||||||||||||||||||||
| 4797 | - | |||||||||||||||||||||||||
| 4798 | \sa attribute(), setAttributeNode(), setAttributeNS() | - | ||||||||||||||||||||||||
| 4799 | */ | - | ||||||||||||||||||||||||
| 4800 | void QDomElement::setAttribute(const QString& name, const QString& value) | - | ||||||||||||||||||||||||
| 4801 | { | - | ||||||||||||||||||||||||
| 4802 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4803 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4804 | IMPL->setAttribute(name, value); | - | ||||||||||||||||||||||||
| 4805 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4806 | - | |||||||||||||||||||||||||
| 4807 | /*! | - | ||||||||||||||||||||||||
| 4808 | \fn void QDomElement::setAttribute(const QString& name, int value) | - | ||||||||||||||||||||||||
| 4809 | - | |||||||||||||||||||||||||
| 4810 | \overload | - | ||||||||||||||||||||||||
| 4811 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4812 | */ | - | ||||||||||||||||||||||||
| 4813 | - | |||||||||||||||||||||||||
| 4814 | /*! | - | ||||||||||||||||||||||||
| 4815 | \fn void QDomElement::setAttribute(const QString& name, uint value) | - | ||||||||||||||||||||||||
| 4816 | - | |||||||||||||||||||||||||
| 4817 | \overload | - | ||||||||||||||||||||||||
| 4818 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4819 | */ | - | ||||||||||||||||||||||||
| 4820 | - | |||||||||||||||||||||||||
| 4821 | /*! | - | ||||||||||||||||||||||||
| 4822 | \overload | - | ||||||||||||||||||||||||
| 4823 | - | |||||||||||||||||||||||||
| 4824 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4825 | */ | - | ||||||||||||||||||||||||
| 4826 | void QDomElement::setAttribute(const QString& name, qlonglong value) | - | ||||||||||||||||||||||||
| 4827 | { | - | ||||||||||||||||||||||||
| 4828 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4829 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4830 | QString x; | - | ||||||||||||||||||||||||
| 4831 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4832 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4833 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4834 | - | |||||||||||||||||||||||||
| 4835 | /*! | - | ||||||||||||||||||||||||
| 4836 | \overload | - | ||||||||||||||||||||||||
| 4837 | - | |||||||||||||||||||||||||
| 4838 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4839 | */ | - | ||||||||||||||||||||||||
| 4840 | void QDomElement::setAttribute(const QString& name, qulonglong value) | - | ||||||||||||||||||||||||
| 4841 | { | - | ||||||||||||||||||||||||
| 4842 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4843 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4844 | QString x; | - | ||||||||||||||||||||||||
| 4845 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4846 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4848 | - | |||||||||||||||||||||||||
| 4849 | /*! | - | ||||||||||||||||||||||||
| 4850 | \overload | - | ||||||||||||||||||||||||
| 4851 | - | |||||||||||||||||||||||||
| 4852 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4853 | */ | - | ||||||||||||||||||||||||
| 4854 | void QDomElement::setAttribute(const QString& name, float value) | - | ||||||||||||||||||||||||
| 4855 | { | - | ||||||||||||||||||||||||
| 4856 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4857 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4858 | QString x; | - | ||||||||||||||||||||||||
| 4859 | x.setNum(value); | - | ||||||||||||||||||||||||
| 4860 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4862 | - | |||||||||||||||||||||||||
| 4863 | /*! | - | ||||||||||||||||||||||||
| 4864 | \overload | - | ||||||||||||||||||||||||
| 4865 | - | |||||||||||||||||||||||||
| 4866 | The number is formatted according to the current locale. | - | ||||||||||||||||||||||||
| 4867 | */ | - | ||||||||||||||||||||||||
| 4868 | void QDomElement::setAttribute(const QString& name, double value) | - | ||||||||||||||||||||||||
| 4869 | { | - | ||||||||||||||||||||||||
| 4870 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4871 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4872 | QString x; | - | ||||||||||||||||||||||||
| 4873 | char buf[256]; | - | ||||||||||||||||||||||||
| 4874 | int count = qsnprintf(buf, sizeof(buf), "%.16g", value); | - | ||||||||||||||||||||||||
| 4875 | if (count > 0)
| 0 | ||||||||||||||||||||||||
| 4876 | x = QString::fromLatin1(buf, count); never executed: x = QString::fromLatin1(buf, count); | 0 | ||||||||||||||||||||||||
| 4877 | else | - | ||||||||||||||||||||||||
| 4878 | x.setNum(value); // Fallback never executed: x.setNum(value); | 0 | ||||||||||||||||||||||||
| 4879 | IMPL->setAttribute(name, x); | - | ||||||||||||||||||||||||
| 4880 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4881 | - | |||||||||||||||||||||||||
| 4882 | /*! | - | ||||||||||||||||||||||||
| 4883 | Removes the attribute called name \a name from this element. | - | ||||||||||||||||||||||||
| 4884 | - | |||||||||||||||||||||||||
| 4885 | \sa setAttribute(), attribute(), removeAttributeNS() | - | ||||||||||||||||||||||||
| 4886 | */ | - | ||||||||||||||||||||||||
| 4887 | void QDomElement::removeAttribute(const QString& name) | - | ||||||||||||||||||||||||
| 4888 | { | - | ||||||||||||||||||||||||
| 4889 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4890 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4891 | IMPL->removeAttribute(name); | - | ||||||||||||||||||||||||
| 4892 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4893 | - | |||||||||||||||||||||||||
| 4894 | /*! | - | ||||||||||||||||||||||||
| 4895 | Returns the QDomAttr object that corresponds to the attribute | - | ||||||||||||||||||||||||
| 4896 | called \a name. If no such attribute exists a | - | ||||||||||||||||||||||||
| 4897 | \l{QDomNode::isNull()}{null attribute} is returned. | - | ||||||||||||||||||||||||
| 4898 | - | |||||||||||||||||||||||||
| 4899 | \sa setAttributeNode(), attribute(), setAttribute(), attributeNodeNS() | - | ||||||||||||||||||||||||
| 4900 | */ | - | ||||||||||||||||||||||||
| 4901 | QDomAttr QDomElement::attributeNode(const QString& name) | - | ||||||||||||||||||||||||
| 4902 | { | - | ||||||||||||||||||||||||
| 4903 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4904 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4905 | return QDomAttr(IMPL->attributeNode(name)); never executed: return QDomAttr(((QDomElementPrivate*)impl)->attributeNode(name)); | 0 | ||||||||||||||||||||||||
| 4906 | } | - | ||||||||||||||||||||||||
| 4907 | - | |||||||||||||||||||||||||
| 4908 | /*! | - | ||||||||||||||||||||||||
| 4909 | Adds the attribute \a newAttr to this element. | - | ||||||||||||||||||||||||
| 4910 | - | |||||||||||||||||||||||||
| 4911 | If the element has another attribute that has the same name as \a | - | ||||||||||||||||||||||||
| 4912 | newAttr, this function replaces that attribute and returns it; | - | ||||||||||||||||||||||||
| 4913 | otherwise the function returns a | - | ||||||||||||||||||||||||
| 4914 | \l{QDomNode::isNull()}{null attribute}. | - | ||||||||||||||||||||||||
| 4915 | - | |||||||||||||||||||||||||
| 4916 | \sa attributeNode(), setAttribute(), setAttributeNodeNS() | - | ||||||||||||||||||||||||
| 4917 | */ | - | ||||||||||||||||||||||||
| 4918 | QDomAttr QDomElement::setAttributeNode(const QDomAttr& newAttr) | - | ||||||||||||||||||||||||
| 4919 | { | - | ||||||||||||||||||||||||
| 4920 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4921 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4922 | return QDomAttr(IMPL->setAttributeNode(((QDomAttrPrivate*)newAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->setAttributeNode(((QDomAttrPrivate*)newAttr.impl))); | 0 | ||||||||||||||||||||||||
| 4923 | } | - | ||||||||||||||||||||||||
| 4924 | - | |||||||||||||||||||||||||
| 4925 | /*! | - | ||||||||||||||||||||||||
| 4926 | Removes the attribute \a oldAttr from the element and returns it. | - | ||||||||||||||||||||||||
| 4927 | - | |||||||||||||||||||||||||
| 4928 | \sa attributeNode(), setAttributeNode() | - | ||||||||||||||||||||||||
| 4929 | */ | - | ||||||||||||||||||||||||
| 4930 | QDomAttr QDomElement::removeAttributeNode(const QDomAttr& oldAttr) | - | ||||||||||||||||||||||||
| 4931 | { | - | ||||||||||||||||||||||||
| 4932 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4933 | return QDomAttr(); // ### should this return oldAttr? never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 4934 | return QDomAttr(IMPL->removeAttributeNode(((QDomAttrPrivate*)oldAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->removeAttributeNode(((QDomAttrPrivate*)oldAttr.impl))); | 0 | ||||||||||||||||||||||||
| 4935 | } | - | ||||||||||||||||||||||||
| 4936 | - | |||||||||||||||||||||||||
| 4937 | /*! | - | ||||||||||||||||||||||||
| 4938 | Returns a QDomNodeList containing all descendants of this element | - | ||||||||||||||||||||||||
| 4939 | named \a tagname encountered during a preorder traversal of the | - | ||||||||||||||||||||||||
| 4940 | element subtree with this element as its root. The order of the | - | ||||||||||||||||||||||||
| 4941 | elements in the returned list is the order they are encountered | - | ||||||||||||||||||||||||
| 4942 | during the preorder traversal. | - | ||||||||||||||||||||||||
| 4943 | - | |||||||||||||||||||||||||
| 4944 | \sa elementsByTagNameNS(), QDomDocument::elementsByTagName() | - | ||||||||||||||||||||||||
| 4945 | */ | - | ||||||||||||||||||||||||
| 4946 | QDomNodeList QDomElement::elementsByTagName(const QString& tagname) const | - | ||||||||||||||||||||||||
| 4947 | { | - | ||||||||||||||||||||||||
| 4948 | return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); | 0 | ||||||||||||||||||||||||
| 4949 | } | - | ||||||||||||||||||||||||
| 4950 | - | |||||||||||||||||||||||||
| 4951 | /*! | - | ||||||||||||||||||||||||
| 4952 | Returns \c true if this element has an attribute called \a name; | - | ||||||||||||||||||||||||
| 4953 | otherwise returns \c false. | - | ||||||||||||||||||||||||
| 4954 | - | |||||||||||||||||||||||||
| 4955 | \b{Note:} This function does not take the presence of namespaces | - | ||||||||||||||||||||||||
| 4956 | into account. As a result, the specified name will be tested | - | ||||||||||||||||||||||||
| 4957 | against fully-qualified attribute names that include any namespace | - | ||||||||||||||||||||||||
| 4958 | prefixes that may be present. | - | ||||||||||||||||||||||||
| 4959 | - | |||||||||||||||||||||||||
| 4960 | Use hasAttributeNS() to explicitly test for attributes with specific | - | ||||||||||||||||||||||||
| 4961 | namespaces and names. | - | ||||||||||||||||||||||||
| 4962 | */ | - | ||||||||||||||||||||||||
| 4963 | bool QDomElement::hasAttribute(const QString& name) const | - | ||||||||||||||||||||||||
| 4964 | { | - | ||||||||||||||||||||||||
| 4965 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4966 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 4967 | return IMPL->hasAttribute(name); never executed: return ((QDomElementPrivate*)impl)->hasAttribute(name); | 0 | ||||||||||||||||||||||||
| 4968 | } | - | ||||||||||||||||||||||||
| 4969 | - | |||||||||||||||||||||||||
| 4970 | /*! | - | ||||||||||||||||||||||||
| 4971 | Returns the attribute with the local name \a localName and the | - | ||||||||||||||||||||||||
| 4972 | namespace URI \a nsURI. If the attribute does not exist \a | - | ||||||||||||||||||||||||
| 4973 | defValue is returned. | - | ||||||||||||||||||||||||
| 4974 | - | |||||||||||||||||||||||||
| 4975 | \sa setAttributeNS(), attributeNodeNS(), setAttributeNodeNS(), attribute() | - | ||||||||||||||||||||||||
| 4976 | */ | - | ||||||||||||||||||||||||
| 4977 | QString QDomElement::attributeNS(const QString nsURI, const QString& localName, const QString& defValue) const | - | ||||||||||||||||||||||||
| 4978 | { | - | ||||||||||||||||||||||||
| 4979 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4980 | return defValue; never executed: return defValue; | 0 | ||||||||||||||||||||||||
| 4981 | return IMPL->attributeNS(nsURI, localName, defValue); never executed: return ((QDomElementPrivate*)impl)->attributeNS(nsURI, localName, defValue); | 0 | ||||||||||||||||||||||||
| 4982 | } | - | ||||||||||||||||||||||||
| 4983 | - | |||||||||||||||||||||||||
| 4984 | /*! | - | ||||||||||||||||||||||||
| 4985 | Adds an attribute with the qualified name \a qName and the | - | ||||||||||||||||||||||||
| 4986 | namespace URI \a nsURI with the value \a value. If an attribute | - | ||||||||||||||||||||||||
| 4987 | with the same local name and namespace URI exists, its prefix is | - | ||||||||||||||||||||||||
| 4988 | replaced by the prefix of \a qName and its value is repaced by \a | - | ||||||||||||||||||||||||
| 4989 | value. | - | ||||||||||||||||||||||||
| 4990 | - | |||||||||||||||||||||||||
| 4991 | Although \a qName is the qualified name, the local name is used to | - | ||||||||||||||||||||||||
| 4992 | decide if an existing attribute's value should be replaced. | - | ||||||||||||||||||||||||
| 4993 | - | |||||||||||||||||||||||||
| 4994 | \sa attributeNS(), setAttributeNodeNS(), setAttribute() | - | ||||||||||||||||||||||||
| 4995 | */ | - | ||||||||||||||||||||||||
| 4996 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, const QString& value) | - | ||||||||||||||||||||||||
| 4997 | { | - | ||||||||||||||||||||||||
| 4998 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 4999 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5000 | IMPL->setAttributeNS(nsURI, qName, value); | - | ||||||||||||||||||||||||
| 5001 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5002 | - | |||||||||||||||||||||||||
| 5003 | /*! | - | ||||||||||||||||||||||||
| 5004 | \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, int value) | - | ||||||||||||||||||||||||
| 5005 | - | |||||||||||||||||||||||||
| 5006 | \overload | - | ||||||||||||||||||||||||
| 5007 | */ | - | ||||||||||||||||||||||||
| 5008 | - | |||||||||||||||||||||||||
| 5009 | /*! | - | ||||||||||||||||||||||||
| 5010 | \fn void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, uint value) | - | ||||||||||||||||||||||||
| 5011 | - | |||||||||||||||||||||||||
| 5012 | \overload | - | ||||||||||||||||||||||||
| 5013 | */ | - | ||||||||||||||||||||||||
| 5014 | - | |||||||||||||||||||||||||
| 5015 | /*! | - | ||||||||||||||||||||||||
| 5016 | \overload | - | ||||||||||||||||||||||||
| 5017 | */ | - | ||||||||||||||||||||||||
| 5018 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qlonglong value) | - | ||||||||||||||||||||||||
| 5019 | { | - | ||||||||||||||||||||||||
| 5020 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5021 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5022 | QString x; | - | ||||||||||||||||||||||||
| 5023 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5024 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5025 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5026 | - | |||||||||||||||||||||||||
| 5027 | /*! | - | ||||||||||||||||||||||||
| 5028 | \overload | - | ||||||||||||||||||||||||
| 5029 | */ | - | ||||||||||||||||||||||||
| 5030 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, qulonglong value) | - | ||||||||||||||||||||||||
| 5031 | { | - | ||||||||||||||||||||||||
| 5032 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5033 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5034 | QString x; | - | ||||||||||||||||||||||||
| 5035 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5036 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5037 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5038 | - | |||||||||||||||||||||||||
| 5039 | /*! | - | ||||||||||||||||||||||||
| 5040 | \overload | - | ||||||||||||||||||||||||
| 5041 | */ | - | ||||||||||||||||||||||||
| 5042 | void QDomElement::setAttributeNS(const QString nsURI, const QString& qName, double value) | - | ||||||||||||||||||||||||
| 5043 | { | - | ||||||||||||||||||||||||
| 5044 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5045 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5046 | QString x; | - | ||||||||||||||||||||||||
| 5047 | x.setNum(value); | - | ||||||||||||||||||||||||
| 5048 | IMPL->setAttributeNS(nsURI, qName, x); | - | ||||||||||||||||||||||||
| 5049 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5050 | - | |||||||||||||||||||||||||
| 5051 | /*! | - | ||||||||||||||||||||||||
| 5052 | Removes the attribute with the local name \a localName and the | - | ||||||||||||||||||||||||
| 5053 | namespace URI \a nsURI from this element. | - | ||||||||||||||||||||||||
| 5054 | - | |||||||||||||||||||||||||
| 5055 | \sa setAttributeNS(), attributeNS(), removeAttribute() | - | ||||||||||||||||||||||||
| 5056 | */ | - | ||||||||||||||||||||||||
| 5057 | void QDomElement::removeAttributeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 5058 | { | - | ||||||||||||||||||||||||
| 5059 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5060 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5061 | QDomNodePrivate *n = IMPL->attributeNodeNS(nsURI, localName); | - | ||||||||||||||||||||||||
| 5062 | if (!n)
| 0 | ||||||||||||||||||||||||
| 5063 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 5064 | IMPL->removeAttribute(n->nodeName()); | - | ||||||||||||||||||||||||
| 5065 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5066 | - | |||||||||||||||||||||||||
| 5067 | /*! | - | ||||||||||||||||||||||||
| 5068 | Returns the QDomAttr object that corresponds to the attribute | - | ||||||||||||||||||||||||
| 5069 | with the local name \a localName and the namespace URI \a nsURI. | - | ||||||||||||||||||||||||
| 5070 | If no such attribute exists a \l{QDomNode::isNull()}{null | - | ||||||||||||||||||||||||
| 5071 | attribute} is returned. | - | ||||||||||||||||||||||||
| 5072 | - | |||||||||||||||||||||||||
| 5073 | \sa setAttributeNode(), attribute(), setAttribute() | - | ||||||||||||||||||||||||
| 5074 | */ | - | ||||||||||||||||||||||||
| 5075 | QDomAttr QDomElement::attributeNodeNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 5076 | { | - | ||||||||||||||||||||||||
| 5077 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5078 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 5079 | return QDomAttr(IMPL->attributeNodeNS(nsURI, localName)); never executed: return QDomAttr(((QDomElementPrivate*)impl)->attributeNodeNS(nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 5080 | } | - | ||||||||||||||||||||||||
| 5081 | - | |||||||||||||||||||||||||
| 5082 | /*! | - | ||||||||||||||||||||||||
| 5083 | Adds the attribute \a newAttr to this element. | - | ||||||||||||||||||||||||
| 5084 | - | |||||||||||||||||||||||||
| 5085 | If the element has another attribute that has the same local name | - | ||||||||||||||||||||||||
| 5086 | and namespace URI as \a newAttr, this function replaces that | - | ||||||||||||||||||||||||
| 5087 | attribute and returns it; otherwise the function returns a | - | ||||||||||||||||||||||||
| 5088 | \l{QDomNode::isNull()}{null attribute}. | - | ||||||||||||||||||||||||
| 5089 | - | |||||||||||||||||||||||||
| 5090 | \sa attributeNodeNS(), setAttributeNS(), setAttributeNode() | - | ||||||||||||||||||||||||
| 5091 | */ | - | ||||||||||||||||||||||||
| 5092 | QDomAttr QDomElement::setAttributeNodeNS(const QDomAttr& newAttr) | - | ||||||||||||||||||||||||
| 5093 | { | - | ||||||||||||||||||||||||
| 5094 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5095 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 5096 | return QDomAttr(IMPL->setAttributeNodeNS(((QDomAttrPrivate*)newAttr.impl))); never executed: return QDomAttr(((QDomElementPrivate*)impl)->setAttributeNodeNS(((QDomAttrPrivate*)newAttr.impl))); | 0 | ||||||||||||||||||||||||
| 5097 | } | - | ||||||||||||||||||||||||
| 5098 | - | |||||||||||||||||||||||||
| 5099 | /*! | - | ||||||||||||||||||||||||
| 5100 | Returns a QDomNodeList containing all descendants of this element | - | ||||||||||||||||||||||||
| 5101 | with local name \a localName and namespace URI \a nsURI encountered | - | ||||||||||||||||||||||||
| 5102 | during a preorder traversal of the element subtree with this element | - | ||||||||||||||||||||||||
| 5103 | as its root. The order of the elements in the returned list is the | - | ||||||||||||||||||||||||
| 5104 | order they are encountered during the preorder traversal. | - | ||||||||||||||||||||||||
| 5105 | - | |||||||||||||||||||||||||
| 5106 | \sa elementsByTagName(), QDomDocument::elementsByTagNameNS() | - | ||||||||||||||||||||||||
| 5107 | */ | - | ||||||||||||||||||||||||
| 5108 | QDomNodeList QDomElement::elementsByTagNameNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 5109 | { | - | ||||||||||||||||||||||||
| 5110 | return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 5111 | } | - | ||||||||||||||||||||||||
| 5112 | - | |||||||||||||||||||||||||
| 5113 | /*! | - | ||||||||||||||||||||||||
| 5114 | Returns \c true if this element has an attribute with the local name | - | ||||||||||||||||||||||||
| 5115 | \a localName and the namespace URI \a nsURI; otherwise returns | - | ||||||||||||||||||||||||
| 5116 | false. | - | ||||||||||||||||||||||||
| 5117 | */ | - | ||||||||||||||||||||||||
| 5118 | bool QDomElement::hasAttributeNS(const QString& nsURI, const QString& localName) const | - | ||||||||||||||||||||||||
| 5119 | { | - | ||||||||||||||||||||||||
| 5120 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5121 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 5122 | return IMPL->hasAttributeNS(nsURI, localName); never executed: return ((QDomElementPrivate*)impl)->hasAttributeNS(nsURI, localName); | 0 | ||||||||||||||||||||||||
| 5123 | } | - | ||||||||||||||||||||||||
| 5124 | - | |||||||||||||||||||||||||
| 5125 | /*! | - | ||||||||||||||||||||||||
| 5126 | Returns the element's text or an empty string. | - | ||||||||||||||||||||||||
| 5127 | - | |||||||||||||||||||||||||
| 5128 | Example: | - | ||||||||||||||||||||||||
| 5129 | \snippet code/src_xml_dom_qdom.cpp 13 | - | ||||||||||||||||||||||||
| 5130 | - | |||||||||||||||||||||||||
| 5131 | The function text() of the QDomElement for the \c{<h1>} tag, | - | ||||||||||||||||||||||||
| 5132 | will return the following text: | - | ||||||||||||||||||||||||
| 5133 | - | |||||||||||||||||||||||||
| 5134 | \snippet code/src_xml_dom_qdom.cpp 14 | - | ||||||||||||||||||||||||
| 5135 | - | |||||||||||||||||||||||||
| 5136 | Comments are ignored by this function. It only evaluates QDomText | - | ||||||||||||||||||||||||
| 5137 | and QDomCDATASection objects. | - | ||||||||||||||||||||||||
| 5138 | */ | - | ||||||||||||||||||||||||
| 5139 | QString QDomElement::text() const | - | ||||||||||||||||||||||||
| 5140 | { | - | ||||||||||||||||||||||||
| 5141 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5142 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5143 | return IMPL->text(); never executed: return ((QDomElementPrivate*)impl)->text(); | 0 | ||||||||||||||||||||||||
| 5144 | } | - | ||||||||||||||||||||||||
| 5145 | - | |||||||||||||||||||||||||
| 5146 | #undef IMPL | - | ||||||||||||||||||||||||
| 5147 | - | |||||||||||||||||||||||||
| 5148 | /************************************************************** | - | ||||||||||||||||||||||||
| 5149 | * | - | ||||||||||||||||||||||||
| 5150 | * QDomTextPrivate | - | ||||||||||||||||||||||||
| 5151 | * | - | ||||||||||||||||||||||||
| 5152 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5153 | - | |||||||||||||||||||||||||
| 5154 | QDomTextPrivate::QDomTextPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& val) | - | ||||||||||||||||||||||||
| 5155 | : QDomCharacterDataPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5156 | { | - | ||||||||||||||||||||||||
| 5157 | name = QLatin1String("#text"); | - | ||||||||||||||||||||||||
| 5158 | } executed 993 times by 5 tests: end of blockExecuted by:
| 993 | ||||||||||||||||||||||||
| 5159 | - | |||||||||||||||||||||||||
| 5160 | QDomTextPrivate::QDomTextPrivate(QDomTextPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5161 | : QDomCharacterDataPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5162 | { | - | ||||||||||||||||||||||||
| 5163 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5164 | - | |||||||||||||||||||||||||
| 5165 | QDomNodePrivate* QDomTextPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5166 | { | - | ||||||||||||||||||||||||
| 5167 | QDomNodePrivate* p = new QDomTextPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5168 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5169 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5170 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5171 | } | - | ||||||||||||||||||||||||
| 5172 | - | |||||||||||||||||||||||||
| 5173 | QDomTextPrivate* QDomTextPrivate::splitText(int offset) | - | ||||||||||||||||||||||||
| 5174 | { | - | ||||||||||||||||||||||||
| 5175 | if (!parent()) {
| 0 | ||||||||||||||||||||||||
| 5176 | qWarning("QDomText::splitText The node has no parent. So I can not split"); | - | ||||||||||||||||||||||||
| 5177 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 5178 | } | - | ||||||||||||||||||||||||
| 5179 | - | |||||||||||||||||||||||||
| 5180 | QDomTextPrivate* t = new QDomTextPrivate(ownerDocument(), 0, value.mid(offset)); | - | ||||||||||||||||||||||||
| 5181 | value.truncate(offset); | - | ||||||||||||||||||||||||
| 5182 | - | |||||||||||||||||||||||||
| 5183 | parent()->insertAfter(t, this); | - | ||||||||||||||||||||||||
| 5184 | - | |||||||||||||||||||||||||
| 5185 | return t; never executed: return t; | 0 | ||||||||||||||||||||||||
| 5186 | } | - | ||||||||||||||||||||||||
| 5187 | - | |||||||||||||||||||||||||
| 5188 | void QDomTextPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5189 | { | - | ||||||||||||||||||||||||
| 5190 | QDomTextPrivate *that = const_cast<QDomTextPrivate*>(this); | - | ||||||||||||||||||||||||
| 5191 | s << encodeText(value, s, !(that->parent() && that->parent()->isElement()), false, true); | - | ||||||||||||||||||||||||
| 5192 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5193 | - | |||||||||||||||||||||||||
| 5194 | /************************************************************** | - | ||||||||||||||||||||||||
| 5195 | * | - | ||||||||||||||||||||||||
| 5196 | * QDomText | - | ||||||||||||||||||||||||
| 5197 | * | - | ||||||||||||||||||||||||
| 5198 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5199 | - | |||||||||||||||||||||||||
| 5200 | #define IMPL ((QDomTextPrivate*)impl) | - | ||||||||||||||||||||||||
| 5201 | - | |||||||||||||||||||||||||
| 5202 | /*! | - | ||||||||||||||||||||||||
| 5203 | \class QDomText | - | ||||||||||||||||||||||||
| 5204 | \reentrant | - | ||||||||||||||||||||||||
| 5205 | \brief The QDomText class represents text data in the parsed XML document. | - | ||||||||||||||||||||||||
| 5206 | - | |||||||||||||||||||||||||
| 5207 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5208 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5209 | - | |||||||||||||||||||||||||
| 5210 | You can split the text in a QDomText object over two QDomText | - | ||||||||||||||||||||||||
| 5211 | objecs with splitText(). | - | ||||||||||||||||||||||||
| 5212 | - | |||||||||||||||||||||||||
| 5213 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5214 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5215 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5216 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5217 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5218 | */ | - | ||||||||||||||||||||||||
| 5219 | - | |||||||||||||||||||||||||
| 5220 | /*! | - | ||||||||||||||||||||||||
| 5221 | Constructs an empty QDomText object. | - | ||||||||||||||||||||||||
| 5222 | - | |||||||||||||||||||||||||
| 5223 | To construct a QDomText with content, use QDomDocument::createTextNode(). | - | ||||||||||||||||||||||||
| 5224 | */ | - | ||||||||||||||||||||||||
| 5225 | QDomText::QDomText() | - | ||||||||||||||||||||||||
| 5226 | : QDomCharacterData() | - | ||||||||||||||||||||||||
| 5227 | { | - | ||||||||||||||||||||||||
| 5228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5229 | - | |||||||||||||||||||||||||
| 5230 | /*! | - | ||||||||||||||||||||||||
| 5231 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5232 | - | |||||||||||||||||||||||||
| 5233 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5234 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5235 | cloneNode(). | - | ||||||||||||||||||||||||
| 5236 | */ | - | ||||||||||||||||||||||||
| 5237 | QDomText::QDomText(const QDomText& x) | - | ||||||||||||||||||||||||
| 5238 | : QDomCharacterData(x) | - | ||||||||||||||||||||||||
| 5239 | { | - | ||||||||||||||||||||||||
| 5240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5241 | - | |||||||||||||||||||||||||
| 5242 | QDomText::QDomText(QDomTextPrivate* n) | - | ||||||||||||||||||||||||
| 5243 | : QDomCharacterData(n) | - | ||||||||||||||||||||||||
| 5244 | { | - | ||||||||||||||||||||||||
| 5245 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5246 | - | |||||||||||||||||||||||||
| 5247 | /*! | - | ||||||||||||||||||||||||
| 5248 | Assigns \a x to this DOM text. | - | ||||||||||||||||||||||||
| 5249 | - | |||||||||||||||||||||||||
| 5250 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5251 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5252 | cloneNode(). | - | ||||||||||||||||||||||||
| 5253 | */ | - | ||||||||||||||||||||||||
| 5254 | QDomText& QDomText::operator= (const QDomText& x) | - | ||||||||||||||||||||||||
| 5255 | { | - | ||||||||||||||||||||||||
| 5256 | return (QDomText&) QDomNode::operator=(x); never executed: return (QDomText&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5257 | } | - | ||||||||||||||||||||||||
| 5258 | - | |||||||||||||||||||||||||
| 5259 | /*! | - | ||||||||||||||||||||||||
| 5260 | \fn QDomNode::NodeType QDomText::nodeType() const | - | ||||||||||||||||||||||||
| 5261 | - | |||||||||||||||||||||||||
| 5262 | Returns \c TextNode. | - | ||||||||||||||||||||||||
| 5263 | */ | - | ||||||||||||||||||||||||
| 5264 | - | |||||||||||||||||||||||||
| 5265 | /*! | - | ||||||||||||||||||||||||
| 5266 | Splits this DOM text object into two QDomText objects. This object | - | ||||||||||||||||||||||||
| 5267 | keeps its first \a offset characters and the second (newly | - | ||||||||||||||||||||||||
| 5268 | created) object is inserted into the document tree after this | - | ||||||||||||||||||||||||
| 5269 | object with the remaining characters. | - | ||||||||||||||||||||||||
| 5270 | - | |||||||||||||||||||||||||
| 5271 | The function returns the newly created object. | - | ||||||||||||||||||||||||
| 5272 | - | |||||||||||||||||||||||||
| 5273 | \sa QDomNode::normalize() | - | ||||||||||||||||||||||||
| 5274 | */ | - | ||||||||||||||||||||||||
| 5275 | QDomText QDomText::splitText(int offset) | - | ||||||||||||||||||||||||
| 5276 | { | - | ||||||||||||||||||||||||
| 5277 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5278 | return QDomText(); never executed: return QDomText(); | 0 | ||||||||||||||||||||||||
| 5279 | return QDomText(IMPL->splitText(offset)); never executed: return QDomText(((QDomTextPrivate*)impl)->splitText(offset)); | 0 | ||||||||||||||||||||||||
| 5280 | } | - | ||||||||||||||||||||||||
| 5281 | - | |||||||||||||||||||||||||
| 5282 | #undef IMPL | - | ||||||||||||||||||||||||
| 5283 | - | |||||||||||||||||||||||||
| 5284 | /************************************************************** | - | ||||||||||||||||||||||||
| 5285 | * | - | ||||||||||||||||||||||||
| 5286 | * QDomCommentPrivate | - | ||||||||||||||||||||||||
| 5287 | * | - | ||||||||||||||||||||||||
| 5288 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5289 | - | |||||||||||||||||||||||||
| 5290 | QDomCommentPrivate::QDomCommentPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& val) | - | ||||||||||||||||||||||||
| 5291 | : QDomCharacterDataPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5292 | { | - | ||||||||||||||||||||||||
| 5293 | name = QLatin1String("#comment"); | - | ||||||||||||||||||||||||
| 5294 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5295 | - | |||||||||||||||||||||||||
| 5296 | QDomCommentPrivate::QDomCommentPrivate(QDomCommentPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5297 | : QDomCharacterDataPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5298 | { | - | ||||||||||||||||||||||||
| 5299 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5300 | - | |||||||||||||||||||||||||
| 5301 | - | |||||||||||||||||||||||||
| 5302 | QDomNodePrivate* QDomCommentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5303 | { | - | ||||||||||||||||||||||||
| 5304 | QDomNodePrivate* p = new QDomCommentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5305 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5306 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5307 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5308 | } | - | ||||||||||||||||||||||||
| 5309 | - | |||||||||||||||||||||||||
| 5310 | void QDomCommentPrivate::save(QTextStream& s, int depth, int indent) const | - | ||||||||||||||||||||||||
| 5311 | { | - | ||||||||||||||||||||||||
| 5312 | /* We don't output whitespace if we would pollute a text node. */ | - | ||||||||||||||||||||||||
| 5313 | if (!(prev && prev->isText()))
| 0 | ||||||||||||||||||||||||
| 5314 | s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); never executed: s << QString(indent < 1 ? 0 : depth * indent, QLatin1Char(' ')); | 0 | ||||||||||||||||||||||||
| 5315 | - | |||||||||||||||||||||||||
| 5316 | s << "<!--" << value; | - | ||||||||||||||||||||||||
| 5317 | if (value.endsWith(QLatin1Char('-')))
| 0 | ||||||||||||||||||||||||
| 5318 | s << ' '; // Ensures that XML comment doesn't end with ---> never executed: s << ' '; | 0 | ||||||||||||||||||||||||
| 5319 | s << "-->"; | - | ||||||||||||||||||||||||
| 5320 | - | |||||||||||||||||||||||||
| 5321 | if (!(next && next->isText()))
| 0 | ||||||||||||||||||||||||
| 5322 | s << endl; never executed: s << endl; | 0 | ||||||||||||||||||||||||
| 5323 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5324 | - | |||||||||||||||||||||||||
| 5325 | /************************************************************** | - | ||||||||||||||||||||||||
| 5326 | * | - | ||||||||||||||||||||||||
| 5327 | * QDomComment | - | ||||||||||||||||||||||||
| 5328 | * | - | ||||||||||||||||||||||||
| 5329 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5330 | - | |||||||||||||||||||||||||
| 5331 | /*! | - | ||||||||||||||||||||||||
| 5332 | \class QDomComment | - | ||||||||||||||||||||||||
| 5333 | \reentrant | - | ||||||||||||||||||||||||
| 5334 | \brief The QDomComment class represents an XML comment. | - | ||||||||||||||||||||||||
| 5335 | - | |||||||||||||||||||||||||
| 5336 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5337 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5338 | - | |||||||||||||||||||||||||
| 5339 | A comment in the parsed XML such as this: | - | ||||||||||||||||||||||||
| 5340 | - | |||||||||||||||||||||||||
| 5341 | \snippet code/src_xml_dom_qdom.cpp 15 | - | ||||||||||||||||||||||||
| 5342 | - | |||||||||||||||||||||||||
| 5343 | is represented by QDomComment objects in the parsed Dom tree. | - | ||||||||||||||||||||||||
| 5344 | - | |||||||||||||||||||||||||
| 5345 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5346 | \l{W3C DOM Level 1}{Level 1} and | - | ||||||||||||||||||||||||
| 5347 | \l{W3C DOM Level 2}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5348 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5349 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5350 | */ | - | ||||||||||||||||||||||||
| 5351 | - | |||||||||||||||||||||||||
| 5352 | /*! | - | ||||||||||||||||||||||||
| 5353 | Constructs an empty comment. To construct a comment with content, | - | ||||||||||||||||||||||||
| 5354 | use the QDomDocument::createComment() function. | - | ||||||||||||||||||||||||
| 5355 | */ | - | ||||||||||||||||||||||||
| 5356 | QDomComment::QDomComment() | - | ||||||||||||||||||||||||
| 5357 | : QDomCharacterData() | - | ||||||||||||||||||||||||
| 5358 | { | - | ||||||||||||||||||||||||
| 5359 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5360 | - | |||||||||||||||||||||||||
| 5361 | /*! | - | ||||||||||||||||||||||||
| 5362 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5363 | - | |||||||||||||||||||||||||
| 5364 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5365 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5366 | cloneNode(). | - | ||||||||||||||||||||||||
| 5367 | */ | - | ||||||||||||||||||||||||
| 5368 | QDomComment::QDomComment(const QDomComment& x) | - | ||||||||||||||||||||||||
| 5369 | : QDomCharacterData(x) | - | ||||||||||||||||||||||||
| 5370 | { | - | ||||||||||||||||||||||||
| 5371 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5372 | - | |||||||||||||||||||||||||
| 5373 | QDomComment::QDomComment(QDomCommentPrivate* n) | - | ||||||||||||||||||||||||
| 5374 | : QDomCharacterData(n) | - | ||||||||||||||||||||||||
| 5375 | { | - | ||||||||||||||||||||||||
| 5376 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5377 | - | |||||||||||||||||||||||||
| 5378 | /*! | - | ||||||||||||||||||||||||
| 5379 | Assigns \a x to this DOM comment. | - | ||||||||||||||||||||||||
| 5380 | - | |||||||||||||||||||||||||
| 5381 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5382 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5383 | cloneNode(). | - | ||||||||||||||||||||||||
| 5384 | */ | - | ||||||||||||||||||||||||
| 5385 | QDomComment& QDomComment::operator= (const QDomComment& x) | - | ||||||||||||||||||||||||
| 5386 | { | - | ||||||||||||||||||||||||
| 5387 | return (QDomComment&) QDomNode::operator=(x); never executed: return (QDomComment&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5388 | } | - | ||||||||||||||||||||||||
| 5389 | - | |||||||||||||||||||||||||
| 5390 | /*! | - | ||||||||||||||||||||||||
| 5391 | \fn QDomNode::NodeType QDomComment::nodeType() const | - | ||||||||||||||||||||||||
| 5392 | - | |||||||||||||||||||||||||
| 5393 | Returns \c CommentNode. | - | ||||||||||||||||||||||||
| 5394 | */ | - | ||||||||||||||||||||||||
| 5395 | - | |||||||||||||||||||||||||
| 5396 | /************************************************************** | - | ||||||||||||||||||||||||
| 5397 | * | - | ||||||||||||||||||||||||
| 5398 | * QDomCDATASectionPrivate | - | ||||||||||||||||||||||||
| 5399 | * | - | ||||||||||||||||||||||||
| 5400 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5401 | - | |||||||||||||||||||||||||
| 5402 | QDomCDATASectionPrivate::QDomCDATASectionPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5403 | const QString& val) | - | ||||||||||||||||||||||||
| 5404 | : QDomTextPrivate(d, parent, val) | - | ||||||||||||||||||||||||
| 5405 | { | - | ||||||||||||||||||||||||
| 5406 | name = QLatin1String("#cdata-section"); | - | ||||||||||||||||||||||||
| 5407 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5408 | - | |||||||||||||||||||||||||
| 5409 | QDomCDATASectionPrivate::QDomCDATASectionPrivate(QDomCDATASectionPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5410 | : QDomTextPrivate(n, deep) | - | ||||||||||||||||||||||||
| 5411 | { | - | ||||||||||||||||||||||||
| 5412 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5413 | - | |||||||||||||||||||||||||
| 5414 | QDomNodePrivate* QDomCDATASectionPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5415 | { | - | ||||||||||||||||||||||||
| 5416 | QDomNodePrivate* p = new QDomCDATASectionPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5417 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5418 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5419 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5420 | } | - | ||||||||||||||||||||||||
| 5421 | - | |||||||||||||||||||||||||
| 5422 | void QDomCDATASectionPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5423 | { | - | ||||||||||||||||||||||||
| 5424 | // ### How do we escape "]]>" ? | - | ||||||||||||||||||||||||
| 5425 | // "]]>" is not allowed; so there should be none in value anyway | - | ||||||||||||||||||||||||
| 5426 | s << "<![CDATA[" << value << "]]>"; | - | ||||||||||||||||||||||||
| 5427 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5428 | - | |||||||||||||||||||||||||
| 5429 | /************************************************************** | - | ||||||||||||||||||||||||
| 5430 | * | - | ||||||||||||||||||||||||
| 5431 | * QDomCDATASection | - | ||||||||||||||||||||||||
| 5432 | * | - | ||||||||||||||||||||||||
| 5433 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5434 | - | |||||||||||||||||||||||||
| 5435 | /*! | - | ||||||||||||||||||||||||
| 5436 | \class QDomCDATASection | - | ||||||||||||||||||||||||
| 5437 | \reentrant | - | ||||||||||||||||||||||||
| 5438 | \brief The QDomCDATASection class represents an XML CDATA section. | - | ||||||||||||||||||||||||
| 5439 | - | |||||||||||||||||||||||||
| 5440 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5441 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5442 | - | |||||||||||||||||||||||||
| 5443 | CDATA sections are used to escape blocks of text containing | - | ||||||||||||||||||||||||
| 5444 | characters that would otherwise be regarded as markup. The only | - | ||||||||||||||||||||||||
| 5445 | delimiter that is recognized in a CDATA section is the "]]>" | - | ||||||||||||||||||||||||
| 5446 | string that terminates the CDATA section. CDATA sections cannot be | - | ||||||||||||||||||||||||
| 5447 | nested. Their primary purpose is for including material such as | - | ||||||||||||||||||||||||
| 5448 | XML fragments, without needing to escape all the delimiters. | - | ||||||||||||||||||||||||
| 5449 | - | |||||||||||||||||||||||||
| 5450 | Adjacent QDomCDATASection nodes are not merged by the | - | ||||||||||||||||||||||||
| 5451 | QDomNode::normalize() function. | - | ||||||||||||||||||||||||
| 5452 | - | |||||||||||||||||||||||||
| 5453 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5454 | \l{http://www.w3.org/TR/REC-DOM-Level-1/} and | - | ||||||||||||||||||||||||
| 5455 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}. | - | ||||||||||||||||||||||||
| 5456 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5457 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5458 | */ | - | ||||||||||||||||||||||||
| 5459 | - | |||||||||||||||||||||||||
| 5460 | /*! | - | ||||||||||||||||||||||||
| 5461 | Constructs an empty CDATA section. To create a CDATA section with | - | ||||||||||||||||||||||||
| 5462 | content, use the QDomDocument::createCDATASection() function. | - | ||||||||||||||||||||||||
| 5463 | */ | - | ||||||||||||||||||||||||
| 5464 | QDomCDATASection::QDomCDATASection() | - | ||||||||||||||||||||||||
| 5465 | : QDomText() | - | ||||||||||||||||||||||||
| 5466 | { | - | ||||||||||||||||||||||||
| 5467 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5468 | - | |||||||||||||||||||||||||
| 5469 | /*! | - | ||||||||||||||||||||||||
| 5470 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5471 | - | |||||||||||||||||||||||||
| 5472 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5473 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5474 | cloneNode(). | - | ||||||||||||||||||||||||
| 5475 | */ | - | ||||||||||||||||||||||||
| 5476 | QDomCDATASection::QDomCDATASection(const QDomCDATASection& x) | - | ||||||||||||||||||||||||
| 5477 | : QDomText(x) | - | ||||||||||||||||||||||||
| 5478 | { | - | ||||||||||||||||||||||||
| 5479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5480 | - | |||||||||||||||||||||||||
| 5481 | QDomCDATASection::QDomCDATASection(QDomCDATASectionPrivate* n) | - | ||||||||||||||||||||||||
| 5482 | : QDomText(n) | - | ||||||||||||||||||||||||
| 5483 | { | - | ||||||||||||||||||||||||
| 5484 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5485 | - | |||||||||||||||||||||||||
| 5486 | /*! | - | ||||||||||||||||||||||||
| 5487 | Assigns \a x to this CDATA section. | - | ||||||||||||||||||||||||
| 5488 | - | |||||||||||||||||||||||||
| 5489 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5490 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5491 | cloneNode(). | - | ||||||||||||||||||||||||
| 5492 | */ | - | ||||||||||||||||||||||||
| 5493 | QDomCDATASection& QDomCDATASection::operator= (const QDomCDATASection& x) | - | ||||||||||||||||||||||||
| 5494 | { | - | ||||||||||||||||||||||||
| 5495 | return (QDomCDATASection&) QDomNode::operator=(x); never executed: return (QDomCDATASection&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5496 | } | - | ||||||||||||||||||||||||
| 5497 | - | |||||||||||||||||||||||||
| 5498 | /*! | - | ||||||||||||||||||||||||
| 5499 | \fn QDomNode::NodeType QDomCDATASection::nodeType() const | - | ||||||||||||||||||||||||
| 5500 | - | |||||||||||||||||||||||||
| 5501 | Returns \c CDATASection. | - | ||||||||||||||||||||||||
| 5502 | */ | - | ||||||||||||||||||||||||
| 5503 | - | |||||||||||||||||||||||||
| 5504 | /************************************************************** | - | ||||||||||||||||||||||||
| 5505 | * | - | ||||||||||||||||||||||||
| 5506 | * QDomNotationPrivate | - | ||||||||||||||||||||||||
| 5507 | * | - | ||||||||||||||||||||||||
| 5508 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5509 | - | |||||||||||||||||||||||||
| 5510 | QDomNotationPrivate::QDomNotationPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5511 | const QString& aname, | - | ||||||||||||||||||||||||
| 5512 | const QString& pub, const QString& sys) | - | ||||||||||||||||||||||||
| 5513 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5514 | { | - | ||||||||||||||||||||||||
| 5515 | name = aname; | - | ||||||||||||||||||||||||
| 5516 | m_pub = pub; | - | ||||||||||||||||||||||||
| 5517 | m_sys = sys; | - | ||||||||||||||||||||||||
| 5518 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5519 | - | |||||||||||||||||||||||||
| 5520 | QDomNotationPrivate::QDomNotationPrivate(QDomNotationPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5521 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5522 | { | - | ||||||||||||||||||||||||
| 5523 | m_sys = n->m_sys; | - | ||||||||||||||||||||||||
| 5524 | m_pub = n->m_pub; | - | ||||||||||||||||||||||||
| 5525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5526 | - | |||||||||||||||||||||||||
| 5527 | QDomNodePrivate* QDomNotationPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5528 | { | - | ||||||||||||||||||||||||
| 5529 | QDomNodePrivate* p = new QDomNotationPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5530 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5531 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5532 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5533 | } | - | ||||||||||||||||||||||||
| 5534 | - | |||||||||||||||||||||||||
| 5535 | void QDomNotationPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5536 | { | - | ||||||||||||||||||||||||
| 5537 | s << "<!NOTATION " << name << ' '; | - | ||||||||||||||||||||||||
| 5538 | if (!m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5539 | s << "PUBLIC " << quotedValue(m_pub); | - | ||||||||||||||||||||||||
| 5540 | if (!m_sys.isNull())
| 0 | ||||||||||||||||||||||||
| 5541 | s << ' ' << quotedValue(m_sys); never executed: s << ' ' << quotedValue(m_sys); | 0 | ||||||||||||||||||||||||
| 5542 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5543 | s << "SYSTEM " << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5544 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5545 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 5546 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5547 | - | |||||||||||||||||||||||||
| 5548 | /************************************************************** | - | ||||||||||||||||||||||||
| 5549 | * | - | ||||||||||||||||||||||||
| 5550 | * QDomNotation | - | ||||||||||||||||||||||||
| 5551 | * | - | ||||||||||||||||||||||||
| 5552 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5553 | - | |||||||||||||||||||||||||
| 5554 | #define IMPL ((QDomNotationPrivate*)impl) | - | ||||||||||||||||||||||||
| 5555 | - | |||||||||||||||||||||||||
| 5556 | /*! | - | ||||||||||||||||||||||||
| 5557 | \class QDomNotation | - | ||||||||||||||||||||||||
| 5558 | \reentrant | - | ||||||||||||||||||||||||
| 5559 | \brief The QDomNotation class represents an XML notation. | - | ||||||||||||||||||||||||
| 5560 | - | |||||||||||||||||||||||||
| 5561 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5562 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5563 | - | |||||||||||||||||||||||||
| 5564 | A notation either declares, by name, the format of an unparsed | - | ||||||||||||||||||||||||
| 5565 | entity (see section 4.7 of the XML 1.0 specification), or is used | - | ||||||||||||||||||||||||
| 5566 | for formal declaration of processing instruction targets (see | - | ||||||||||||||||||||||||
| 5567 | section 2.6 of the XML 1.0 specification). | - | ||||||||||||||||||||||||
| 5568 | - | |||||||||||||||||||||||||
| 5569 | DOM does not support editing notation nodes; they are therefore | - | ||||||||||||||||||||||||
| 5570 | read-only. | - | ||||||||||||||||||||||||
| 5571 | - | |||||||||||||||||||||||||
| 5572 | A notation node does not have any parent. | - | ||||||||||||||||||||||||
| 5573 | - | |||||||||||||||||||||||||
| 5574 | You can retrieve the publicId() and systemId() from a notation | - | ||||||||||||||||||||||||
| 5575 | node. | - | ||||||||||||||||||||||||
| 5576 | - | |||||||||||||||||||||||||
| 5577 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5578 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5579 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5580 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5581 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5582 | */ | - | ||||||||||||||||||||||||
| 5583 | - | |||||||||||||||||||||||||
| 5584 | - | |||||||||||||||||||||||||
| 5585 | /*! | - | ||||||||||||||||||||||||
| 5586 | Constructor. | - | ||||||||||||||||||||||||
| 5587 | */ | - | ||||||||||||||||||||||||
| 5588 | QDomNotation::QDomNotation() | - | ||||||||||||||||||||||||
| 5589 | : QDomNode() | - | ||||||||||||||||||||||||
| 5590 | { | - | ||||||||||||||||||||||||
| 5591 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5592 | - | |||||||||||||||||||||||||
| 5593 | /*! | - | ||||||||||||||||||||||||
| 5594 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5595 | - | |||||||||||||||||||||||||
| 5596 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5597 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5598 | cloneNode(). | - | ||||||||||||||||||||||||
| 5599 | */ | - | ||||||||||||||||||||||||
| 5600 | QDomNotation::QDomNotation(const QDomNotation& x) | - | ||||||||||||||||||||||||
| 5601 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5602 | { | - | ||||||||||||||||||||||||
| 5603 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5604 | - | |||||||||||||||||||||||||
| 5605 | QDomNotation::QDomNotation(QDomNotationPrivate* n) | - | ||||||||||||||||||||||||
| 5606 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5607 | { | - | ||||||||||||||||||||||||
| 5608 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5609 | - | |||||||||||||||||||||||||
| 5610 | /*! | - | ||||||||||||||||||||||||
| 5611 | Assigns \a x to this DOM notation. | - | ||||||||||||||||||||||||
| 5612 | - | |||||||||||||||||||||||||
| 5613 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5614 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5615 | cloneNode(). | - | ||||||||||||||||||||||||
| 5616 | */ | - | ||||||||||||||||||||||||
| 5617 | QDomNotation& QDomNotation::operator= (const QDomNotation& x) | - | ||||||||||||||||||||||||
| 5618 | { | - | ||||||||||||||||||||||||
| 5619 | return (QDomNotation&) QDomNode::operator=(x); never executed: return (QDomNotation&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5620 | } | - | ||||||||||||||||||||||||
| 5621 | - | |||||||||||||||||||||||||
| 5622 | /*! | - | ||||||||||||||||||||||||
| 5623 | \fn QDomNode::NodeType QDomNotation::nodeType() const | - | ||||||||||||||||||||||||
| 5624 | - | |||||||||||||||||||||||||
| 5625 | Returns \c NotationNode. | - | ||||||||||||||||||||||||
| 5626 | */ | - | ||||||||||||||||||||||||
| 5627 | - | |||||||||||||||||||||||||
| 5628 | /*! | - | ||||||||||||||||||||||||
| 5629 | Returns the public identifier of this notation. | - | ||||||||||||||||||||||||
| 5630 | */ | - | ||||||||||||||||||||||||
| 5631 | QString QDomNotation::publicId() const | - | ||||||||||||||||||||||||
| 5632 | { | - | ||||||||||||||||||||||||
| 5633 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5634 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5635 | return IMPL->m_pub; never executed: return ((QDomNotationPrivate*)impl)->m_pub; | 0 | ||||||||||||||||||||||||
| 5636 | } | - | ||||||||||||||||||||||||
| 5637 | - | |||||||||||||||||||||||||
| 5638 | /*! | - | ||||||||||||||||||||||||
| 5639 | Returns the system identifier of this notation. | - | ||||||||||||||||||||||||
| 5640 | */ | - | ||||||||||||||||||||||||
| 5641 | QString QDomNotation::systemId() const | - | ||||||||||||||||||||||||
| 5642 | { | - | ||||||||||||||||||||||||
| 5643 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5644 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5645 | return IMPL->m_sys; never executed: return ((QDomNotationPrivate*)impl)->m_sys; | 0 | ||||||||||||||||||||||||
| 5646 | } | - | ||||||||||||||||||||||||
| 5647 | - | |||||||||||||||||||||||||
| 5648 | #undef IMPL | - | ||||||||||||||||||||||||
| 5649 | - | |||||||||||||||||||||||||
| 5650 | /************************************************************** | - | ||||||||||||||||||||||||
| 5651 | * | - | ||||||||||||||||||||||||
| 5652 | * QDomEntityPrivate | - | ||||||||||||||||||||||||
| 5653 | * | - | ||||||||||||||||||||||||
| 5654 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5655 | - | |||||||||||||||||||||||||
| 5656 | QDomEntityPrivate::QDomEntityPrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, | - | ||||||||||||||||||||||||
| 5657 | const QString& aname, | - | ||||||||||||||||||||||||
| 5658 | const QString& pub, const QString& sys, const QString& notation) | - | ||||||||||||||||||||||||
| 5659 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5660 | { | - | ||||||||||||||||||||||||
| 5661 | name = aname; | - | ||||||||||||||||||||||||
| 5662 | m_pub = pub; | - | ||||||||||||||||||||||||
| 5663 | m_sys = sys; | - | ||||||||||||||||||||||||
| 5664 | m_notationName = notation; | - | ||||||||||||||||||||||||
| 5665 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5666 | - | |||||||||||||||||||||||||
| 5667 | QDomEntityPrivate::QDomEntityPrivate(QDomEntityPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5668 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5669 | { | - | ||||||||||||||||||||||||
| 5670 | m_sys = n->m_sys; | - | ||||||||||||||||||||||||
| 5671 | m_pub = n->m_pub; | - | ||||||||||||||||||||||||
| 5672 | m_notationName = n->m_notationName; | - | ||||||||||||||||||||||||
| 5673 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5674 | - | |||||||||||||||||||||||||
| 5675 | QDomNodePrivate* QDomEntityPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5676 | { | - | ||||||||||||||||||||||||
| 5677 | QDomNodePrivate* p = new QDomEntityPrivate(this, deep); | - | ||||||||||||||||||||||||
| 5678 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5679 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5680 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5681 | } | - | ||||||||||||||||||||||||
| 5682 | - | |||||||||||||||||||||||||
| 5683 | /* | - | ||||||||||||||||||||||||
| 5684 | Encode an entity value upon saving. | - | ||||||||||||||||||||||||
| 5685 | */ | - | ||||||||||||||||||||||||
| 5686 | static QByteArray encodeEntity(const QByteArray& str) | - | ||||||||||||||||||||||||
| 5687 | { | - | ||||||||||||||||||||||||
| 5688 | QByteArray tmp(str); | - | ||||||||||||||||||||||||
| 5689 | int len = tmp.size(); | - | ||||||||||||||||||||||||
| 5690 | int i = 0; | - | ||||||||||||||||||||||||
| 5691 | const char* d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5692 | while (i < len) {
| 0 | ||||||||||||||||||||||||
| 5693 | if (d[i] == '%'){
| 0 | ||||||||||||||||||||||||
| 5694 | tmp.replace(i, 1, "<"); | - | ||||||||||||||||||||||||
| 5695 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5696 | len += 4; | - | ||||||||||||||||||||||||
| 5697 | i += 5; | - | ||||||||||||||||||||||||
| 5698 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5699 | else if (d[i] == '"') {
| 0 | ||||||||||||||||||||||||
| 5700 | tmp.replace(i, 1, """); | - | ||||||||||||||||||||||||
| 5701 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5702 | len += 4; | - | ||||||||||||||||||||||||
| 5703 | i += 5; | - | ||||||||||||||||||||||||
| 5704 | } else if (d[i] == '&' && i + 1 < len && d[i+1] == '#') { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 5705 | // Don't encode < or " or &custom;. | - | ||||||||||||||||||||||||
| 5706 | // Only encode character references | - | ||||||||||||||||||||||||
| 5707 | tmp.replace(i, 1, "&"); | - | ||||||||||||||||||||||||
| 5708 | d = tmp.constData(); | - | ||||||||||||||||||||||||
| 5709 | len += 4; | - | ||||||||||||||||||||||||
| 5710 | i += 5; | - | ||||||||||||||||||||||||
| 5711 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5712 | ++i; | - | ||||||||||||||||||||||||
| 5713 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5714 | } | - | ||||||||||||||||||||||||
| 5715 | - | |||||||||||||||||||||||||
| 5716 | return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||
| 5717 | } | - | ||||||||||||||||||||||||
| 5718 | - | |||||||||||||||||||||||||
| 5719 | void QDomEntityPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5720 | { | - | ||||||||||||||||||||||||
| 5721 | QString _name = name; | - | ||||||||||||||||||||||||
| 5722 | if (_name.startsWith(QLatin1Char('%')))
| 0 | ||||||||||||||||||||||||
| 5723 | _name = QLatin1String("% ") + _name.mid(1); never executed: _name = QLatin1String("% ") + _name.mid(1); | 0 | ||||||||||||||||||||||||
| 5724 | - | |||||||||||||||||||||||||
| 5725 | if (m_sys.isNull() && m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5726 | s << "<!ENTITY " << _name << " \"" << encodeEntity(value.toUtf8()) << "\">" << endl; | - | ||||||||||||||||||||||||
| 5727 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5728 | s << "<!ENTITY " << _name << ' '; | - | ||||||||||||||||||||||||
| 5729 | if (m_pub.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5730 | s << "SYSTEM " << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5731 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 5732 | s << "PUBLIC " << quotedValue(m_pub) << ' ' << quotedValue(m_sys); | - | ||||||||||||||||||||||||
| 5733 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5734 | if (! m_notationName.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5735 | s << " NDATA " << m_notationName; | - | ||||||||||||||||||||||||
| 5736 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5737 | s << '>' << endl; | - | ||||||||||||||||||||||||
| 5738 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5739 | } | - | ||||||||||||||||||||||||
| 5740 | - | |||||||||||||||||||||||||
| 5741 | /************************************************************** | - | ||||||||||||||||||||||||
| 5742 | * | - | ||||||||||||||||||||||||
| 5743 | * QDomEntity | - | ||||||||||||||||||||||||
| 5744 | * | - | ||||||||||||||||||||||||
| 5745 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5746 | - | |||||||||||||||||||||||||
| 5747 | #define IMPL ((QDomEntityPrivate*)impl) | - | ||||||||||||||||||||||||
| 5748 | - | |||||||||||||||||||||||||
| 5749 | /*! | - | ||||||||||||||||||||||||
| 5750 | \class QDomEntity | - | ||||||||||||||||||||||||
| 5751 | \reentrant | - | ||||||||||||||||||||||||
| 5752 | \brief The QDomEntity class represents an XML entity. | - | ||||||||||||||||||||||||
| 5753 | - | |||||||||||||||||||||||||
| 5754 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5755 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5756 | - | |||||||||||||||||||||||||
| 5757 | This class represents an entity in an XML document, either parsed | - | ||||||||||||||||||||||||
| 5758 | or unparsed. Note that this models the entity itself not the | - | ||||||||||||||||||||||||
| 5759 | entity declaration. | - | ||||||||||||||||||||||||
| 5760 | - | |||||||||||||||||||||||||
| 5761 | DOM does not support editing entity nodes; if a user wants to make | - | ||||||||||||||||||||||||
| 5762 | changes to the contents of an entity, every related | - | ||||||||||||||||||||||||
| 5763 | QDomEntityReference node must be replaced in the DOM tree by a | - | ||||||||||||||||||||||||
| 5764 | clone of the entity's contents, and then the desired changes must | - | ||||||||||||||||||||||||
| 5765 | be made to each of the clones instead. All the descendants of an | - | ||||||||||||||||||||||||
| 5766 | entity node are read-only. | - | ||||||||||||||||||||||||
| 5767 | - | |||||||||||||||||||||||||
| 5768 | An entity node does not have any parent. | - | ||||||||||||||||||||||||
| 5769 | - | |||||||||||||||||||||||||
| 5770 | You can access the entity's publicId(), systemId() and | - | ||||||||||||||||||||||||
| 5771 | notationName() when available. | - | ||||||||||||||||||||||||
| 5772 | - | |||||||||||||||||||||||||
| 5773 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5774 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5775 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5776 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5777 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5778 | */ | - | ||||||||||||||||||||||||
| 5779 | - | |||||||||||||||||||||||||
| 5780 | - | |||||||||||||||||||||||||
| 5781 | /*! | - | ||||||||||||||||||||||||
| 5782 | Constructs an empty entity. | - | ||||||||||||||||||||||||
| 5783 | */ | - | ||||||||||||||||||||||||
| 5784 | QDomEntity::QDomEntity() | - | ||||||||||||||||||||||||
| 5785 | : QDomNode() | - | ||||||||||||||||||||||||
| 5786 | { | - | ||||||||||||||||||||||||
| 5787 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5788 | - | |||||||||||||||||||||||||
| 5789 | - | |||||||||||||||||||||||||
| 5790 | /*! | - | ||||||||||||||||||||||||
| 5791 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5792 | - | |||||||||||||||||||||||||
| 5793 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5794 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5795 | cloneNode(). | - | ||||||||||||||||||||||||
| 5796 | */ | - | ||||||||||||||||||||||||
| 5797 | QDomEntity::QDomEntity(const QDomEntity& x) | - | ||||||||||||||||||||||||
| 5798 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5799 | { | - | ||||||||||||||||||||||||
| 5800 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5801 | - | |||||||||||||||||||||||||
| 5802 | QDomEntity::QDomEntity(QDomEntityPrivate* n) | - | ||||||||||||||||||||||||
| 5803 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5804 | { | - | ||||||||||||||||||||||||
| 5805 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5806 | - | |||||||||||||||||||||||||
| 5807 | /*! | - | ||||||||||||||||||||||||
| 5808 | Assigns \a x to this DOM entity. | - | ||||||||||||||||||||||||
| 5809 | - | |||||||||||||||||||||||||
| 5810 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5811 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5812 | cloneNode(). | - | ||||||||||||||||||||||||
| 5813 | */ | - | ||||||||||||||||||||||||
| 5814 | QDomEntity& QDomEntity::operator= (const QDomEntity& x) | - | ||||||||||||||||||||||||
| 5815 | { | - | ||||||||||||||||||||||||
| 5816 | return (QDomEntity&) QDomNode::operator=(x); never executed: return (QDomEntity&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5817 | } | - | ||||||||||||||||||||||||
| 5818 | - | |||||||||||||||||||||||||
| 5819 | /*! | - | ||||||||||||||||||||||||
| 5820 | \fn QDomNode::NodeType QDomEntity::nodeType() const | - | ||||||||||||||||||||||||
| 5821 | - | |||||||||||||||||||||||||
| 5822 | Returns \c EntityNode. | - | ||||||||||||||||||||||||
| 5823 | */ | - | ||||||||||||||||||||||||
| 5824 | - | |||||||||||||||||||||||||
| 5825 | /*! | - | ||||||||||||||||||||||||
| 5826 | Returns the public identifier associated with this entity. If the | - | ||||||||||||||||||||||||
| 5827 | public identifier was not specified an empty string is returned. | - | ||||||||||||||||||||||||
| 5828 | */ | - | ||||||||||||||||||||||||
| 5829 | QString QDomEntity::publicId() const | - | ||||||||||||||||||||||||
| 5830 | { | - | ||||||||||||||||||||||||
| 5831 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5832 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5833 | return IMPL->m_pub; never executed: return ((QDomEntityPrivate*)impl)->m_pub; | 0 | ||||||||||||||||||||||||
| 5834 | } | - | ||||||||||||||||||||||||
| 5835 | - | |||||||||||||||||||||||||
| 5836 | /*! | - | ||||||||||||||||||||||||
| 5837 | Returns the system identifier associated with this entity. If the | - | ||||||||||||||||||||||||
| 5838 | system identifier was not specified an empty string is returned. | - | ||||||||||||||||||||||||
| 5839 | */ | - | ||||||||||||||||||||||||
| 5840 | QString QDomEntity::systemId() const | - | ||||||||||||||||||||||||
| 5841 | { | - | ||||||||||||||||||||||||
| 5842 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5843 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5844 | return IMPL->m_sys; never executed: return ((QDomEntityPrivate*)impl)->m_sys; | 0 | ||||||||||||||||||||||||
| 5845 | } | - | ||||||||||||||||||||||||
| 5846 | - | |||||||||||||||||||||||||
| 5847 | /*! | - | ||||||||||||||||||||||||
| 5848 | For unparsed entities this function returns the name of the | - | ||||||||||||||||||||||||
| 5849 | notation for the entity. For parsed entities this function returns | - | ||||||||||||||||||||||||
| 5850 | an empty string. | - | ||||||||||||||||||||||||
| 5851 | */ | - | ||||||||||||||||||||||||
| 5852 | QString QDomEntity::notationName() const | - | ||||||||||||||||||||||||
| 5853 | { | - | ||||||||||||||||||||||||
| 5854 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 5855 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 5856 | return IMPL->m_notationName; never executed: return ((QDomEntityPrivate*)impl)->m_notationName; | 0 | ||||||||||||||||||||||||
| 5857 | } | - | ||||||||||||||||||||||||
| 5858 | - | |||||||||||||||||||||||||
| 5859 | #undef IMPL | - | ||||||||||||||||||||||||
| 5860 | - | |||||||||||||||||||||||||
| 5861 | /************************************************************** | - | ||||||||||||||||||||||||
| 5862 | * | - | ||||||||||||||||||||||||
| 5863 | * QDomEntityReferencePrivate | - | ||||||||||||||||||||||||
| 5864 | * | - | ||||||||||||||||||||||||
| 5865 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5866 | - | |||||||||||||||||||||||||
| 5867 | QDomEntityReferencePrivate::QDomEntityReferencePrivate(QDomDocumentPrivate* d, QDomNodePrivate* parent, const QString& aname) | - | ||||||||||||||||||||||||
| 5868 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5869 | { | - | ||||||||||||||||||||||||
| 5870 | name = aname; | - | ||||||||||||||||||||||||
| 5871 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5872 | - | |||||||||||||||||||||||||
| 5873 | QDomEntityReferencePrivate::QDomEntityReferencePrivate(QDomNodePrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5874 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5875 | { | - | ||||||||||||||||||||||||
| 5876 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5877 | - | |||||||||||||||||||||||||
| 5878 | QDomNodePrivate* QDomEntityReferencePrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5879 | { | - | ||||||||||||||||||||||||
| 5880 | QDomNodePrivate* p = new QDomEntityReferencePrivate(this, deep); | - | ||||||||||||||||||||||||
| 5881 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 5882 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 5883 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 5884 | } | - | ||||||||||||||||||||||||
| 5885 | - | |||||||||||||||||||||||||
| 5886 | void QDomEntityReferencePrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 5887 | { | - | ||||||||||||||||||||||||
| 5888 | s << '&' << name << ';'; | - | ||||||||||||||||||||||||
| 5889 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5890 | - | |||||||||||||||||||||||||
| 5891 | /************************************************************** | - | ||||||||||||||||||||||||
| 5892 | * | - | ||||||||||||||||||||||||
| 5893 | * QDomEntityReference | - | ||||||||||||||||||||||||
| 5894 | * | - | ||||||||||||||||||||||||
| 5895 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5896 | - | |||||||||||||||||||||||||
| 5897 | /*! | - | ||||||||||||||||||||||||
| 5898 | \class QDomEntityReference | - | ||||||||||||||||||||||||
| 5899 | \reentrant | - | ||||||||||||||||||||||||
| 5900 | \brief The QDomEntityReference class represents an XML entity reference. | - | ||||||||||||||||||||||||
| 5901 | - | |||||||||||||||||||||||||
| 5902 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 5903 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 5904 | - | |||||||||||||||||||||||||
| 5905 | A QDomEntityReference object may be inserted into the DOM tree | - | ||||||||||||||||||||||||
| 5906 | when an entity reference is in the source document, or when the | - | ||||||||||||||||||||||||
| 5907 | user wishes to insert an entity reference. | - | ||||||||||||||||||||||||
| 5908 | - | |||||||||||||||||||||||||
| 5909 | Note that character references and references to predefined | - | ||||||||||||||||||||||||
| 5910 | entities are expanded by the XML processor so that characters are | - | ||||||||||||||||||||||||
| 5911 | represented by their Unicode equivalent rather than by an entity | - | ||||||||||||||||||||||||
| 5912 | reference. | - | ||||||||||||||||||||||||
| 5913 | - | |||||||||||||||||||||||||
| 5914 | Moreover, the XML processor may completely expand references to | - | ||||||||||||||||||||||||
| 5915 | entities while building the DOM tree, instead of providing | - | ||||||||||||||||||||||||
| 5916 | QDomEntityReference objects. | - | ||||||||||||||||||||||||
| 5917 | - | |||||||||||||||||||||||||
| 5918 | If it does provide such objects, then for a given entity reference | - | ||||||||||||||||||||||||
| 5919 | node, it may be that there is no entity node representing the | - | ||||||||||||||||||||||||
| 5920 | referenced entity; but if such an entity exists, then the child | - | ||||||||||||||||||||||||
| 5921 | list of the entity reference node is the same as that of the | - | ||||||||||||||||||||||||
| 5922 | entity node. As with the entity node, all descendants of the | - | ||||||||||||||||||||||||
| 5923 | entity reference are read-only. | - | ||||||||||||||||||||||||
| 5924 | - | |||||||||||||||||||||||||
| 5925 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 5926 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 5927 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 5928 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 5929 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 5930 | */ | - | ||||||||||||||||||||||||
| 5931 | - | |||||||||||||||||||||||||
| 5932 | /*! | - | ||||||||||||||||||||||||
| 5933 | Constructs an empty entity reference. Use | - | ||||||||||||||||||||||||
| 5934 | QDomDocument::createEntityReference() to create a entity reference | - | ||||||||||||||||||||||||
| 5935 | with content. | - | ||||||||||||||||||||||||
| 5936 | */ | - | ||||||||||||||||||||||||
| 5937 | QDomEntityReference::QDomEntityReference() | - | ||||||||||||||||||||||||
| 5938 | : QDomNode() | - | ||||||||||||||||||||||||
| 5939 | { | - | ||||||||||||||||||||||||
| 5940 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5941 | - | |||||||||||||||||||||||||
| 5942 | /*! | - | ||||||||||||||||||||||||
| 5943 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 5944 | - | |||||||||||||||||||||||||
| 5945 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5946 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5947 | cloneNode(). | - | ||||||||||||||||||||||||
| 5948 | */ | - | ||||||||||||||||||||||||
| 5949 | QDomEntityReference::QDomEntityReference(const QDomEntityReference& x) | - | ||||||||||||||||||||||||
| 5950 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 5951 | { | - | ||||||||||||||||||||||||
| 5952 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5953 | - | |||||||||||||||||||||||||
| 5954 | QDomEntityReference::QDomEntityReference(QDomEntityReferencePrivate* n) | - | ||||||||||||||||||||||||
| 5955 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 5956 | { | - | ||||||||||||||||||||||||
| 5957 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5958 | - | |||||||||||||||||||||||||
| 5959 | /*! | - | ||||||||||||||||||||||||
| 5960 | Assigns \a x to this entity reference. | - | ||||||||||||||||||||||||
| 5961 | - | |||||||||||||||||||||||||
| 5962 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 5963 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 5964 | cloneNode(). | - | ||||||||||||||||||||||||
| 5965 | */ | - | ||||||||||||||||||||||||
| 5966 | QDomEntityReference& QDomEntityReference::operator= (const QDomEntityReference& x) | - | ||||||||||||||||||||||||
| 5967 | { | - | ||||||||||||||||||||||||
| 5968 | return (QDomEntityReference&) QDomNode::operator=(x); never executed: return (QDomEntityReference&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 5969 | } | - | ||||||||||||||||||||||||
| 5970 | - | |||||||||||||||||||||||||
| 5971 | /*! | - | ||||||||||||||||||||||||
| 5972 | \fn QDomNode::NodeType QDomEntityReference::nodeType() const | - | ||||||||||||||||||||||||
| 5973 | - | |||||||||||||||||||||||||
| 5974 | Returns \c EntityReference. | - | ||||||||||||||||||||||||
| 5975 | */ | - | ||||||||||||||||||||||||
| 5976 | - | |||||||||||||||||||||||||
| 5977 | /************************************************************** | - | ||||||||||||||||||||||||
| 5978 | * | - | ||||||||||||||||||||||||
| 5979 | * QDomProcessingInstructionPrivate | - | ||||||||||||||||||||||||
| 5980 | * | - | ||||||||||||||||||||||||
| 5981 | **************************************************************/ | - | ||||||||||||||||||||||||
| 5982 | - | |||||||||||||||||||||||||
| 5983 | QDomProcessingInstructionPrivate::QDomProcessingInstructionPrivate(QDomDocumentPrivate* d, | - | ||||||||||||||||||||||||
| 5984 | QDomNodePrivate* parent, const QString& target, const QString& data) | - | ||||||||||||||||||||||||
| 5985 | : QDomNodePrivate(d, parent) | - | ||||||||||||||||||||||||
| 5986 | { | - | ||||||||||||||||||||||||
| 5987 | name = target; | - | ||||||||||||||||||||||||
| 5988 | value = data; | - | ||||||||||||||||||||||||
| 5989 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5990 | - | |||||||||||||||||||||||||
| 5991 | QDomProcessingInstructionPrivate::QDomProcessingInstructionPrivate(QDomProcessingInstructionPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 5992 | : QDomNodePrivate(n, deep) | - | ||||||||||||||||||||||||
| 5993 | { | - | ||||||||||||||||||||||||
| 5994 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5995 | - | |||||||||||||||||||||||||
| 5996 | - | |||||||||||||||||||||||||
| 5997 | QDomNodePrivate* QDomProcessingInstructionPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 5998 | { | - | ||||||||||||||||||||||||
| 5999 | QDomNodePrivate* p = new QDomProcessingInstructionPrivate(this, deep); | - | ||||||||||||||||||||||||
| 6000 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 6001 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6002 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6003 | } | - | ||||||||||||||||||||||||
| 6004 | - | |||||||||||||||||||||||||
| 6005 | void QDomProcessingInstructionPrivate::save(QTextStream& s, int, int) const | - | ||||||||||||||||||||||||
| 6006 | { | - | ||||||||||||||||||||||||
| 6007 | s << "<?" << name << ' ' << value << "?>" << endl; | - | ||||||||||||||||||||||||
| 6008 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6009 | - | |||||||||||||||||||||||||
| 6010 | /************************************************************** | - | ||||||||||||||||||||||||
| 6011 | * | - | ||||||||||||||||||||||||
| 6012 | * QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 6013 | * | - | ||||||||||||||||||||||||
| 6014 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6015 | - | |||||||||||||||||||||||||
| 6016 | /*! | - | ||||||||||||||||||||||||
| 6017 | \class QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 6018 | \reentrant | - | ||||||||||||||||||||||||
| 6019 | \brief The QDomProcessingInstruction class represents an XML processing | - | ||||||||||||||||||||||||
| 6020 | instruction. | - | ||||||||||||||||||||||||
| 6021 | - | |||||||||||||||||||||||||
| 6022 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 6023 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 6024 | - | |||||||||||||||||||||||||
| 6025 | Processing instructions are used in XML to keep processor-specific | - | ||||||||||||||||||||||||
| 6026 | information in the text of the document. | - | ||||||||||||||||||||||||
| 6027 | - | |||||||||||||||||||||||||
| 6028 | The XML declaration that appears at the top of an XML document, | - | ||||||||||||||||||||||||
| 6029 | typically \tt{<?xml version='1.0' encoding='UTF-8'?>}, is treated by QDom as a | - | ||||||||||||||||||||||||
| 6030 | processing instruction. This is unfortunate, since the XML declaration is | - | ||||||||||||||||||||||||
| 6031 | not a processing instruction; among other differences, it cannot be | - | ||||||||||||||||||||||||
| 6032 | inserted into a document anywhere but on the first line. | - | ||||||||||||||||||||||||
| 6033 | - | |||||||||||||||||||||||||
| 6034 | Do not use this function to create an xml declaration, since although it | - | ||||||||||||||||||||||||
| 6035 | has the same syntax as a processing instruction, it isn't, and might not | - | ||||||||||||||||||||||||
| 6036 | be treated by QDom as such. | - | ||||||||||||||||||||||||
| 6037 | - | |||||||||||||||||||||||||
| 6038 | The content of the processing instruction is retrieved with data() | - | ||||||||||||||||||||||||
| 6039 | and set with setData(). The processing instruction's target is | - | ||||||||||||||||||||||||
| 6040 | retrieved with target(). | - | ||||||||||||||||||||||||
| 6041 | - | |||||||||||||||||||||||||
| 6042 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 6043 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 6044 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. | - | ||||||||||||||||||||||||
| 6045 | For a more general introduction of the DOM implementation see the | - | ||||||||||||||||||||||||
| 6046 | QDomDocument documentation. | - | ||||||||||||||||||||||||
| 6047 | */ | - | ||||||||||||||||||||||||
| 6048 | - | |||||||||||||||||||||||||
| 6049 | /*! | - | ||||||||||||||||||||||||
| 6050 | Constructs an empty processing instruction. Use | - | ||||||||||||||||||||||||
| 6051 | QDomDocument::createProcessingInstruction() to create a processing | - | ||||||||||||||||||||||||
| 6052 | instruction with content. | - | ||||||||||||||||||||||||
| 6053 | */ | - | ||||||||||||||||||||||||
| 6054 | QDomProcessingInstruction::QDomProcessingInstruction() | - | ||||||||||||||||||||||||
| 6055 | : QDomNode() | - | ||||||||||||||||||||||||
| 6056 | { | - | ||||||||||||||||||||||||
| 6057 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6058 | - | |||||||||||||||||||||||||
| 6059 | /*! | - | ||||||||||||||||||||||||
| 6060 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 6061 | - | |||||||||||||||||||||||||
| 6062 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6063 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6064 | cloneNode(). | - | ||||||||||||||||||||||||
| 6065 | */ | - | ||||||||||||||||||||||||
| 6066 | QDomProcessingInstruction::QDomProcessingInstruction(const QDomProcessingInstruction& x) | - | ||||||||||||||||||||||||
| 6067 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6068 | { | - | ||||||||||||||||||||||||
| 6069 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6070 | - | |||||||||||||||||||||||||
| 6071 | QDomProcessingInstruction::QDomProcessingInstruction(QDomProcessingInstructionPrivate* n) | - | ||||||||||||||||||||||||
| 6072 | : QDomNode(n) | - | ||||||||||||||||||||||||
| 6073 | { | - | ||||||||||||||||||||||||
| 6074 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6075 | - | |||||||||||||||||||||||||
| 6076 | /*! | - | ||||||||||||||||||||||||
| 6077 | Assigns \a x to this processing instruction. | - | ||||||||||||||||||||||||
| 6078 | - | |||||||||||||||||||||||||
| 6079 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6080 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6081 | cloneNode(). | - | ||||||||||||||||||||||||
| 6082 | */ | - | ||||||||||||||||||||||||
| 6083 | QDomProcessingInstruction& QDomProcessingInstruction::operator= (const QDomProcessingInstruction& x) | - | ||||||||||||||||||||||||
| 6084 | { | - | ||||||||||||||||||||||||
| 6085 | return (QDomProcessingInstruction&) QDomNode::operator=(x); never executed: return (QDomProcessingInstruction&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 6086 | } | - | ||||||||||||||||||||||||
| 6087 | - | |||||||||||||||||||||||||
| 6088 | /*! | - | ||||||||||||||||||||||||
| 6089 | \fn QDomNode::NodeType QDomProcessingInstruction::nodeType() const | - | ||||||||||||||||||||||||
| 6090 | - | |||||||||||||||||||||||||
| 6091 | Returns \c ProcessingInstructionNode. | - | ||||||||||||||||||||||||
| 6092 | */ | - | ||||||||||||||||||||||||
| 6093 | - | |||||||||||||||||||||||||
| 6094 | /*! | - | ||||||||||||||||||||||||
| 6095 | Returns the target of this processing instruction. | - | ||||||||||||||||||||||||
| 6096 | - | |||||||||||||||||||||||||
| 6097 | \sa data() | - | ||||||||||||||||||||||||
| 6098 | */ | - | ||||||||||||||||||||||||
| 6099 | QString QDomProcessingInstruction::target() const | - | ||||||||||||||||||||||||
| 6100 | { | - | ||||||||||||||||||||||||
| 6101 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6102 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 6103 | return impl->nodeName(); never executed: return impl->nodeName(); | 0 | ||||||||||||||||||||||||
| 6104 | } | - | ||||||||||||||||||||||||
| 6105 | - | |||||||||||||||||||||||||
| 6106 | /*! | - | ||||||||||||||||||||||||
| 6107 | Returns the content of this processing instruction. | - | ||||||||||||||||||||||||
| 6108 | - | |||||||||||||||||||||||||
| 6109 | \sa setData(), target() | - | ||||||||||||||||||||||||
| 6110 | */ | - | ||||||||||||||||||||||||
| 6111 | QString QDomProcessingInstruction::data() const | - | ||||||||||||||||||||||||
| 6112 | { | - | ||||||||||||||||||||||||
| 6113 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6114 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||
| 6115 | return impl->nodeValue(); never executed: return impl->nodeValue(); | 0 | ||||||||||||||||||||||||
| 6116 | } | - | ||||||||||||||||||||||||
| 6117 | - | |||||||||||||||||||||||||
| 6118 | /*! | - | ||||||||||||||||||||||||
| 6119 | Sets the data contained in the processing instruction to \a d. | - | ||||||||||||||||||||||||
| 6120 | - | |||||||||||||||||||||||||
| 6121 | \sa data() | - | ||||||||||||||||||||||||
| 6122 | */ | - | ||||||||||||||||||||||||
| 6123 | void QDomProcessingInstruction::setData(const QString& d) | - | ||||||||||||||||||||||||
| 6124 | { | - | ||||||||||||||||||||||||
| 6125 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6126 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 6127 | impl->setNodeValue(d); | - | ||||||||||||||||||||||||
| 6128 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6129 | - | |||||||||||||||||||||||||
| 6130 | /************************************************************** | - | ||||||||||||||||||||||||
| 6131 | * | - | ||||||||||||||||||||||||
| 6132 | * QDomDocumentPrivate | - | ||||||||||||||||||||||||
| 6133 | * | - | ||||||||||||||||||||||||
| 6134 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6135 | - | |||||||||||||||||||||||||
| 6136 | QDomDocumentPrivate::QDomDocumentPrivate() | - | ||||||||||||||||||||||||
| 6137 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6138 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6139 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6140 | { | - | ||||||||||||||||||||||||
| 6141 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6142 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6143 | - | |||||||||||||||||||||||||
| 6144 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6145 | } executed 242 times by 4 tests: end of blockExecuted by:
| 242 | ||||||||||||||||||||||||
| 6146 | - | |||||||||||||||||||||||||
| 6147 | QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname) | - | ||||||||||||||||||||||||
| 6148 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6149 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6150 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6151 | { | - | ||||||||||||||||||||||||
| 6152 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6153 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6154 | type->name = aname; | - | ||||||||||||||||||||||||
| 6155 | - | |||||||||||||||||||||||||
| 6156 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6157 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 6158 | - | |||||||||||||||||||||||||
| 6159 | QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt) | - | ||||||||||||||||||||||||
| 6160 | : QDomNodePrivate(0), | - | ||||||||||||||||||||||||
| 6161 | impl(new QDomImplementationPrivate), | - | ||||||||||||||||||||||||
| 6162 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6163 | { | - | ||||||||||||||||||||||||
| 6164 | if (dt != 0) {
| 0 | ||||||||||||||||||||||||
| 6165 | type = dt; | - | ||||||||||||||||||||||||
| 6166 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 6167 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6168 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6170 | - | |||||||||||||||||||||||||
| 6171 | name = QLatin1String("#document"); | - | ||||||||||||||||||||||||
| 6172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6173 | - | |||||||||||||||||||||||||
| 6174 | QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep) | - | ||||||||||||||||||||||||
| 6175 | : QDomNodePrivate(n, deep), | - | ||||||||||||||||||||||||
| 6176 | impl(n->impl->clone()), | - | ||||||||||||||||||||||||
| 6177 | nodeListTime(1) | - | ||||||||||||||||||||||||
| 6178 | { | - | ||||||||||||||||||||||||
| 6179 | type = static_cast<QDomDocumentTypePrivate*>(n->type->cloneNode()); | - | ||||||||||||||||||||||||
| 6180 | type->setParent(this); | - | ||||||||||||||||||||||||
| 6181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6182 | - | |||||||||||||||||||||||||
| 6183 | QDomDocumentPrivate::~QDomDocumentPrivate() | - | ||||||||||||||||||||||||
| 6184 | { | - | ||||||||||||||||||||||||
| 6185 | } | - | ||||||||||||||||||||||||
| 6186 | - | |||||||||||||||||||||||||
| 6187 | void QDomDocumentPrivate::clear() | - | ||||||||||||||||||||||||
| 6188 | { | - | ||||||||||||||||||||||||
| 6189 | impl.reset(); | - | ||||||||||||||||||||||||
| 6190 | type.reset(); | - | ||||||||||||||||||||||||
| 6191 | QDomNodePrivate::clear(); | - | ||||||||||||||||||||||||
| 6192 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 6193 | - | |||||||||||||||||||||||||
| 6194 | static void initializeReader(QXmlSimpleReader &reader, bool namespaceProcessing) | - | ||||||||||||||||||||||||
| 6195 | { | - | ||||||||||||||||||||||||
| 6196 | reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing); | - | ||||||||||||||||||||||||
| 6197 | reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), !namespaceProcessing); | - | ||||||||||||||||||||||||
| 6198 | reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false); // Shouldn't change in Qt 4 | - | ||||||||||||||||||||||||
| 6199 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 6200 | - | |||||||||||||||||||||||||
| 6201 | bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6202 | { | - | ||||||||||||||||||||||||
| 6203 | QXmlSimpleReader reader; | - | ||||||||||||||||||||||||
| 6204 | initializeReader(reader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6205 | 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 | ||||||||||||||||||||||||
| 6206 | } | - | ||||||||||||||||||||||||
| 6207 | - | |||||||||||||||||||||||||
| 6208 | bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6209 | { | - | ||||||||||||||||||||||||
| 6210 | clear(); | - | ||||||||||||||||||||||||
| 6211 | impl = new QDomImplementationPrivate; | - | ||||||||||||||||||||||||
| 6212 | type = new QDomDocumentTypePrivate(this, this); | - | ||||||||||||||||||||||||
| 6213 | type->ref.deref(); | - | ||||||||||||||||||||||||
| 6214 | - | |||||||||||||||||||||||||
| 6215 | bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces"))
| 2-242 | ||||||||||||||||||||||||
| 6216 | && !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"));
| 0-2 | ||||||||||||||||||||||||
| 6217 | - | |||||||||||||||||||||||||
| 6218 | QDomHandler hnd(this, simpleReader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6219 | reader->setContentHandler(&hnd); | - | ||||||||||||||||||||||||
| 6220 | reader->setErrorHandler(&hnd); | - | ||||||||||||||||||||||||
| 6221 | reader->setLexicalHandler(&hnd); | - | ||||||||||||||||||||||||
| 6222 | reader->setDeclHandler(&hnd); | - | ||||||||||||||||||||||||
| 6223 | reader->setDTDHandler(&hnd); | - | ||||||||||||||||||||||||
| 6224 | - | |||||||||||||||||||||||||
| 6225 | if (!reader->parse(source)) {
| 0-244 | ||||||||||||||||||||||||
| 6226 | if (errorMsg)
| 0 | ||||||||||||||||||||||||
| 6227 | *errorMsg = hnd.errorMsg; never executed: *errorMsg = hnd.errorMsg; | 0 | ||||||||||||||||||||||||
| 6228 | if (errorLine)
| 0 | ||||||||||||||||||||||||
| 6229 | *errorLine = hnd.errorLine; never executed: *errorLine = hnd.errorLine; | 0 | ||||||||||||||||||||||||
| 6230 | if (errorColumn)
| 0 | ||||||||||||||||||||||||
| 6231 | *errorColumn = hnd.errorColumn; never executed: *errorColumn = hnd.errorColumn; | 0 | ||||||||||||||||||||||||
| 6232 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 6233 | } | - | ||||||||||||||||||||||||
| 6234 | - | |||||||||||||||||||||||||
| 6235 | return true; executed 244 times by 5 tests: return true;Executed by:
| 244 | ||||||||||||||||||||||||
| 6236 | } | - | ||||||||||||||||||||||||
| 6237 | - | |||||||||||||||||||||||||
| 6238 | QDomNodePrivate* QDomDocumentPrivate::cloneNode(bool deep) | - | ||||||||||||||||||||||||
| 6239 | { | - | ||||||||||||||||||||||||
| 6240 | QDomNodePrivate *p = new QDomDocumentPrivate(this, deep); | - | ||||||||||||||||||||||||
| 6241 | // We are not interested in this node | - | ||||||||||||||||||||||||
| 6242 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6243 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6244 | } | - | ||||||||||||||||||||||||
| 6245 | - | |||||||||||||||||||||||||
| 6246 | QDomElementPrivate* QDomDocumentPrivate::documentElement() | - | ||||||||||||||||||||||||
| 6247 | { | - | ||||||||||||||||||||||||
| 6248 | QDomNodePrivate *p = first; | - | ||||||||||||||||||||||||
| 6249 | while (p && !p->isElement())
| 0-97 | ||||||||||||||||||||||||
| 6250 | p = p->next; never executed: p = p->next; | 0 | ||||||||||||||||||||||||
| 6251 | - | |||||||||||||||||||||||||
| 6252 | return static_cast<QDomElementPrivate *>(p); executed 97 times by 1 test: return static_cast<QDomElementPrivate *>(p);Executed by:
| 97 | ||||||||||||||||||||||||
| 6253 | } | - | ||||||||||||||||||||||||
| 6254 | - | |||||||||||||||||||||||||
| 6255 | QDomElementPrivate* QDomDocumentPrivate::createElement(const QString &tagName) | - | ||||||||||||||||||||||||
| 6256 | { | - | ||||||||||||||||||||||||
| 6257 | bool ok; | - | ||||||||||||||||||||||||
| 6258 | QString fixedName = fixedXmlName(tagName, &ok); | - | ||||||||||||||||||||||||
| 6259 | if (!ok)
| 0-1021 | ||||||||||||||||||||||||
| 6260 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6261 | - | |||||||||||||||||||||||||
| 6262 | QDomElementPrivate *e = new QDomElementPrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6263 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6264 | return e; executed 1021 times by 4 tests: return e;Executed by:
| 1021 | ||||||||||||||||||||||||
| 6265 | } | - | ||||||||||||||||||||||||
| 6266 | - | |||||||||||||||||||||||||
| 6267 | QDomElementPrivate* QDomDocumentPrivate::createElementNS(const QString &nsURI, const QString &qName) | - | ||||||||||||||||||||||||
| 6268 | { | - | ||||||||||||||||||||||||
| 6269 | bool ok; | - | ||||||||||||||||||||||||
| 6270 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 6271 | if (!ok)
| 0-2 | ||||||||||||||||||||||||
| 6272 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6273 | - | |||||||||||||||||||||||||
| 6274 | QDomElementPrivate *e = new QDomElementPrivate(this, 0, nsURI, fixedName); | - | ||||||||||||||||||||||||
| 6275 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6276 | return e; executed 2 times by 1 test: return e;Executed by:
| 2 | ||||||||||||||||||||||||
| 6277 | } | - | ||||||||||||||||||||||||
| 6278 | - | |||||||||||||||||||||||||
| 6279 | QDomDocumentFragmentPrivate* QDomDocumentPrivate::createDocumentFragment() | - | ||||||||||||||||||||||||
| 6280 | { | - | ||||||||||||||||||||||||
| 6281 | QDomDocumentFragmentPrivate *f = new QDomDocumentFragmentPrivate(this, (QDomNodePrivate*)0); | - | ||||||||||||||||||||||||
| 6282 | f->ref.deref(); | - | ||||||||||||||||||||||||
| 6283 | return f; never executed: return f; | 0 | ||||||||||||||||||||||||
| 6284 | } | - | ||||||||||||||||||||||||
| 6285 | - | |||||||||||||||||||||||||
| 6286 | QDomTextPrivate* QDomDocumentPrivate::createTextNode(const QString &data) | - | ||||||||||||||||||||||||
| 6287 | { | - | ||||||||||||||||||||||||
| 6288 | bool ok; | - | ||||||||||||||||||||||||
| 6289 | QString fixedData = fixedCharData(data, &ok); | - | ||||||||||||||||||||||||
| 6290 | if (!ok)
| 0-125 | ||||||||||||||||||||||||
| 6291 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6292 | - | |||||||||||||||||||||||||
| 6293 | QDomTextPrivate *t = new QDomTextPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6294 | t->ref.deref(); | - | ||||||||||||||||||||||||
| 6295 | return t; executed 125 times by 2 tests: return t;Executed by:
| 125 | ||||||||||||||||||||||||
| 6296 | } | - | ||||||||||||||||||||||||
| 6297 | - | |||||||||||||||||||||||||
| 6298 | QDomCommentPrivate* QDomDocumentPrivate::createComment(const QString &data) | - | ||||||||||||||||||||||||
| 6299 | { | - | ||||||||||||||||||||||||
| 6300 | bool ok; | - | ||||||||||||||||||||||||
| 6301 | QString fixedData = fixedComment(data, &ok); | - | ||||||||||||||||||||||||
| 6302 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6303 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6304 | - | |||||||||||||||||||||||||
| 6305 | QDomCommentPrivate *c = new QDomCommentPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6306 | c->ref.deref(); | - | ||||||||||||||||||||||||
| 6307 | return c; never executed: return c; | 0 | ||||||||||||||||||||||||
| 6308 | } | - | ||||||||||||||||||||||||
| 6309 | - | |||||||||||||||||||||||||
| 6310 | QDomCDATASectionPrivate* QDomDocumentPrivate::createCDATASection(const QString &data) | - | ||||||||||||||||||||||||
| 6311 | { | - | ||||||||||||||||||||||||
| 6312 | bool ok; | - | ||||||||||||||||||||||||
| 6313 | QString fixedData = fixedCDataSection(data, &ok); | - | ||||||||||||||||||||||||
| 6314 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6315 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6316 | - | |||||||||||||||||||||||||
| 6317 | QDomCDATASectionPrivate *c = new QDomCDATASectionPrivate(this, 0, fixedData); | - | ||||||||||||||||||||||||
| 6318 | c->ref.deref(); | - | ||||||||||||||||||||||||
| 6319 | return c; never executed: return c; | 0 | ||||||||||||||||||||||||
| 6320 | } | - | ||||||||||||||||||||||||
| 6321 | - | |||||||||||||||||||||||||
| 6322 | QDomProcessingInstructionPrivate* QDomDocumentPrivate::createProcessingInstruction(const QString &target, | - | ||||||||||||||||||||||||
| 6323 | const QString &data) | - | ||||||||||||||||||||||||
| 6324 | { | - | ||||||||||||||||||||||||
| 6325 | bool ok; | - | ||||||||||||||||||||||||
| 6326 | QString fixedData = fixedPIData(data, &ok); | - | ||||||||||||||||||||||||
| 6327 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6328 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6329 | // [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) | - | ||||||||||||||||||||||||
| 6330 | QString fixedTarget = fixedXmlName(target, &ok); | - | ||||||||||||||||||||||||
| 6331 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6332 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6333 | - | |||||||||||||||||||||||||
| 6334 | QDomProcessingInstructionPrivate *p = new QDomProcessingInstructionPrivate(this, 0, fixedTarget, fixedData); | - | ||||||||||||||||||||||||
| 6335 | p->ref.deref(); | - | ||||||||||||||||||||||||
| 6336 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||
| 6337 | } | - | ||||||||||||||||||||||||
| 6338 | QDomAttrPrivate* QDomDocumentPrivate::createAttribute(const QString &aname) | - | ||||||||||||||||||||||||
| 6339 | { | - | ||||||||||||||||||||||||
| 6340 | bool ok; | - | ||||||||||||||||||||||||
| 6341 | QString fixedName = fixedXmlName(aname, &ok); | - | ||||||||||||||||||||||||
| 6342 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6343 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6344 | - | |||||||||||||||||||||||||
| 6345 | QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6346 | a->ref.deref(); | - | ||||||||||||||||||||||||
| 6347 | return a; never executed: return a; | 0 | ||||||||||||||||||||||||
| 6348 | } | - | ||||||||||||||||||||||||
| 6349 | - | |||||||||||||||||||||||||
| 6350 | QDomAttrPrivate* QDomDocumentPrivate::createAttributeNS(const QString &nsURI, const QString &qName) | - | ||||||||||||||||||||||||
| 6351 | { | - | ||||||||||||||||||||||||
| 6352 | bool ok; | - | ||||||||||||||||||||||||
| 6353 | QString fixedName = fixedXmlName(qName, &ok, true); | - | ||||||||||||||||||||||||
| 6354 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6355 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6356 | - | |||||||||||||||||||||||||
| 6357 | QDomAttrPrivate *a = new QDomAttrPrivate(this, 0, nsURI, fixedName); | - | ||||||||||||||||||||||||
| 6358 | a->ref.deref(); | - | ||||||||||||||||||||||||
| 6359 | return a; never executed: return a; | 0 | ||||||||||||||||||||||||
| 6360 | } | - | ||||||||||||||||||||||||
| 6361 | - | |||||||||||||||||||||||||
| 6362 | QDomEntityReferencePrivate* QDomDocumentPrivate::createEntityReference(const QString &aname) | - | ||||||||||||||||||||||||
| 6363 | { | - | ||||||||||||||||||||||||
| 6364 | bool ok; | - | ||||||||||||||||||||||||
| 6365 | QString fixedName = fixedXmlName(aname, &ok); | - | ||||||||||||||||||||||||
| 6366 | if (!ok)
| 0 | ||||||||||||||||||||||||
| 6367 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
| 6368 | - | |||||||||||||||||||||||||
| 6369 | QDomEntityReferencePrivate *e = new QDomEntityReferencePrivate(this, 0, fixedName); | - | ||||||||||||||||||||||||
| 6370 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 6371 | return e; never executed: return e; | 0 | ||||||||||||||||||||||||
| 6372 | } | - | ||||||||||||||||||||||||
| 6373 | - | |||||||||||||||||||||||||
| 6374 | QDomNodePrivate* QDomDocumentPrivate::importNode(QDomNodePrivate *importedNode, bool deep) | - | ||||||||||||||||||||||||
| 6375 | { | - | ||||||||||||||||||||||||
| 6376 | QDomNodePrivate *node = 0; | - | ||||||||||||||||||||||||
| 6377 | switch (importedNode->nodeType()) { | - | ||||||||||||||||||||||||
| 6378 | case QDomNode::AttributeNode: never executed: case QDomNode::AttributeNode: | 0 | ||||||||||||||||||||||||
| 6379 | node = new QDomAttrPrivate((QDomAttrPrivate*)importedNode, true); | - | ||||||||||||||||||||||||
| 6380 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6381 | case QDomNode::DocumentFragmentNode: never executed: case QDomNode::DocumentFragmentNode: | 0 | ||||||||||||||||||||||||
| 6382 | node = new QDomDocumentFragmentPrivate((QDomDocumentFragmentPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6383 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6384 | case QDomNode::ElementNode: never executed: case QDomNode::ElementNode: | 0 | ||||||||||||||||||||||||
| 6385 | node = new QDomElementPrivate((QDomElementPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6386 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6387 | case QDomNode::EntityNode: never executed: case QDomNode::EntityNode: | 0 | ||||||||||||||||||||||||
| 6388 | node = new QDomEntityPrivate((QDomEntityPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6389 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6390 | case QDomNode::EntityReferenceNode: never executed: case QDomNode::EntityReferenceNode: | 0 | ||||||||||||||||||||||||
| 6391 | node = new QDomEntityReferencePrivate((QDomEntityReferencePrivate*)importedNode, false); | - | ||||||||||||||||||||||||
| 6392 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6393 | case QDomNode::NotationNode: never executed: case QDomNode::NotationNode: | 0 | ||||||||||||||||||||||||
| 6394 | node = new QDomNotationPrivate((QDomNotationPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6395 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6396 | case QDomNode::ProcessingInstructionNode: never executed: case QDomNode::ProcessingInstructionNode: | 0 | ||||||||||||||||||||||||
| 6397 | node = new QDomProcessingInstructionPrivate((QDomProcessingInstructionPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6398 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6399 | case QDomNode::TextNode: never executed: case QDomNode::TextNode: | 0 | ||||||||||||||||||||||||
| 6400 | node = new QDomTextPrivate((QDomTextPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6402 | case QDomNode::CDATASectionNode: never executed: case QDomNode::CDATASectionNode: | 0 | ||||||||||||||||||||||||
| 6403 | node = new QDomCDATASectionPrivate((QDomCDATASectionPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6404 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6405 | case QDomNode::CommentNode: never executed: case QDomNode::CommentNode: | 0 | ||||||||||||||||||||||||
| 6406 | node = new QDomCommentPrivate((QDomCommentPrivate*)importedNode, deep); | - | ||||||||||||||||||||||||
| 6407 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6408 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 6409 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6410 | } | - | ||||||||||||||||||||||||
| 6411 | if (node) {
| 0 | ||||||||||||||||||||||||
| 6412 | node->setOwnerDocument(this); | - | ||||||||||||||||||||||||
| 6413 | // The QDomNode constructor increases the refcount, so deref first to | - | ||||||||||||||||||||||||
| 6414 | // keep refcount balanced. | - | ||||||||||||||||||||||||
| 6415 | node->ref.deref(); | - | ||||||||||||||||||||||||
| 6416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6417 | return node; never executed: return node; | 0 | ||||||||||||||||||||||||
| 6418 | } | - | ||||||||||||||||||||||||
| 6419 | - | |||||||||||||||||||||||||
| 6420 | void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNode::EncodingPolicy encUsed) const | - | ||||||||||||||||||||||||
| 6421 | { | - | ||||||||||||||||||||||||
| 6422 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 6423 | - | |||||||||||||||||||||||||
| 6424 | if(encUsed == QDomNode::EncodingFromDocument) {
| 0-86 | ||||||||||||||||||||||||
| 6425 | #ifndef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 6426 | const QDomNodePrivate* n = first; | - | ||||||||||||||||||||||||
| 6427 | - | |||||||||||||||||||||||||
| 6428 | QTextCodec *codec = 0; | - | ||||||||||||||||||||||||
| 6429 | - | |||||||||||||||||||||||||
| 6430 | if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
| 0-86 | ||||||||||||||||||||||||
| 6431 | // we have an XML declaration | - | ||||||||||||||||||||||||
| 6432 | QString data = n->nodeValue(); | - | ||||||||||||||||||||||||
| 6433 | QRegExp encoding(QString::fromLatin1("encoding\\s*=\\s*((\"([^\"]*)\")|('([^']*)'))")); | - | ||||||||||||||||||||||||
| 6434 | encoding.indexIn(data); | - | ||||||||||||||||||||||||
| 6435 | QString enc = encoding.cap(3); | - | ||||||||||||||||||||||||
| 6436 | if (enc.isEmpty())
| 0 | ||||||||||||||||||||||||
| 6437 | enc = encoding.cap(5); never executed: enc = encoding.cap(5); | 0 | ||||||||||||||||||||||||
| 6438 | if (!enc.isEmpty())
| 0 | ||||||||||||||||||||||||
| 6439 | codec = QTextCodec::codecForName(enc.toLatin1().data()); never executed: codec = QTextCodec::codecForName(enc.toLatin1().data()); | 0 | ||||||||||||||||||||||||
| 6440 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6441 | if (!codec)
| 0-86 | ||||||||||||||||||||||||
| 6442 | codec = QTextCodec::codecForName("UTF-8"); executed 86 times by 2 tests: codec = QTextCodec::codecForName("UTF-8");Executed by:
| 86 | ||||||||||||||||||||||||
| 6443 | if (codec)
| 0-86 | ||||||||||||||||||||||||
| 6444 | s.setCodec(codec); executed 86 times by 2 tests: s.setCodec(codec);Executed by:
| 86 | ||||||||||||||||||||||||
| 6445 | #endif | - | ||||||||||||||||||||||||
| 6446 | bool doc = false; | - | ||||||||||||||||||||||||
| 6447 | - | |||||||||||||||||||||||||
| 6448 | while (n) {
| 86 | ||||||||||||||||||||||||
| 6449 | if (!doc && !(n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml"))) {
| 0-86 | ||||||||||||||||||||||||
| 6450 | // save doctype after XML declaration | - | ||||||||||||||||||||||||
| 6451 | type->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6452 | doc = true; | - | ||||||||||||||||||||||||
| 6453 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6454 | n->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6455 | n = n->next; | - | ||||||||||||||||||||||||
| 6456 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6457 | } executed 86 times by 2 tests: end of blockExecuted by:
| 86 | ||||||||||||||||||||||||
| 6458 | else { | - | ||||||||||||||||||||||||
| 6459 | - | |||||||||||||||||||||||||
| 6460 | // Write out the XML declaration. | - | ||||||||||||||||||||||||
| 6461 | #ifdef QT_NO_TEXTCODEC | - | ||||||||||||||||||||||||
| 6462 | const QLatin1String codecName("iso-8859-1"); | - | ||||||||||||||||||||||||
| 6463 | #else | - | ||||||||||||||||||||||||
| 6464 | const QTextCodec *const codec = s.codec(); | - | ||||||||||||||||||||||||
| 6465 | Q_ASSERT_X(codec, "QDomNode::save()", "A codec must be specified in the text stream."); | - | ||||||||||||||||||||||||
| 6466 | const QByteArray codecName = codec->name(); | - | ||||||||||||||||||||||||
| 6467 | #endif | - | ||||||||||||||||||||||||
| 6468 | - | |||||||||||||||||||||||||
| 6469 | s << "<?xml version=\"1.0\" encoding=\"" | - | ||||||||||||||||||||||||
| 6470 | << codecName | - | ||||||||||||||||||||||||
| 6471 | << "\"?>\n"; | - | ||||||||||||||||||||||||
| 6472 | - | |||||||||||||||||||||||||
| 6473 | // Skip the first processing instruction by name "xml", if any such exists. | - | ||||||||||||||||||||||||
| 6474 | const QDomNodePrivate* startNode = n; | - | ||||||||||||||||||||||||
| 6475 | - | |||||||||||||||||||||||||
| 6476 | // First, we try to find the PI and sets the startNode to the one appearing after it. | - | ||||||||||||||||||||||||
| 6477 | while (n) {
| 0 | ||||||||||||||||||||||||
| 6478 | if(n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
| 0 | ||||||||||||||||||||||||
| 6479 | startNode = n->next; | - | ||||||||||||||||||||||||
| 6480 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6481 | } | - | ||||||||||||||||||||||||
| 6482 | else | - | ||||||||||||||||||||||||
| 6483 | n = n->next; never executed: n = n->next; | 0 | ||||||||||||||||||||||||
| 6484 | } | - | ||||||||||||||||||||||||
| 6485 | - | |||||||||||||||||||||||||
| 6486 | // Now we serialize all the nodes after the faked XML declaration(the PI). | - | ||||||||||||||||||||||||
| 6487 | while(startNode) {
| 0 | ||||||||||||||||||||||||
| 6488 | startNode->save(s, 0, indent); | - | ||||||||||||||||||||||||
| 6489 | startNode = startNode->next; | - | ||||||||||||||||||||||||
| 6490 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6491 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6492 | } | - | ||||||||||||||||||||||||
| 6493 | - | |||||||||||||||||||||||||
| 6494 | /************************************************************** | - | ||||||||||||||||||||||||
| 6495 | * | - | ||||||||||||||||||||||||
| 6496 | * QDomDocument | - | ||||||||||||||||||||||||
| 6497 | * | - | ||||||||||||||||||||||||
| 6498 | **************************************************************/ | - | ||||||||||||||||||||||||
| 6499 | - | |||||||||||||||||||||||||
| 6500 | #define IMPL ((QDomDocumentPrivate*)impl) | - | ||||||||||||||||||||||||
| 6501 | - | |||||||||||||||||||||||||
| 6502 | /*! | - | ||||||||||||||||||||||||
| 6503 | \class QDomDocument | - | ||||||||||||||||||||||||
| 6504 | \reentrant | - | ||||||||||||||||||||||||
| 6505 | \brief The QDomDocument class represents an XML document. | - | ||||||||||||||||||||||||
| 6506 | - | |||||||||||||||||||||||||
| 6507 | \inmodule QtXml | - | ||||||||||||||||||||||||
| 6508 | - | |||||||||||||||||||||||||
| 6509 | \ingroup xml-tools | - | ||||||||||||||||||||||||
| 6510 | - | |||||||||||||||||||||||||
| 6511 | The QDomDocument class represents the entire XML document. | - | ||||||||||||||||||||||||
| 6512 | Conceptually, it is the root of the document tree, and provides | - | ||||||||||||||||||||||||
| 6513 | the primary access to the document's data. | - | ||||||||||||||||||||||||
| 6514 | - | |||||||||||||||||||||||||
| 6515 | Since elements, text nodes, comments, processing instructions, | - | ||||||||||||||||||||||||
| 6516 | etc., cannot exist outside the context of a document, the document | - | ||||||||||||||||||||||||
| 6517 | class also contains the factory functions needed to create these | - | ||||||||||||||||||||||||
| 6518 | objects. The node objects created have an ownerDocument() function | - | ||||||||||||||||||||||||
| 6519 | which associates them with the document within whose context they | - | ||||||||||||||||||||||||
| 6520 | were created. The DOM classes that will be used most often are | - | ||||||||||||||||||||||||
| 6521 | QDomNode, QDomDocument, QDomElement and QDomText. | - | ||||||||||||||||||||||||
| 6522 | - | |||||||||||||||||||||||||
| 6523 | The parsed XML is represented internally by a tree of objects that | - | ||||||||||||||||||||||||
| 6524 | can be accessed using the various QDom classes. All QDom classes | - | ||||||||||||||||||||||||
| 6525 | only \e reference objects in the internal tree. The internal | - | ||||||||||||||||||||||||
| 6526 | objects in the DOM tree will get deleted once the last QDom | - | ||||||||||||||||||||||||
| 6527 | object referencing them or the QDomDocument itself is deleted. | - | ||||||||||||||||||||||||
| 6528 | - | |||||||||||||||||||||||||
| 6529 | Creation of elements, text nodes, etc. is done using the various | - | ||||||||||||||||||||||||
| 6530 | factory functions provided in this class. Using the default | - | ||||||||||||||||||||||||
| 6531 | constructors of the QDom classes will only result in empty | - | ||||||||||||||||||||||||
| 6532 | objects that cannot be manipulated or inserted into the Document. | - | ||||||||||||||||||||||||
| 6533 | - | |||||||||||||||||||||||||
| 6534 | The QDomDocument class has several functions for creating document | - | ||||||||||||||||||||||||
| 6535 | data, for example, createElement(), createTextNode(), | - | ||||||||||||||||||||||||
| 6536 | createComment(), createCDATASection(), | - | ||||||||||||||||||||||||
| 6537 | createProcessingInstruction(), createAttribute() and | - | ||||||||||||||||||||||||
| 6538 | createEntityReference(). Some of these functions have versions | - | ||||||||||||||||||||||||
| 6539 | that support namespaces, i.e. createElementNS() and | - | ||||||||||||||||||||||||
| 6540 | createAttributeNS(). The createDocumentFragment() function is used | - | ||||||||||||||||||||||||
| 6541 | to hold parts of the document; this is useful for manipulating for | - | ||||||||||||||||||||||||
| 6542 | complex documents. | - | ||||||||||||||||||||||||
| 6543 | - | |||||||||||||||||||||||||
| 6544 | The entire content of the document is set with setContent(). This | - | ||||||||||||||||||||||||
| 6545 | function parses the string it is passed as an XML document and | - | ||||||||||||||||||||||||
| 6546 | creates the DOM tree that represents the document. The root | - | ||||||||||||||||||||||||
| 6547 | element is available using documentElement(). The textual | - | ||||||||||||||||||||||||
| 6548 | representation of the document can be obtained using toString(). | - | ||||||||||||||||||||||||
| 6549 | - | |||||||||||||||||||||||||
| 6550 | \note The DOM tree might end up reserving a lot of memory if the XML | - | ||||||||||||||||||||||||
| 6551 | document is big. For such documents, the QXmlStreamReader or the | - | ||||||||||||||||||||||||
| 6552 | QXmlQuery classes might be better solutions. | - | ||||||||||||||||||||||||
| 6553 | - | |||||||||||||||||||||||||
| 6554 | It is possible to insert a node from another document into the | - | ||||||||||||||||||||||||
| 6555 | document using importNode(). | - | ||||||||||||||||||||||||
| 6556 | - | |||||||||||||||||||||||||
| 6557 | You can obtain a list of all the elements that have a particular | - | ||||||||||||||||||||||||
| 6558 | tag with elementsByTagName() or with elementsByTagNameNS(). | - | ||||||||||||||||||||||||
| 6559 | - | |||||||||||||||||||||||||
| 6560 | The QDom classes are typically used as follows: | - | ||||||||||||||||||||||||
| 6561 | - | |||||||||||||||||||||||||
| 6562 | \snippet code/src_xml_dom_qdom.cpp 16 | - | ||||||||||||||||||||||||
| 6563 | - | |||||||||||||||||||||||||
| 6564 | Once \c doc and \c elem go out of scope, the whole internal tree | - | ||||||||||||||||||||||||
| 6565 | representing the XML document is deleted. | - | ||||||||||||||||||||||||
| 6566 | - | |||||||||||||||||||||||||
| 6567 | To create a document using DOM use code like this: | - | ||||||||||||||||||||||||
| 6568 | - | |||||||||||||||||||||||||
| 6569 | \snippet code/src_xml_dom_qdom.cpp 17 | - | ||||||||||||||||||||||||
| 6570 | - | |||||||||||||||||||||||||
| 6571 | For further information about the Document Object Model see | - | ||||||||||||||||||||||||
| 6572 | the Document Object Model (DOM) | - | ||||||||||||||||||||||||
| 6573 | \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and | - | ||||||||||||||||||||||||
| 6574 | \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core} | - | ||||||||||||||||||||||||
| 6575 | Specifications. | - | ||||||||||||||||||||||||
| 6576 | - | |||||||||||||||||||||||||
| 6577 | \sa {DOM Bookmarks Example}, {Simple DOM Model Example} | - | ||||||||||||||||||||||||
| 6578 | */ | - | ||||||||||||||||||||||||
| 6579 | - | |||||||||||||||||||||||||
| 6580 | - | |||||||||||||||||||||||||
| 6581 | /*! | - | ||||||||||||||||||||||||
| 6582 | Constructs an empty document. | - | ||||||||||||||||||||||||
| 6583 | */ | - | ||||||||||||||||||||||||
| 6584 | QDomDocument::QDomDocument() | - | ||||||||||||||||||||||||
| 6585 | { | - | ||||||||||||||||||||||||
| 6586 | impl = 0; | - | ||||||||||||||||||||||||
| 6587 | } executed 242 times by 4 tests: end of blockExecuted by:
| 242 | ||||||||||||||||||||||||
| 6588 | - | |||||||||||||||||||||||||
| 6589 | /*! | - | ||||||||||||||||||||||||
| 6590 | Creates a document and sets the name of the document type to \a | - | ||||||||||||||||||||||||
| 6591 | name. | - | ||||||||||||||||||||||||
| 6592 | */ | - | ||||||||||||||||||||||||
| 6593 | QDomDocument::QDomDocument(const QString& name) | - | ||||||||||||||||||||||||
| 6594 | { | - | ||||||||||||||||||||||||
| 6595 | // We take over ownership | - | ||||||||||||||||||||||||
| 6596 | impl = new QDomDocumentPrivate(name); | - | ||||||||||||||||||||||||
| 6597 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 6598 | - | |||||||||||||||||||||||||
| 6599 | /*! | - | ||||||||||||||||||||||||
| 6600 | Creates a document with the document type \a doctype. | - | ||||||||||||||||||||||||
| 6601 | - | |||||||||||||||||||||||||
| 6602 | \sa QDomImplementation::createDocumentType() | - | ||||||||||||||||||||||||
| 6603 | */ | - | ||||||||||||||||||||||||
| 6604 | QDomDocument::QDomDocument(const QDomDocumentType& doctype) | - | ||||||||||||||||||||||||
| 6605 | { | - | ||||||||||||||||||||||||
| 6606 | impl = new QDomDocumentPrivate((QDomDocumentTypePrivate*)(doctype.impl)); | - | ||||||||||||||||||||||||
| 6607 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6608 | - | |||||||||||||||||||||||||
| 6609 | /*! | - | ||||||||||||||||||||||||
| 6610 | Constructs a copy of \a x. | - | ||||||||||||||||||||||||
| 6611 | - | |||||||||||||||||||||||||
| 6612 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6613 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6614 | cloneNode(). | - | ||||||||||||||||||||||||
| 6615 | */ | - | ||||||||||||||||||||||||
| 6616 | QDomDocument::QDomDocument(const QDomDocument& x) | - | ||||||||||||||||||||||||
| 6617 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6618 | { | - | ||||||||||||||||||||||||
| 6619 | } executed 97 times by 1 test: end of blockExecuted by:
| 97 | ||||||||||||||||||||||||
| 6620 | - | |||||||||||||||||||||||||
| 6621 | QDomDocument::QDomDocument(QDomDocumentPrivate* x) | - | ||||||||||||||||||||||||
| 6622 | : QDomNode(x) | - | ||||||||||||||||||||||||
| 6623 | { | - | ||||||||||||||||||||||||
| 6624 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6625 | - | |||||||||||||||||||||||||
| 6626 | /*! | - | ||||||||||||||||||||||||
| 6627 | Assigns \a x to this DOM document. | - | ||||||||||||||||||||||||
| 6628 | - | |||||||||||||||||||||||||
| 6629 | The data of the copy is shared (shallow copy): modifying one node | - | ||||||||||||||||||||||||
| 6630 | will also change the other. If you want to make a deep copy, use | - | ||||||||||||||||||||||||
| 6631 | cloneNode(). | - | ||||||||||||||||||||||||
| 6632 | */ | - | ||||||||||||||||||||||||
| 6633 | QDomDocument& QDomDocument::operator= (const QDomDocument& x) | - | ||||||||||||||||||||||||
| 6634 | { | - | ||||||||||||||||||||||||
| 6635 | return (QDomDocument&) QDomNode::operator=(x); never executed: return (QDomDocument&) QDomNode::operator=(x); | 0 | ||||||||||||||||||||||||
| 6636 | } | - | ||||||||||||||||||||||||
| 6637 | - | |||||||||||||||||||||||||
| 6638 | /*! | - | ||||||||||||||||||||||||
| 6639 | Destroys the object and frees its resources. | - | ||||||||||||||||||||||||
| 6640 | */ | - | ||||||||||||||||||||||||
| 6641 | QDomDocument::~QDomDocument() | - | ||||||||||||||||||||||||
| 6642 | { | - | ||||||||||||||||||||||||
| 6643 | } | - | ||||||||||||||||||||||||
| 6644 | - | |||||||||||||||||||||||||
| 6645 | /*! | - | ||||||||||||||||||||||||
| 6646 | \overload | - | ||||||||||||||||||||||||
| 6647 | - | |||||||||||||||||||||||||
| 6648 | This function reads the XML document from the string \a text, returning | - | ||||||||||||||||||||||||
| 6649 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6650 | Since \a text is already a Unicode string, no encoding detection | - | ||||||||||||||||||||||||
| 6651 | is done. | - | ||||||||||||||||||||||||
| 6652 | */ | - | ||||||||||||||||||||||||
| 6653 | bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6654 | { | - | ||||||||||||||||||||||||
| 6655 | if (!impl)
| 0-241 | ||||||||||||||||||||||||
| 6656 | impl = new QDomDocumentPrivate(); executed 241 times by 3 tests: impl = new QDomDocumentPrivate();Executed by:
| 241 | ||||||||||||||||||||||||
| 6657 | QXmlInputSource source; | - | ||||||||||||||||||||||||
| 6658 | source.setData(text); | - | ||||||||||||||||||||||||
| 6659 | 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 | ||||||||||||||||||||||||
| 6660 | } | - | ||||||||||||||||||||||||
| 6661 | - | |||||||||||||||||||||||||
| 6662 | /*! | - | ||||||||||||||||||||||||
| 6663 | \nonreentrant | - | ||||||||||||||||||||||||
| 6664 | - | |||||||||||||||||||||||||
| 6665 | This function parses the XML document from the byte array \a | - | ||||||||||||||||||||||||
| 6666 | data and sets it as the content of the document. It tries to | - | ||||||||||||||||||||||||
| 6667 | detect the encoding of the document as required by the XML | - | ||||||||||||||||||||||||
| 6668 | specification. | - | ||||||||||||||||||||||||
| 6669 | - | |||||||||||||||||||||||||
| 6670 | If \a namespaceProcessing is true, the parser recognizes | - | ||||||||||||||||||||||||
| 6671 | namespaces in the XML file and sets the prefix name, local name | - | ||||||||||||||||||||||||
| 6672 | and namespace URI to appropriate values. If \a namespaceProcessing | - | ||||||||||||||||||||||||
| 6673 | is false, the parser does no namespace processing when it reads | - | ||||||||||||||||||||||||
| 6674 | the XML file. | - | ||||||||||||||||||||||||
| 6675 | - | |||||||||||||||||||||||||
| 6676 | If a parse error occurs, this function returns \c false and the error | - | ||||||||||||||||||||||||
| 6677 | message is placed in \c{*}\a{errorMsg}, the line number in | - | ||||||||||||||||||||||||
| 6678 | \c{*}\a{errorLine} and the column number in \c{*}\a{errorColumn} | - | ||||||||||||||||||||||||
| 6679 | (unless the associated pointer is set to 0); otherwise this | - | ||||||||||||||||||||||||
| 6680 | function returns \c true. The various error messages are described in | - | ||||||||||||||||||||||||
| 6681 | the QXmlParseException class documentation. Note that, if you | - | ||||||||||||||||||||||||
| 6682 | want to display these error messages to your application's users, | - | ||||||||||||||||||||||||
| 6683 | they will be displayed in English unless they are explicitly | - | ||||||||||||||||||||||||
| 6684 | translated. | - | ||||||||||||||||||||||||
| 6685 | - | |||||||||||||||||||||||||
| 6686 | If \a namespaceProcessing is true, the function QDomNode::prefix() | - | ||||||||||||||||||||||||
| 6687 | returns a string for all elements and attributes. It returns an | - | ||||||||||||||||||||||||
| 6688 | empty string if the element or attribute has no prefix. | - | ||||||||||||||||||||||||
| 6689 | - | |||||||||||||||||||||||||
| 6690 | Text nodes consisting only of whitespace are stripped and won't | - | ||||||||||||||||||||||||
| 6691 | appear in the QDomDocument. If this behavior is not desired, | - | ||||||||||||||||||||||||
| 6692 | one can use the setContent() overload that allows a QXmlReader to be | - | ||||||||||||||||||||||||
| 6693 | supplied. | - | ||||||||||||||||||||||||
| 6694 | - | |||||||||||||||||||||||||
| 6695 | If \a namespaceProcessing is false, the functions | - | ||||||||||||||||||||||||
| 6696 | QDomNode::prefix(), QDomNode::localName() and | - | ||||||||||||||||||||||||
| 6697 | QDomNode::namespaceURI() return an empty string. | - | ||||||||||||||||||||||||
| 6698 | - | |||||||||||||||||||||||||
| 6699 | Entity references are handled as follows: | - | ||||||||||||||||||||||||
| 6700 | \list | - | ||||||||||||||||||||||||
| 6701 | \li References to internal general entities and character entities occurring in the | - | ||||||||||||||||||||||||
| 6702 | content are included. The result is a QDomText node with the references replaced | - | ||||||||||||||||||||||||
| 6703 | by their corresponding entity values. | - | ||||||||||||||||||||||||
| 6704 | \li References to parameter entities occurring in the internal subset are included. | - | ||||||||||||||||||||||||
| 6705 | The result is a QDomDocumentType node which contains entity and notation declarations | - | ||||||||||||||||||||||||
| 6706 | with the references replaced by their corresponding entity values. | - | ||||||||||||||||||||||||
| 6707 | \li Any general parsed entity reference which is not defined in the internal subset and | - | ||||||||||||||||||||||||
| 6708 | which occurs in the content is represented as a QDomEntityReference node. | - | ||||||||||||||||||||||||
| 6709 | \li Any parsed entity reference which is not defined in the internal subset and which | - | ||||||||||||||||||||||||
| 6710 | occurs outside of the content is replaced with an empty string. | - | ||||||||||||||||||||||||
| 6711 | \li Any unparsed entity reference is replaced with an empty string. | - | ||||||||||||||||||||||||
| 6712 | \endlist | - | ||||||||||||||||||||||||
| 6713 | - | |||||||||||||||||||||||||
| 6714 | \sa QDomNode::namespaceURI(), QDomNode::localName(), | - | ||||||||||||||||||||||||
| 6715 | QDomNode::prefix(), QString::isNull(), QString::isEmpty() | - | ||||||||||||||||||||||||
| 6716 | */ | - | ||||||||||||||||||||||||
| 6717 | bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6718 | { | - | ||||||||||||||||||||||||
| 6719 | if (!impl)
| 1-2 | ||||||||||||||||||||||||
| 6720 | impl = new QDomDocumentPrivate(); executed 1 time by 1 test: impl = new QDomDocumentPrivate();Executed by:
| 1 | ||||||||||||||||||||||||
| 6721 | QBuffer buf; | - | ||||||||||||||||||||||||
| 6722 | buf.setData(data); | - | ||||||||||||||||||||||||
| 6723 | QXmlInputSource source(&buf); | - | ||||||||||||||||||||||||
| 6724 | 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 | ||||||||||||||||||||||||
| 6725 | } | - | ||||||||||||||||||||||||
| 6726 | - | |||||||||||||||||||||||||
| 6727 | /*! | - | ||||||||||||||||||||||||
| 6728 | \overload | - | ||||||||||||||||||||||||
| 6729 | - | |||||||||||||||||||||||||
| 6730 | This function reads the XML document from the IO device \a dev, returning | - | ||||||||||||||||||||||||
| 6731 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6732 | */ | - | ||||||||||||||||||||||||
| 6733 | bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6734 | { | - | ||||||||||||||||||||||||
| 6735 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6736 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6737 | QXmlInputSource source(dev); | - | ||||||||||||||||||||||||
| 6738 | return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6739 | } | - | ||||||||||||||||||||||||
| 6740 | - | |||||||||||||||||||||||||
| 6741 | /*! | - | ||||||||||||||||||||||||
| 6742 | \overload | - | ||||||||||||||||||||||||
| 6743 | \since 4.5 | - | ||||||||||||||||||||||||
| 6744 | - | |||||||||||||||||||||||||
| 6745 | This function reads the XML document from the QXmlInputSource \a source, | - | ||||||||||||||||||||||||
| 6746 | returning true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6747 | - | |||||||||||||||||||||||||
| 6748 | */ | - | ||||||||||||||||||||||||
| 6749 | bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6750 | { | - | ||||||||||||||||||||||||
| 6751 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6752 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6753 | QXmlSimpleReader reader; | - | ||||||||||||||||||||||||
| 6754 | initializeReader(reader, namespaceProcessing); | - | ||||||||||||||||||||||||
| 6755 | return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6756 | } | - | ||||||||||||||||||||||||
| 6757 | - | |||||||||||||||||||||||||
| 6758 | /*! | - | ||||||||||||||||||||||||
| 6759 | \overload | - | ||||||||||||||||||||||||
| 6760 | - | |||||||||||||||||||||||||
| 6761 | This function reads the XML document from the string \a text, returning | - | ||||||||||||||||||||||||
| 6762 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6763 | Since \a text is already a Unicode string, no encoding detection | - | ||||||||||||||||||||||||
| 6764 | is performed. | - | ||||||||||||||||||||||||
| 6765 | - | |||||||||||||||||||||||||
| 6766 | No namespace processing is performed either. | - | ||||||||||||||||||||||||
| 6767 | */ | - | ||||||||||||||||||||||||
| 6768 | bool QDomDocument::setContent(const QString& text, QString *errorMsg, int *errorLine, int *errorColumn) | - | ||||||||||||||||||||||||
| 6769 | { | - | ||||||||||||||||||||||||
| 6770 | return setContent(text, false, errorMsg, errorLine, errorColumn); executed 241 times by 3 tests: return setContent(text, false, errorMsg, errorLine, errorColumn);Executed by:
| 241 | ||||||||||||||||||||||||
| 6771 | } | - | ||||||||||||||||||||||||
| 6772 | - | |||||||||||||||||||||||||
| 6773 | /*! | - | ||||||||||||||||||||||||
| 6774 | \overload | - | ||||||||||||||||||||||||
| 6775 | - | |||||||||||||||||||||||||
| 6776 | This function reads the XML document from the byte array \a buffer, | - | ||||||||||||||||||||||||
| 6777 | returning true if the content was successfully parsed; otherwise returns | - | ||||||||||||||||||||||||
| 6778 | false. | - | ||||||||||||||||||||||||
| 6779 | - | |||||||||||||||||||||||||
| 6780 | No namespace processing is performed. | - | ||||||||||||||||||||||||
| 6781 | */ | - | ||||||||||||||||||||||||
| 6782 | bool QDomDocument::setContent(const QByteArray& buffer, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6783 | { | - | ||||||||||||||||||||||||
| 6784 | return setContent(buffer, false, errorMsg, errorLine, errorColumn); executed 1 time by 1 test: return setContent(buffer, false, errorMsg, errorLine, errorColumn);Executed by:
| 1 | ||||||||||||||||||||||||
| 6785 | } | - | ||||||||||||||||||||||||
| 6786 | - | |||||||||||||||||||||||||
| 6787 | /*! | - | ||||||||||||||||||||||||
| 6788 | \overload | - | ||||||||||||||||||||||||
| 6789 | - | |||||||||||||||||||||||||
| 6790 | This function reads the XML document from the IO device \a dev, returning | - | ||||||||||||||||||||||||
| 6791 | true if the content was successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6792 | - | |||||||||||||||||||||||||
| 6793 | No namespace processing is performed. | - | ||||||||||||||||||||||||
| 6794 | */ | - | ||||||||||||||||||||||||
| 6795 | bool QDomDocument::setContent(QIODevice* dev, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6796 | { | - | ||||||||||||||||||||||||
| 6797 | return setContent(dev, false, errorMsg, errorLine, errorColumn); never executed: return setContent(dev, false, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6798 | } | - | ||||||||||||||||||||||||
| 6799 | - | |||||||||||||||||||||||||
| 6800 | /*! | - | ||||||||||||||||||||||||
| 6801 | \overload | - | ||||||||||||||||||||||||
| 6802 | - | |||||||||||||||||||||||||
| 6803 | This function reads the XML document from the QXmlInputSource \a source and | - | ||||||||||||||||||||||||
| 6804 | parses it with the QXmlReader \a reader, returning true if the content was | - | ||||||||||||||||||||||||
| 6805 | successfully parsed; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 6806 | - | |||||||||||||||||||||||||
| 6807 | This function doesn't change the features of the \a reader. If you want to | - | ||||||||||||||||||||||||
| 6808 | use certain features for parsing you can use this function to set up the | - | ||||||||||||||||||||||||
| 6809 | reader appropriately. | - | ||||||||||||||||||||||||
| 6810 | - | |||||||||||||||||||||||||
| 6811 | \sa QXmlSimpleReader | - | ||||||||||||||||||||||||
| 6812 | */ | - | ||||||||||||||||||||||||
| 6813 | bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn ) | - | ||||||||||||||||||||||||
| 6814 | { | - | ||||||||||||||||||||||||
| 6815 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6816 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6817 | return IMPL->setContent(source, reader, 0, errorMsg, errorLine, errorColumn); never executed: return ((QDomDocumentPrivate*)impl)->setContent(source, reader, 0, errorMsg, errorLine, errorColumn); | 0 | ||||||||||||||||||||||||
| 6818 | } | - | ||||||||||||||||||||||||
| 6819 | - | |||||||||||||||||||||||||
| 6820 | /*! | - | ||||||||||||||||||||||||
| 6821 | Converts the parsed document back to its textual representation. | - | ||||||||||||||||||||||||
| 6822 | - | |||||||||||||||||||||||||
| 6823 | This function uses \a indent as the amount of space to indent | - | ||||||||||||||||||||||||
| 6824 | subelements. | - | ||||||||||||||||||||||||
| 6825 | - | |||||||||||||||||||||||||
| 6826 | If \a indent is -1, no whitespace at all is added. | - | ||||||||||||||||||||||||
| 6827 | */ | - | ||||||||||||||||||||||||
| 6828 | QString QDomDocument::toString(int indent) const | - | ||||||||||||||||||||||||
| 6829 | { | - | ||||||||||||||||||||||||
| 6830 | QString str; | - | ||||||||||||||||||||||||
| 6831 | QTextStream s(&str, QIODevice::WriteOnly); | - | ||||||||||||||||||||||||
| 6832 | save(s, indent); | - | ||||||||||||||||||||||||
| 6833 | return str; executed 86 times by 2 tests: return str;Executed by:
| 86 | ||||||||||||||||||||||||
| 6834 | } | - | ||||||||||||||||||||||||
| 6835 | - | |||||||||||||||||||||||||
| 6836 | /*! | - | ||||||||||||||||||||||||
| 6837 | Converts the parsed document back to its textual representation | - | ||||||||||||||||||||||||
| 6838 | and returns a QByteArray containing the data encoded as UTF-8. | - | ||||||||||||||||||||||||
| 6839 | - | |||||||||||||||||||||||||
| 6840 | This function uses \a indent as the amount of space to indent | - | ||||||||||||||||||||||||
| 6841 | subelements. | - | ||||||||||||||||||||||||
| 6842 | - | |||||||||||||||||||||||||
| 6843 | \sa toString() | - | ||||||||||||||||||||||||
| 6844 | */ | - | ||||||||||||||||||||||||
| 6845 | QByteArray QDomDocument::toByteArray(int indent) const | - | ||||||||||||||||||||||||
| 6846 | { | - | ||||||||||||||||||||||||
| 6847 | // ### if there is an encoding specified in the xml declaration, this | - | ||||||||||||||||||||||||
| 6848 | // encoding declaration should be changed to utf8 | - | ||||||||||||||||||||||||
| 6849 | return toString(indent).toUtf8(); executed 2 times by 1 test: return toString(indent).toUtf8();Executed by:
| 2 | ||||||||||||||||||||||||
| 6850 | } | - | ||||||||||||||||||||||||
| 6851 | - | |||||||||||||||||||||||||
| 6852 | - | |||||||||||||||||||||||||
| 6853 | /*! | - | ||||||||||||||||||||||||
| 6854 | Returns the document type of this document. | - | ||||||||||||||||||||||||
| 6855 | */ | - | ||||||||||||||||||||||||
| 6856 | QDomDocumentType QDomDocument::doctype() const | - | ||||||||||||||||||||||||
| 6857 | { | - | ||||||||||||||||||||||||
| 6858 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6859 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 6860 | return QDomDocumentType(IMPL->doctype()); never executed: return QDomDocumentType(((QDomDocumentPrivate*)impl)->doctype()); | 0 | ||||||||||||||||||||||||
| 6861 | } | - | ||||||||||||||||||||||||
| 6862 | - | |||||||||||||||||||||||||
| 6863 | /*! | - | ||||||||||||||||||||||||
| 6864 | Returns a QDomImplementation object. | - | ||||||||||||||||||||||||
| 6865 | */ | - | ||||||||||||||||||||||||
| 6866 | QDomImplementation QDomDocument::implementation() const | - | ||||||||||||||||||||||||
| 6867 | { | - | ||||||||||||||||||||||||
| 6868 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6869 | return QDomImplementation(); never executed: return QDomImplementation(); | 0 | ||||||||||||||||||||||||
| 6870 | return QDomImplementation(IMPL->implementation()); never executed: return QDomImplementation(((QDomDocumentPrivate*)impl)->implementation()); | 0 | ||||||||||||||||||||||||
| 6871 | } | - | ||||||||||||||||||||||||
| 6872 | - | |||||||||||||||||||||||||
| 6873 | /*! | - | ||||||||||||||||||||||||
| 6874 | Returns the root element of the document. | - | ||||||||||||||||||||||||
| 6875 | */ | - | ||||||||||||||||||||||||
| 6876 | QDomElement QDomDocument::documentElement() const | - | ||||||||||||||||||||||||
| 6877 | { | - | ||||||||||||||||||||||||
| 6878 | if (!impl)
| 0-97 | ||||||||||||||||||||||||
| 6879 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 6880 | return QDomElement(IMPL->documentElement()); executed 97 times by 1 test: return QDomElement(((QDomDocumentPrivate*)impl)->documentElement());Executed by:
| 97 | ||||||||||||||||||||||||
| 6881 | } | - | ||||||||||||||||||||||||
| 6882 | - | |||||||||||||||||||||||||
| 6883 | /*! | - | ||||||||||||||||||||||||
| 6884 | Creates a new element called \a tagName that can be inserted into | - | ||||||||||||||||||||||||
| 6885 | the DOM tree, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6886 | - | |||||||||||||||||||||||||
| 6887 | If \a tagName is not a valid XML name, the behavior of this function is governed | - | ||||||||||||||||||||||||
| 6888 | by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6889 | - | |||||||||||||||||||||||||
| 6890 | \sa createElementNS(), QDomNode::appendChild(), QDomNode::insertBefore(), | - | ||||||||||||||||||||||||
| 6891 | QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6892 | */ | - | ||||||||||||||||||||||||
| 6893 | QDomElement QDomDocument::createElement(const QString& tagName) | - | ||||||||||||||||||||||||
| 6894 | { | - | ||||||||||||||||||||||||
| 6895 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6896 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6897 | return QDomElement(IMPL->createElement(tagName)); never executed: return QDomElement(((QDomDocumentPrivate*)impl)->createElement(tagName)); | 0 | ||||||||||||||||||||||||
| 6898 | } | - | ||||||||||||||||||||||||
| 6899 | - | |||||||||||||||||||||||||
| 6900 | /*! | - | ||||||||||||||||||||||||
| 6901 | Creates a new document fragment, that can be used to hold parts of | - | ||||||||||||||||||||||||
| 6902 | the document, e.g. when doing complex manipulations of the | - | ||||||||||||||||||||||||
| 6903 | document tree. | - | ||||||||||||||||||||||||
| 6904 | */ | - | ||||||||||||||||||||||||
| 6905 | QDomDocumentFragment QDomDocument::createDocumentFragment() | - | ||||||||||||||||||||||||
| 6906 | { | - | ||||||||||||||||||||||||
| 6907 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6908 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6909 | return QDomDocumentFragment(IMPL->createDocumentFragment()); never executed: return QDomDocumentFragment(((QDomDocumentPrivate*)impl)->createDocumentFragment()); | 0 | ||||||||||||||||||||||||
| 6910 | } | - | ||||||||||||||||||||||||
| 6911 | - | |||||||||||||||||||||||||
| 6912 | /*! | - | ||||||||||||||||||||||||
| 6913 | Creates a text node for the string \a value that can be inserted | - | ||||||||||||||||||||||||
| 6914 | into the document tree, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6915 | - | |||||||||||||||||||||||||
| 6916 | If \a value contains characters which cannot be stored as character | - | ||||||||||||||||||||||||
| 6917 | data of an XML document (even in the form of character references), the | - | ||||||||||||||||||||||||
| 6918 | behavior of this function is governed by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6919 | - | |||||||||||||||||||||||||
| 6920 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6921 | */ | - | ||||||||||||||||||||||||
| 6922 | QDomText QDomDocument::createTextNode(const QString& value) | - | ||||||||||||||||||||||||
| 6923 | { | - | ||||||||||||||||||||||||
| 6924 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6925 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6926 | return QDomText(IMPL->createTextNode(value)); never executed: return QDomText(((QDomDocumentPrivate*)impl)->createTextNode(value)); | 0 | ||||||||||||||||||||||||
| 6927 | } | - | ||||||||||||||||||||||||
| 6928 | - | |||||||||||||||||||||||||
| 6929 | /*! | - | ||||||||||||||||||||||||
| 6930 | Creates a new comment for the string \a value that can be inserted | - | ||||||||||||||||||||||||
| 6931 | into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6932 | - | |||||||||||||||||||||||||
| 6933 | If \a value contains characters which cannot be stored in an XML comment, | - | ||||||||||||||||||||||||
| 6934 | the behavior of this function is governed by QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6935 | - | |||||||||||||||||||||||||
| 6936 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6937 | */ | - | ||||||||||||||||||||||||
| 6938 | QDomComment QDomDocument::createComment(const QString& value) | - | ||||||||||||||||||||||||
| 6939 | { | - | ||||||||||||||||||||||||
| 6940 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6941 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6942 | return QDomComment(IMPL->createComment(value)); never executed: return QDomComment(((QDomDocumentPrivate*)impl)->createComment(value)); | 0 | ||||||||||||||||||||||||
| 6943 | } | - | ||||||||||||||||||||||||
| 6944 | - | |||||||||||||||||||||||||
| 6945 | /*! | - | ||||||||||||||||||||||||
| 6946 | Creates a new CDATA section for the string \a value that can be | - | ||||||||||||||||||||||||
| 6947 | inserted into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 6948 | - | |||||||||||||||||||||||||
| 6949 | If \a value contains characters which cannot be stored in a CDATA section, | - | ||||||||||||||||||||||||
| 6950 | the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6951 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6952 | - | |||||||||||||||||||||||||
| 6953 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6954 | */ | - | ||||||||||||||||||||||||
| 6955 | QDomCDATASection QDomDocument::createCDATASection(const QString& value) | - | ||||||||||||||||||||||||
| 6956 | { | - | ||||||||||||||||||||||||
| 6957 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6958 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6959 | return QDomCDATASection(IMPL->createCDATASection(value)); never executed: return QDomCDATASection(((QDomDocumentPrivate*)impl)->createCDATASection(value)); | 0 | ||||||||||||||||||||||||
| 6960 | } | - | ||||||||||||||||||||||||
| 6961 | - | |||||||||||||||||||||||||
| 6962 | /*! | - | ||||||||||||||||||||||||
| 6963 | Creates a new processing instruction that can be inserted into the | - | ||||||||||||||||||||||||
| 6964 | document, e.g. using QDomNode::appendChild(). This function sets | - | ||||||||||||||||||||||||
| 6965 | the target for the processing instruction to \a target and the | - | ||||||||||||||||||||||||
| 6966 | data to \a data. | - | ||||||||||||||||||||||||
| 6967 | - | |||||||||||||||||||||||||
| 6968 | If \a target is not a valid XML name, or data if contains characters which cannot | - | ||||||||||||||||||||||||
| 6969 | appear in a processing instruction, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6970 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6971 | - | |||||||||||||||||||||||||
| 6972 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 6973 | */ | - | ||||||||||||||||||||||||
| 6974 | QDomProcessingInstruction QDomDocument::createProcessingInstruction(const QString& target, | - | ||||||||||||||||||||||||
| 6975 | const QString& data) | - | ||||||||||||||||||||||||
| 6976 | { | - | ||||||||||||||||||||||||
| 6977 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6978 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6979 | return QDomProcessingInstruction(IMPL->createProcessingInstruction(target, data)); never executed: return QDomProcessingInstruction(((QDomDocumentPrivate*)impl)->createProcessingInstruction(target, data)); | 0 | ||||||||||||||||||||||||
| 6980 | } | - | ||||||||||||||||||||||||
| 6981 | - | |||||||||||||||||||||||||
| 6982 | - | |||||||||||||||||||||||||
| 6983 | /*! | - | ||||||||||||||||||||||||
| 6984 | Creates a new attribute called \a name that can be inserted into | - | ||||||||||||||||||||||||
| 6985 | an element, e.g. using QDomElement::setAttributeNode(). | - | ||||||||||||||||||||||||
| 6986 | - | |||||||||||||||||||||||||
| 6987 | If \a name is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 6988 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 6989 | - | |||||||||||||||||||||||||
| 6990 | \sa createAttributeNS() | - | ||||||||||||||||||||||||
| 6991 | */ | - | ||||||||||||||||||||||||
| 6992 | QDomAttr QDomDocument::createAttribute(const QString& name) | - | ||||||||||||||||||||||||
| 6993 | { | - | ||||||||||||||||||||||||
| 6994 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 6995 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 6996 | return QDomAttr(IMPL->createAttribute(name)); never executed: return QDomAttr(((QDomDocumentPrivate*)impl)->createAttribute(name)); | 0 | ||||||||||||||||||||||||
| 6997 | } | - | ||||||||||||||||||||||||
| 6998 | - | |||||||||||||||||||||||||
| 6999 | /*! | - | ||||||||||||||||||||||||
| 7000 | Creates a new entity reference called \a name that can be inserted | - | ||||||||||||||||||||||||
| 7001 | into the document, e.g. using QDomNode::appendChild(). | - | ||||||||||||||||||||||||
| 7002 | - | |||||||||||||||||||||||||
| 7003 | If \a name is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 7004 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 7005 | - | |||||||||||||||||||||||||
| 7006 | \sa QDomNode::appendChild(), QDomNode::insertBefore(), QDomNode::insertAfter() | - | ||||||||||||||||||||||||
| 7007 | */ | - | ||||||||||||||||||||||||
| 7008 | QDomEntityReference QDomDocument::createEntityReference(const QString& name) | - | ||||||||||||||||||||||||
| 7009 | { | - | ||||||||||||||||||||||||
| 7010 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7011 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7012 | return QDomEntityReference(IMPL->createEntityReference(name)); never executed: return QDomEntityReference(((QDomDocumentPrivate*)impl)->createEntityReference(name)); | 0 | ||||||||||||||||||||||||
| 7013 | } | - | ||||||||||||||||||||||||
| 7014 | - | |||||||||||||||||||||||||
| 7015 | /*! | - | ||||||||||||||||||||||||
| 7016 | Returns a QDomNodeList, that contains all the elements in the | - | ||||||||||||||||||||||||
| 7017 | document with the name \a tagname. The order of the node list is | - | ||||||||||||||||||||||||
| 7018 | the order they are encountered in a preorder traversal of the | - | ||||||||||||||||||||||||
| 7019 | element tree. | - | ||||||||||||||||||||||||
| 7020 | - | |||||||||||||||||||||||||
| 7021 | \sa elementsByTagNameNS(), QDomElement::elementsByTagName() | - | ||||||||||||||||||||||||
| 7022 | */ | - | ||||||||||||||||||||||||
| 7023 | QDomNodeList QDomDocument::elementsByTagName(const QString& tagname) const | - | ||||||||||||||||||||||||
| 7024 | { | - | ||||||||||||||||||||||||
| 7025 | return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, tagname)); | 0 | ||||||||||||||||||||||||
| 7026 | } | - | ||||||||||||||||||||||||
| 7027 | - | |||||||||||||||||||||||||
| 7028 | /*! | - | ||||||||||||||||||||||||
| 7029 | Imports the node \a importedNode from another document to this | - | ||||||||||||||||||||||||
| 7030 | document. \a importedNode remains in the original document; this | - | ||||||||||||||||||||||||
| 7031 | function creates a copy that can be used within this document. | - | ||||||||||||||||||||||||
| 7032 | - | |||||||||||||||||||||||||
| 7033 | This function returns the imported node that belongs to this | - | ||||||||||||||||||||||||
| 7034 | document. The returned node has no parent. It is not possible to | - | ||||||||||||||||||||||||
| 7035 | import QDomDocument and QDomDocumentType nodes. In those cases | - | ||||||||||||||||||||||||
| 7036 | this function returns a \l{QDomNode::isNull()}{null node}. | - | ||||||||||||||||||||||||
| 7037 | - | |||||||||||||||||||||||||
| 7038 | If \a importedNode is a \l{QDomNode::isNull()}{null node}, | - | ||||||||||||||||||||||||
| 7039 | a null node is returned. | - | ||||||||||||||||||||||||
| 7040 | - | |||||||||||||||||||||||||
| 7041 | If \a deep is true, this function imports not only the node \a | - | ||||||||||||||||||||||||
| 7042 | importedNode but its whole subtree; if it is false, only the \a | - | ||||||||||||||||||||||||
| 7043 | importedNode is imported. The argument \a deep has no effect on | - | ||||||||||||||||||||||||
| 7044 | QDomAttr and QDomEntityReference nodes, since the descendants of | - | ||||||||||||||||||||||||
| 7045 | QDomAttr nodes are always imported and those of | - | ||||||||||||||||||||||||
| 7046 | QDomEntityReference nodes are never imported. | - | ||||||||||||||||||||||||
| 7047 | - | |||||||||||||||||||||||||
| 7048 | The behavior of this function is slightly different depending on | - | ||||||||||||||||||||||||
| 7049 | the node types: | - | ||||||||||||||||||||||||
| 7050 | \table | - | ||||||||||||||||||||||||
| 7051 | \header \li Node Type \li Behavior | - | ||||||||||||||||||||||||
| 7052 | \row \li QDomAttr | - | ||||||||||||||||||||||||
| 7053 | \li The owner element is set to 0 and the specified flag is | - | ||||||||||||||||||||||||
| 7054 | set to true in the generated attribute. The whole subtree | - | ||||||||||||||||||||||||
| 7055 | of \a importedNode is always imported for attribute nodes: | - | ||||||||||||||||||||||||
| 7056 | \a deep has no effect. | - | ||||||||||||||||||||||||
| 7057 | \row \li QDomDocument | - | ||||||||||||||||||||||||
| 7058 | \li Document nodes cannot be imported. | - | ||||||||||||||||||||||||
| 7059 | \row \li QDomDocumentFragment | - | ||||||||||||||||||||||||
| 7060 | \li If \a deep is true, this function imports the whole | - | ||||||||||||||||||||||||
| 7061 | document fragment; otherwise it only generates an empty | - | ||||||||||||||||||||||||
| 7062 | document fragment. | - | ||||||||||||||||||||||||
| 7063 | \row \li QDomDocumentType | - | ||||||||||||||||||||||||
| 7064 | \li Document type nodes cannot be imported. | - | ||||||||||||||||||||||||
| 7065 | \row \li QDomElement | - | ||||||||||||||||||||||||
| 7066 | \li Attributes for which QDomAttr::specified() is true are | - | ||||||||||||||||||||||||
| 7067 | also imported, other attributes are not imported. If \a | - | ||||||||||||||||||||||||
| 7068 | deep is true, this function also imports the subtree of \a | - | ||||||||||||||||||||||||
| 7069 | importedNode; otherwise it imports only the element node | - | ||||||||||||||||||||||||
| 7070 | (and some attributes, see above). | - | ||||||||||||||||||||||||
| 7071 | \row \li QDomEntity | - | ||||||||||||||||||||||||
| 7072 | \li Entity nodes can be imported, but at the moment there is | - | ||||||||||||||||||||||||
| 7073 | no way to use them since the document type is read-only in | - | ||||||||||||||||||||||||
| 7074 | DOM level 2. | - | ||||||||||||||||||||||||
| 7075 | \row \li QDomEntityReference | - | ||||||||||||||||||||||||
| 7076 | \li Descendants of entity reference nodes are never imported: | - | ||||||||||||||||||||||||
| 7077 | \a deep has no effect. | - | ||||||||||||||||||||||||
| 7078 | \row \li QDomNotation | - | ||||||||||||||||||||||||
| 7079 | \li Notation nodes can be imported, but at the moment there is | - | ||||||||||||||||||||||||
| 7080 | no way to use them since the document type is read-only in | - | ||||||||||||||||||||||||
| 7081 | DOM level 2. | - | ||||||||||||||||||||||||
| 7082 | \row \li QDomProcessingInstruction | - | ||||||||||||||||||||||||
| 7083 | \li The target and value of the processing instruction is | - | ||||||||||||||||||||||||
| 7084 | copied to the new node. | - | ||||||||||||||||||||||||
| 7085 | \row \li QDomText | - | ||||||||||||||||||||||||
| 7086 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7087 | \row \li QDomCDATASection | - | ||||||||||||||||||||||||
| 7088 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7089 | \row \li QDomComment | - | ||||||||||||||||||||||||
| 7090 | \li The text is copied to the new node. | - | ||||||||||||||||||||||||
| 7091 | \endtable | - | ||||||||||||||||||||||||
| 7092 | - | |||||||||||||||||||||||||
| 7093 | \sa QDomElement::setAttribute(), QDomNode::insertBefore(), | - | ||||||||||||||||||||||||
| 7094 | QDomNode::insertAfter(), QDomNode::replaceChild(), QDomNode::removeChild(), | - | ||||||||||||||||||||||||
| 7095 | QDomNode::appendChild() | - | ||||||||||||||||||||||||
| 7096 | */ | - | ||||||||||||||||||||||||
| 7097 | QDomNode QDomDocument::importNode(const QDomNode& importedNode, bool deep) | - | ||||||||||||||||||||||||
| 7098 | { | - | ||||||||||||||||||||||||
| 7099 | if (importedNode.isNull())
| 0 | ||||||||||||||||||||||||
| 7100 | return QDomNode(); never executed: return QDomNode(); | 0 | ||||||||||||||||||||||||
| 7101 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7102 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7103 | return QDomNode(IMPL->importNode(importedNode.impl, deep)); never executed: return QDomNode(((QDomDocumentPrivate*)impl)->importNode(importedNode.impl, deep)); | 0 | ||||||||||||||||||||||||
| 7104 | } | - | ||||||||||||||||||||||||
| 7105 | - | |||||||||||||||||||||||||
| 7106 | /*! | - | ||||||||||||||||||||||||
| 7107 | Creates a new element with namespace support that can be inserted | - | ||||||||||||||||||||||||
| 7108 | into the DOM tree. The name of the element is \a qName and the | - | ||||||||||||||||||||||||
| 7109 | namespace URI is \a nsURI. This function also sets | - | ||||||||||||||||||||||||
| 7110 | QDomNode::prefix() and QDomNode::localName() to appropriate values | - | ||||||||||||||||||||||||
| 7111 | (depending on \a qName). | - | ||||||||||||||||||||||||
| 7112 | - | |||||||||||||||||||||||||
| 7113 | If \a qName is an empty string, returns a null element regardless of | - | ||||||||||||||||||||||||
| 7114 | whether the invalid data policy is set. | - | ||||||||||||||||||||||||
| 7115 | - | |||||||||||||||||||||||||
| 7116 | \sa createElement() | - | ||||||||||||||||||||||||
| 7117 | */ | - | ||||||||||||||||||||||||
| 7118 | QDomElement QDomDocument::createElementNS(const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 7119 | { | - | ||||||||||||||||||||||||
| 7120 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7121 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7122 | return QDomElement(IMPL->createElementNS(nsURI, qName)); never executed: return QDomElement(((QDomDocumentPrivate*)impl)->createElementNS(nsURI, qName)); | 0 | ||||||||||||||||||||||||
| 7123 | } | - | ||||||||||||||||||||||||
| 7124 | - | |||||||||||||||||||||||||
| 7125 | /*! | - | ||||||||||||||||||||||||
| 7126 | Creates a new attribute with namespace support that can be | - | ||||||||||||||||||||||||
| 7127 | inserted into an element. The name of the attribute is \a qName | - | ||||||||||||||||||||||||
| 7128 | and the namespace URI is \a nsURI. This function also sets | - | ||||||||||||||||||||||||
| 7129 | QDomNode::prefix() and QDomNode::localName() to appropriate values | - | ||||||||||||||||||||||||
| 7130 | (depending on \a qName). | - | ||||||||||||||||||||||||
| 7131 | - | |||||||||||||||||||||||||
| 7132 | If \a qName is not a valid XML name, the behavior of this function is governed by | - | ||||||||||||||||||||||||
| 7133 | QDomImplementation::InvalidDataPolicy. | - | ||||||||||||||||||||||||
| 7134 | - | |||||||||||||||||||||||||
| 7135 | \sa createAttribute() | - | ||||||||||||||||||||||||
| 7136 | */ | - | ||||||||||||||||||||||||
| 7137 | QDomAttr QDomDocument::createAttributeNS(const QString& nsURI, const QString& qName) | - | ||||||||||||||||||||||||
| 7138 | { | - | ||||||||||||||||||||||||
| 7139 | if (!impl)
| 0 | ||||||||||||||||||||||||
| 7140 | impl = new QDomDocumentPrivate(); never executed: impl = new QDomDocumentPrivate(); | 0 | ||||||||||||||||||||||||
| 7141 | return QDomAttr(IMPL->createAttributeNS(nsURI, qName)); never executed: return QDomAttr(((QDomDocumentPrivate*)impl)->createAttributeNS(nsURI, qName)); | 0 | ||||||||||||||||||||||||
| 7142 | } | - | ||||||||||||||||||||||||
| 7143 | - | |||||||||||||||||||||||||
| 7144 | /*! | - | ||||||||||||||||||||||||
| 7145 | Returns a QDomNodeList that contains all the elements in the | - | ||||||||||||||||||||||||
| 7146 | document with the local name \a localName and a namespace URI of | - | ||||||||||||||||||||||||
| 7147 | \a nsURI. The order of the node list is the order they are | - | ||||||||||||||||||||||||
| 7148 | encountered in a preorder traversal of the element tree. | - | ||||||||||||||||||||||||
| 7149 | - | |||||||||||||||||||||||||
| 7150 | \sa elementsByTagName(), QDomElement::elementsByTagNameNS() | - | ||||||||||||||||||||||||
| 7151 | */ | - | ||||||||||||||||||||||||
| 7152 | QDomNodeList QDomDocument::elementsByTagNameNS(const QString& nsURI, const QString& localName) | - | ||||||||||||||||||||||||
| 7153 | { | - | ||||||||||||||||||||||||
| 7154 | return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); never executed: return QDomNodeList(new QDomNodeListPrivate(impl, nsURI, localName)); | 0 | ||||||||||||||||||||||||
| 7155 | } | - | ||||||||||||||||||||||||
| 7156 | - | |||||||||||||||||||||||||
| 7157 | /*! | - | ||||||||||||||||||||||||
| 7158 | Returns the element whose ID is equal to \a elementId. If no | - | ||||||||||||||||||||||||
| 7159 | element with the ID was found, this function returns a | - | ||||||||||||||||||||||||
| 7160 | \l{QDomNode::isNull()}{null element}. | - | ||||||||||||||||||||||||
| 7161 | - | |||||||||||||||||||||||||
| 7162 | Since the QDomClasses do not know which attributes are element | - | ||||||||||||||||||||||||
| 7163 | IDs, this function returns always a | - | ||||||||||||||||||||||||
| 7164 | \l{QDomNode::isNull()}{null element}. | - | ||||||||||||||||||||||||
| 7165 | This may change in a future version. | - | ||||||||||||||||||||||||
| 7166 | */ | - | ||||||||||||||||||||||||
| 7167 | QDomElement QDomDocument::elementById(const QString& /*elementId*/) | - | ||||||||||||||||||||||||
| 7168 | { | - | ||||||||||||||||||||||||
| 7169 | qWarning("elementById() is not implemented and will always return a null node."); | - | ||||||||||||||||||||||||
| 7170 | return QDomElement(); never executed: return QDomElement(); | 0 | ||||||||||||||||||||||||
| 7171 | } | - | ||||||||||||||||||||||||
| 7172 | - | |||||||||||||||||||||||||
| 7173 | /*! | - | ||||||||||||||||||||||||
| 7174 | \fn QDomNode::NodeType QDomDocument::nodeType() const | - | ||||||||||||||||||||||||
| 7175 | - | |||||||||||||||||||||||||
| 7176 | Returns \c DocumentNode. | - | ||||||||||||||||||||||||
| 7177 | */ | - | ||||||||||||||||||||||||
| 7178 | - | |||||||||||||||||||||||||
| 7179 | #undef IMPL | - | ||||||||||||||||||||||||
| 7180 | - | |||||||||||||||||||||||||
| 7181 | /************************************************************** | - | ||||||||||||||||||||||||
| 7182 | * | - | ||||||||||||||||||||||||
| 7183 | * Node casting functions | - | ||||||||||||||||||||||||
| 7184 | * | - | ||||||||||||||||||||||||
| 7185 | **************************************************************/ | - | ||||||||||||||||||||||||
| 7186 | - | |||||||||||||||||||||||||
| 7187 | /*! | - | ||||||||||||||||||||||||
| 7188 | Converts a QDomNode into a QDomAttr. If the node is not an | - | ||||||||||||||||||||||||
| 7189 | attribute, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7190 | - | |||||||||||||||||||||||||
| 7191 | \sa isAttr() | - | ||||||||||||||||||||||||
| 7192 | */ | - | ||||||||||||||||||||||||
| 7193 | QDomAttr QDomNode::toAttr() const | - | ||||||||||||||||||||||||
| 7194 | { | - | ||||||||||||||||||||||||
| 7195 | if (impl && impl->isAttr())
| 0 | ||||||||||||||||||||||||
| 7196 | return QDomAttr(((QDomAttrPrivate*)impl)); never executed: return QDomAttr(((QDomAttrPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7197 | return QDomAttr(); never executed: return QDomAttr(); | 0 | ||||||||||||||||||||||||
| 7198 | } | - | ||||||||||||||||||||||||
| 7199 | - | |||||||||||||||||||||||||
| 7200 | /*! | - | ||||||||||||||||||||||||
| 7201 | Converts a QDomNode into a QDomCDATASection. If the node is not a | - | ||||||||||||||||||||||||
| 7202 | CDATA section, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7203 | - | |||||||||||||||||||||||||
| 7204 | \sa isCDATASection() | - | ||||||||||||||||||||||||
| 7205 | */ | - | ||||||||||||||||||||||||
| 7206 | QDomCDATASection QDomNode::toCDATASection() const | - | ||||||||||||||||||||||||
| 7207 | { | - | ||||||||||||||||||||||||
| 7208 | if (impl && impl->isCDATASection())
| 0 | ||||||||||||||||||||||||
| 7209 | return QDomCDATASection(((QDomCDATASectionPrivate*)impl)); never executed: return QDomCDATASection(((QDomCDATASectionPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7210 | return QDomCDATASection(); never executed: return QDomCDATASection(); | 0 | ||||||||||||||||||||||||
| 7211 | } | - | ||||||||||||||||||||||||
| 7212 | - | |||||||||||||||||||||||||
| 7213 | /*! | - | ||||||||||||||||||||||||
| 7214 | Converts a QDomNode into a QDomDocumentFragment. If the node is | - | ||||||||||||||||||||||||
| 7215 | not a document fragment the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7216 | - | |||||||||||||||||||||||||
| 7217 | \sa isDocumentFragment() | - | ||||||||||||||||||||||||
| 7218 | */ | - | ||||||||||||||||||||||||
| 7219 | QDomDocumentFragment QDomNode::toDocumentFragment() const | - | ||||||||||||||||||||||||
| 7220 | { | - | ||||||||||||||||||||||||
| 7221 | if (impl && impl->isDocumentFragment())
| 0 | ||||||||||||||||||||||||
| 7222 | return QDomDocumentFragment(((QDomDocumentFragmentPrivate*)impl)); never executed: return QDomDocumentFragment(((QDomDocumentFragmentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7223 | return QDomDocumentFragment(); never executed: return QDomDocumentFragment(); | 0 | ||||||||||||||||||||||||
| 7224 | } | - | ||||||||||||||||||||||||
| 7225 | - | |||||||||||||||||||||||||
| 7226 | /*! | - | ||||||||||||||||||||||||
| 7227 | Converts a QDomNode into a QDomDocument. If the node is not a | - | ||||||||||||||||||||||||
| 7228 | document the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7229 | - | |||||||||||||||||||||||||
| 7230 | \sa isDocument() | - | ||||||||||||||||||||||||
| 7231 | */ | - | ||||||||||||||||||||||||
| 7232 | QDomDocument QDomNode::toDocument() const | - | ||||||||||||||||||||||||
| 7233 | { | - | ||||||||||||||||||||||||
| 7234 | if (impl && impl->isDocument())
| 0 | ||||||||||||||||||||||||
| 7235 | return QDomDocument(((QDomDocumentPrivate*)impl)); never executed: return QDomDocument(((QDomDocumentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7236 | return QDomDocument(); never executed: return QDomDocument(); | 0 | ||||||||||||||||||||||||
| 7237 | } | - | ||||||||||||||||||||||||
| 7238 | - | |||||||||||||||||||||||||
| 7239 | /*! | - | ||||||||||||||||||||||||
| 7240 | Converts a QDomNode into a QDomDocumentType. If the node is not a | - | ||||||||||||||||||||||||
| 7241 | document type the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7242 | - | |||||||||||||||||||||||||
| 7243 | \sa isDocumentType() | - | ||||||||||||||||||||||||
| 7244 | */ | - | ||||||||||||||||||||||||
| 7245 | QDomDocumentType QDomNode::toDocumentType() const | - | ||||||||||||||||||||||||
| 7246 | { | - | ||||||||||||||||||||||||
| 7247 | if (impl && impl->isDocumentType())
| 0 | ||||||||||||||||||||||||
| 7248 | return QDomDocumentType(((QDomDocumentTypePrivate*)impl)); never executed: return QDomDocumentType(((QDomDocumentTypePrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7249 | return QDomDocumentType(); never executed: return QDomDocumentType(); | 0 | ||||||||||||||||||||||||
| 7250 | } | - | ||||||||||||||||||||||||
| 7251 | - | |||||||||||||||||||||||||
| 7252 | /*! | - | ||||||||||||||||||||||||
| 7253 | Converts a QDomNode into a QDomElement. If the node is not an | - | ||||||||||||||||||||||||
| 7254 | element the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7255 | - | |||||||||||||||||||||||||
| 7256 | \sa isElement() | - | ||||||||||||||||||||||||
| 7257 | */ | - | ||||||||||||||||||||||||
| 7258 | QDomElement QDomNode::toElement() const | - | ||||||||||||||||||||||||
| 7259 | { | - | ||||||||||||||||||||||||
| 7260 | if (impl && impl->isElement())
| 0-162 | ||||||||||||||||||||||||
| 7261 | return QDomElement(((QDomElementPrivate*)impl)); executed 159 times by 1 test: return QDomElement(((QDomElementPrivate*)impl));Executed by:
| 159 | ||||||||||||||||||||||||
| 7262 | return QDomElement(); executed 3 times by 1 test: return QDomElement();Executed by:
| 3 | ||||||||||||||||||||||||
| 7263 | } | - | ||||||||||||||||||||||||
| 7264 | - | |||||||||||||||||||||||||
| 7265 | /*! | - | ||||||||||||||||||||||||
| 7266 | Converts a QDomNode into a QDomEntityReference. If the node is not | - | ||||||||||||||||||||||||
| 7267 | an entity reference, the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7268 | - | |||||||||||||||||||||||||
| 7269 | \sa isEntityReference() | - | ||||||||||||||||||||||||
| 7270 | */ | - | ||||||||||||||||||||||||
| 7271 | QDomEntityReference QDomNode::toEntityReference() const | - | ||||||||||||||||||||||||
| 7272 | { | - | ||||||||||||||||||||||||
| 7273 | if (impl && impl->isEntityReference())
| 0 | ||||||||||||||||||||||||
| 7274 | return QDomEntityReference(((QDomEntityReferencePrivate*)impl)); never executed: return QDomEntityReference(((QDomEntityReferencePrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7275 | return QDomEntityReference(); never executed: return QDomEntityReference(); | 0 | ||||||||||||||||||||||||
| 7276 | } | - | ||||||||||||||||||||||||
| 7277 | - | |||||||||||||||||||||||||
| 7278 | /*! | - | ||||||||||||||||||||||||
| 7279 | Converts a QDomNode into a QDomText. If the node is not a text, | - | ||||||||||||||||||||||||
| 7280 | the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7281 | - | |||||||||||||||||||||||||
| 7282 | \sa isText() | - | ||||||||||||||||||||||||
| 7283 | */ | - | ||||||||||||||||||||||||
| 7284 | QDomText QDomNode::toText() const | - | ||||||||||||||||||||||||
| 7285 | { | - | ||||||||||||||||||||||||
| 7286 | if (impl && impl->isText())
| 0 | ||||||||||||||||||||||||
| 7287 | return QDomText(((QDomTextPrivate*)impl)); never executed: return QDomText(((QDomTextPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7288 | return QDomText(); never executed: return QDomText(); | 0 | ||||||||||||||||||||||||
| 7289 | } | - | ||||||||||||||||||||||||
| 7290 | - | |||||||||||||||||||||||||
| 7291 | /*! | - | ||||||||||||||||||||||||
| 7292 | Converts a QDomNode into a QDomEntity. If the node is not an | - | ||||||||||||||||||||||||
| 7293 | entity the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7294 | - | |||||||||||||||||||||||||
| 7295 | \sa isEntity() | - | ||||||||||||||||||||||||
| 7296 | */ | - | ||||||||||||||||||||||||
| 7297 | QDomEntity QDomNode::toEntity() const | - | ||||||||||||||||||||||||
| 7298 | { | - | ||||||||||||||||||||||||
| 7299 | if (impl && impl->isEntity())
| 0 | ||||||||||||||||||||||||
| 7300 | return QDomEntity(((QDomEntityPrivate*)impl)); never executed: return QDomEntity(((QDomEntityPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7301 | return QDomEntity(); never executed: return QDomEntity(); | 0 | ||||||||||||||||||||||||
| 7302 | } | - | ||||||||||||||||||||||||
| 7303 | - | |||||||||||||||||||||||||
| 7304 | /*! | - | ||||||||||||||||||||||||
| 7305 | Converts a QDomNode into a QDomNotation. If the node is not a | - | ||||||||||||||||||||||||
| 7306 | notation the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7307 | - | |||||||||||||||||||||||||
| 7308 | \sa isNotation() | - | ||||||||||||||||||||||||
| 7309 | */ | - | ||||||||||||||||||||||||
| 7310 | QDomNotation QDomNode::toNotation() const | - | ||||||||||||||||||||||||
| 7311 | { | - | ||||||||||||||||||||||||
| 7312 | if (impl && impl->isNotation())
| 0 | ||||||||||||||||||||||||
| 7313 | return QDomNotation(((QDomNotationPrivate*)impl)); never executed: return QDomNotation(((QDomNotationPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7314 | return QDomNotation(); never executed: return QDomNotation(); | 0 | ||||||||||||||||||||||||
| 7315 | } | - | ||||||||||||||||||||||||
| 7316 | - | |||||||||||||||||||||||||
| 7317 | /*! | - | ||||||||||||||||||||||||
| 7318 | Converts a QDomNode into a QDomProcessingInstruction. If the node | - | ||||||||||||||||||||||||
| 7319 | is not a processing instruction the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7320 | - | |||||||||||||||||||||||||
| 7321 | \sa isProcessingInstruction() | - | ||||||||||||||||||||||||
| 7322 | */ | - | ||||||||||||||||||||||||
| 7323 | QDomProcessingInstruction QDomNode::toProcessingInstruction() const | - | ||||||||||||||||||||||||
| 7324 | { | - | ||||||||||||||||||||||||
| 7325 | if (impl && impl->isProcessingInstruction())
| 0 | ||||||||||||||||||||||||
| 7326 | return QDomProcessingInstruction(((QDomProcessingInstructionPrivate*)impl)); never executed: return QDomProcessingInstruction(((QDomProcessingInstructionPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7327 | return QDomProcessingInstruction(); never executed: return QDomProcessingInstruction(); | 0 | ||||||||||||||||||||||||
| 7328 | } | - | ||||||||||||||||||||||||
| 7329 | - | |||||||||||||||||||||||||
| 7330 | /*! | - | ||||||||||||||||||||||||
| 7331 | Converts a QDomNode into a QDomCharacterData. If the node is not a | - | ||||||||||||||||||||||||
| 7332 | character data node the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7333 | - | |||||||||||||||||||||||||
| 7334 | \sa isCharacterData() | - | ||||||||||||||||||||||||
| 7335 | */ | - | ||||||||||||||||||||||||
| 7336 | QDomCharacterData QDomNode::toCharacterData() const | - | ||||||||||||||||||||||||
| 7337 | { | - | ||||||||||||||||||||||||
| 7338 | if (impl && impl->isCharacterData())
| 0 | ||||||||||||||||||||||||
| 7339 | return QDomCharacterData(((QDomCharacterDataPrivate*)impl)); never executed: return QDomCharacterData(((QDomCharacterDataPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7340 | return QDomCharacterData(); never executed: return QDomCharacterData(); | 0 | ||||||||||||||||||||||||
| 7341 | } | - | ||||||||||||||||||||||||
| 7342 | - | |||||||||||||||||||||||||
| 7343 | /*! | - | ||||||||||||||||||||||||
| 7344 | Converts a QDomNode into a QDomComment. If the node is not a | - | ||||||||||||||||||||||||
| 7345 | comment the returned object will be \l{QDomNode::isNull()}{null}. | - | ||||||||||||||||||||||||
| 7346 | - | |||||||||||||||||||||||||
| 7347 | \sa isComment() | - | ||||||||||||||||||||||||
| 7348 | */ | - | ||||||||||||||||||||||||
| 7349 | QDomComment QDomNode::toComment() const | - | ||||||||||||||||||||||||
| 7350 | { | - | ||||||||||||||||||||||||
| 7351 | if (impl && impl->isComment())
| 0 | ||||||||||||||||||||||||
| 7352 | return QDomComment(((QDomCommentPrivate*)impl)); never executed: return QDomComment(((QDomCommentPrivate*)impl)); | 0 | ||||||||||||||||||||||||
| 7353 | return QDomComment(); never executed: return QDomComment(); | 0 | ||||||||||||||||||||||||
| 7354 | } | - | ||||||||||||||||||||||||
| 7355 | - | |||||||||||||||||||||||||
| 7356 | /************************************************************** | - | ||||||||||||||||||||||||
| 7357 | * | - | ||||||||||||||||||||||||
| 7358 | * QDomHandler | - | ||||||||||||||||||||||||
| 7359 | * | - | ||||||||||||||||||||||||
| 7360 | **************************************************************/ | - | ||||||||||||||||||||||||
| 7361 | - | |||||||||||||||||||||||||
| 7362 | QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, QXmlSimpleReader* areader, bool namespaceProcessing) | - | ||||||||||||||||||||||||
| 7363 | : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false), | - | ||||||||||||||||||||||||
| 7364 | nsProcessing(namespaceProcessing), locator(0), reader(areader) | - | ||||||||||||||||||||||||
| 7365 | { | - | ||||||||||||||||||||||||
| 7366 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 7367 | - | |||||||||||||||||||||||||
| 7368 | QDomHandler::~QDomHandler() | - | ||||||||||||||||||||||||
| 7369 | { | - | ||||||||||||||||||||||||
| 7370 | } | - | ||||||||||||||||||||||||
| 7371 | - | |||||||||||||||||||||||||
| 7372 | bool QDomHandler::endDocument() | - | ||||||||||||||||||||||||
| 7373 | { | - | ||||||||||||||||||||||||
| 7374 | // ### is this really necessary? (rms) | - | ||||||||||||||||||||||||
| 7375 | if (node != doc)
| 0-244 | ||||||||||||||||||||||||
| 7376 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7377 | return true; executed 244 times by 5 tests: return true;Executed by:
| 244 | ||||||||||||||||||||||||
| 7378 | } | - | ||||||||||||||||||||||||
| 7379 | - | |||||||||||||||||||||||||
| 7380 | bool QDomHandler::startDTD(const QString& name, const QString& publicId, const QString& systemId) | - | ||||||||||||||||||||||||
| 7381 | { | - | ||||||||||||||||||||||||
| 7382 | doc->doctype()->name = name; | - | ||||||||||||||||||||||||
| 7383 | doc->doctype()->publicId = publicId; | - | ||||||||||||||||||||||||
| 7384 | doc->doctype()->systemId = systemId; | - | ||||||||||||||||||||||||
| 7385 | return true; executed 157 times by 2 tests: return true;Executed by:
| 157 | ||||||||||||||||||||||||
| 7386 | } | - | ||||||||||||||||||||||||
| 7387 | - | |||||||||||||||||||||||||
| 7388 | bool QDomHandler::startElement(const QString& nsURI, const QString&, const QString& qName, const QXmlAttributes& atts) | - | ||||||||||||||||||||||||
| 7389 | { | - | ||||||||||||||||||||||||
| 7390 | // tag name | - | ||||||||||||||||||||||||
| 7391 | QDomNodePrivate* n; | - | ||||||||||||||||||||||||
| 7392 | if (nsProcessing) {
| 2-1021 | ||||||||||||||||||||||||
| 7393 | n = doc->createElementNS(nsURI, qName); | - | ||||||||||||||||||||||||
| 7394 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 7395 | n = doc->createElement(qName); | - | ||||||||||||||||||||||||
| 7396 | } executed 1021 times by 4 tests: end of blockExecuted by:
| 1021 | ||||||||||||||||||||||||
| 7397 | - | |||||||||||||||||||||||||
| 7398 | if (!n)
| 0-1023 | ||||||||||||||||||||||||
| 7399 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7400 | - | |||||||||||||||||||||||||
| 7401 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7402 | - | |||||||||||||||||||||||||
| 7403 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7404 | node = n; | - | ||||||||||||||||||||||||
| 7405 | - | |||||||||||||||||||||||||
| 7406 | // attributes | - | ||||||||||||||||||||||||
| 7407 | for (int i=0; i<atts.length(); i++)
| 868-1023 | ||||||||||||||||||||||||
| 7408 | { | - | ||||||||||||||||||||||||
| 7409 | if (nsProcessing) {
| 2-866 | ||||||||||||||||||||||||
| 7410 | ((QDomElementPrivate*)node)->setAttributeNS(atts.uri(i), atts.qName(i), atts.value(i)); | - | ||||||||||||||||||||||||
| 7411 | } else { executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 7412 | ((QDomElementPrivate*)node)->setAttribute(atts.qName(i), atts.value(i)); | - | ||||||||||||||||||||||||
| 7413 | } executed 866 times by 3 tests: end of blockExecuted by:
| 866 | ||||||||||||||||||||||||
| 7414 | } | - | ||||||||||||||||||||||||
| 7415 | - | |||||||||||||||||||||||||
| 7416 | return true; executed 1023 times by 5 tests: return true;Executed by:
| 1023 | ||||||||||||||||||||||||
| 7417 | } | - | ||||||||||||||||||||||||
| 7418 | - | |||||||||||||||||||||||||
| 7419 | bool QDomHandler::endElement(const QString&, const QString&, const QString&) | - | ||||||||||||||||||||||||
| 7420 | { | - | ||||||||||||||||||||||||
| 7421 | if (!node || node == doc)
| 0-1023 | ||||||||||||||||||||||||
| 7422 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7423 | node = node->parent(); | - | ||||||||||||||||||||||||
| 7424 | - | |||||||||||||||||||||||||
| 7425 | return true; executed 1023 times by 5 tests: return true;Executed by:
| 1023 | ||||||||||||||||||||||||
| 7426 | } | - | ||||||||||||||||||||||||
| 7427 | - | |||||||||||||||||||||||||
| 7428 | bool QDomHandler::characters(const QString& ch) | - | ||||||||||||||||||||||||
| 7429 | { | - | ||||||||||||||||||||||||
| 7430 | // No text as child of some document | - | ||||||||||||||||||||||||
| 7431 | if (node == doc)
| 0-125 | ||||||||||||||||||||||||
| 7432 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7433 | - | |||||||||||||||||||||||||
| 7434 | QScopedPointer<QDomNodePrivate> n; | - | ||||||||||||||||||||||||
| 7435 | if (cdata) {
| 0-125 | ||||||||||||||||||||||||
| 7436 | n.reset(doc->createCDATASection(ch)); | - | ||||||||||||||||||||||||
| 7437 | } else if (!entityName.isEmpty()) { never executed: end of block
| 0-125 | ||||||||||||||||||||||||
| 7438 | QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName, | - | ||||||||||||||||||||||||
| 7439 | QString(), QString(), QString())); | - | ||||||||||||||||||||||||
| 7440 | e->value = ch; | - | ||||||||||||||||||||||||
| 7441 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 7442 | doc->doctype()->appendChild(e.data()); | - | ||||||||||||||||||||||||
| 7443 | e.take(); | - | ||||||||||||||||||||||||
| 7444 | n.reset(doc->createEntityReference(entityName)); | - | ||||||||||||||||||||||||
| 7445 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 7446 | n.reset(doc->createTextNode(ch)); | - | ||||||||||||||||||||||||
| 7447 | } executed 125 times by 2 tests: end of blockExecuted by:
| 125 | ||||||||||||||||||||||||
| 7448 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7449 | node->appendChild(n.data()); | - | ||||||||||||||||||||||||
| 7450 | n.take(); | - | ||||||||||||||||||||||||
| 7451 | - | |||||||||||||||||||||||||
| 7452 | return true; executed 125 times by 2 tests: return true;Executed by:
| 125 | ||||||||||||||||||||||||
| 7453 | } | - | ||||||||||||||||||||||||
| 7454 | - | |||||||||||||||||||||||||
| 7455 | bool QDomHandler::processingInstruction(const QString& target, const QString& data) | - | ||||||||||||||||||||||||
| 7456 | { | - | ||||||||||||||||||||||||
| 7457 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 7458 | n = doc->createProcessingInstruction(target, data); | - | ||||||||||||||||||||||||
| 7459 | if (n) {
| 0 | ||||||||||||||||||||||||
| 7460 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7461 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7462 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7463 | } | - | ||||||||||||||||||||||||
| 7464 | else | - | ||||||||||||||||||||||||
| 7465 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||
| 7466 | } | - | ||||||||||||||||||||||||
| 7467 | - | |||||||||||||||||||||||||
| 7468 | bool QDomHandler::skippedEntity(const QString& name) | - | ||||||||||||||||||||||||
| 7469 | { | - | ||||||||||||||||||||||||
| 7470 | // we can only handle inserting entity references into content | - | ||||||||||||||||||||||||
| 7471 | if (reader && !reader->d_ptr->skipped_entity_in_content)
| 0 | ||||||||||||||||||||||||
| 7472 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7473 | - | |||||||||||||||||||||||||
| 7474 | QDomNodePrivate *n = doc->createEntityReference(name); | - | ||||||||||||||||||||||||
| 7475 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7476 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7477 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7478 | } | - | ||||||||||||||||||||||||
| 7479 | - | |||||||||||||||||||||||||
| 7480 | bool QDomHandler::fatalError(const QXmlParseException& exception) | - | ||||||||||||||||||||||||
| 7481 | { | - | ||||||||||||||||||||||||
| 7482 | errorMsg = exception.message(); | - | ||||||||||||||||||||||||
| 7483 | errorLine = exception.lineNumber(); | - | ||||||||||||||||||||||||
| 7484 | errorColumn = exception.columnNumber(); | - | ||||||||||||||||||||||||
| 7485 | return QXmlDefaultHandler::fatalError(exception); never executed: return QXmlDefaultHandler::fatalError(exception); | 0 | ||||||||||||||||||||||||
| 7486 | } | - | ||||||||||||||||||||||||
| 7487 | - | |||||||||||||||||||||||||
| 7488 | bool QDomHandler::startCDATA() | - | ||||||||||||||||||||||||
| 7489 | { | - | ||||||||||||||||||||||||
| 7490 | cdata = true; | - | ||||||||||||||||||||||||
| 7491 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7492 | } | - | ||||||||||||||||||||||||
| 7493 | - | |||||||||||||||||||||||||
| 7494 | bool QDomHandler::endCDATA() | - | ||||||||||||||||||||||||
| 7495 | { | - | ||||||||||||||||||||||||
| 7496 | cdata = false; | - | ||||||||||||||||||||||||
| 7497 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7498 | } | - | ||||||||||||||||||||||||
| 7499 | - | |||||||||||||||||||||||||
| 7500 | bool QDomHandler::startEntity(const QString &name) | - | ||||||||||||||||||||||||
| 7501 | { | - | ||||||||||||||||||||||||
| 7502 | entityName = name; | - | ||||||||||||||||||||||||
| 7503 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7504 | } | - | ||||||||||||||||||||||||
| 7505 | - | |||||||||||||||||||||||||
| 7506 | bool QDomHandler::endEntity(const QString &) | - | ||||||||||||||||||||||||
| 7507 | { | - | ||||||||||||||||||||||||
| 7508 | entityName.clear(); | - | ||||||||||||||||||||||||
| 7509 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7510 | } | - | ||||||||||||||||||||||||
| 7511 | - | |||||||||||||||||||||||||
| 7512 | bool QDomHandler::comment(const QString& ch) | - | ||||||||||||||||||||||||
| 7513 | { | - | ||||||||||||||||||||||||
| 7514 | QDomNodePrivate *n; | - | ||||||||||||||||||||||||
| 7515 | n = doc->createComment(ch); | - | ||||||||||||||||||||||||
| 7516 | n->setLocation(locator->lineNumber(), locator->columnNumber()); | - | ||||||||||||||||||||||||
| 7517 | node->appendChild(n); | - | ||||||||||||||||||||||||
| 7518 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7519 | } | - | ||||||||||||||||||||||||
| 7520 | - | |||||||||||||||||||||||||
| 7521 | bool QDomHandler::unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString ¬ationName) | - | ||||||||||||||||||||||||
| 7522 | { | - | ||||||||||||||||||||||||
| 7523 | QDomEntityPrivate* e = new QDomEntityPrivate(doc, 0, name, | - | ||||||||||||||||||||||||
| 7524 | publicId, systemId, notationName); | - | ||||||||||||||||||||||||
| 7525 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 7526 | e->ref.deref(); | - | ||||||||||||||||||||||||
| 7527 | doc->doctype()->appendChild(e); | - | ||||||||||||||||||||||||
| 7528 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7529 | } | - | ||||||||||||||||||||||||
| 7530 | - | |||||||||||||||||||||||||
| 7531 | bool QDomHandler::externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) | - | ||||||||||||||||||||||||
| 7532 | { | - | ||||||||||||||||||||||||
| 7533 | return unparsedEntityDecl(name, publicId, systemId, QString()); never executed: return unparsedEntityDecl(name, publicId, systemId, QString()); | 0 | ||||||||||||||||||||||||
| 7534 | } | - | ||||||||||||||||||||||||
| 7535 | - | |||||||||||||||||||||||||
| 7536 | bool QDomHandler::notationDecl(const QString & name, const QString & publicId, const QString & systemId) | - | ||||||||||||||||||||||||
| 7537 | { | - | ||||||||||||||||||||||||
| 7538 | QDomNotationPrivate* n = new QDomNotationPrivate(doc, 0, name, publicId, systemId); | - | ||||||||||||||||||||||||
| 7539 | // keep the refcount balanced: appendChild() does a ref anyway. | - | ||||||||||||||||||||||||
| 7540 | n->ref.deref(); | - | ||||||||||||||||||||||||
| 7541 | doc->doctype()->appendChild(n); | - | ||||||||||||||||||||||||
| 7542 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||
| 7543 | } | - | ||||||||||||||||||||||||
| 7544 | - | |||||||||||||||||||||||||
| 7545 | void QDomHandler::setDocumentLocator(QXmlLocator *locator) | - | ||||||||||||||||||||||||
| 7546 | { | - | ||||||||||||||||||||||||
| 7547 | this->locator = locator; | - | ||||||||||||||||||||||||
| 7548 | } executed 244 times by 5 tests: end of blockExecuted by:
| 244 | ||||||||||||||||||||||||
| 7549 | - | |||||||||||||||||||||||||
| 7550 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 7551 | - | |||||||||||||||||||||||||
| 7552 | #endif // QT_NO_DOM | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |