Changeset 561 for trunk/src/corelib/xml
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
. (modified) (1 prop)
-
src/corelib/xml/make-parser.sh (modified) (1 diff)
-
src/corelib/xml/qxmlstream.cpp (modified) (22 diffs)
-
src/corelib/xml/qxmlstream.g (modified) (8 diffs)
-
src/corelib/xml/qxmlstream.h (modified) (9 diffs)
-
src/corelib/xml/qxmlstream_p.h (modified) (40 diffs)
-
src/corelib/xml/qxmlutils.cpp (modified) (3 diffs)
-
src/corelib/xml/qxmlutils_p.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/corelib/xml/make-parser.sh
r2 r561 1 1 #!/bin/sh 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 2 42 3 43 me=$(dirname $0) 4 44 mkdir -p $me/out 5 (cd $me/out && ../../../../util/qlalr/qlalr -- troll--no-debug --no-lines ../qxmlstream.g)45 (cd $me/out && ../../../../util/qlalr/qlalr -- --no-debug --no-lines ../qxmlstream.g) 6 46 7 47 for f in $me/out/*.h; do 8 48 n=$(basename $f) 9 p4 open $n10 49 cp $f $n 11 50 done 12 51 13 p4 revert -a ... 14 p4 diff -dub ... 52 git diff . 15 53 -
trunk/src/corelib/xml/qxmlstream.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 53 53 #include "qxmlutils_p.h" 54 54 #include <qdebug.h> 55 #include < QFile>55 #include <> 56 56 #include <stdio.h> 57 57 #include <qtextcodec.h> … … 59 59 #include <qbuffer.h> 60 60 #ifndef QT_BOOTSTRAPPED 61 #include < QCoreApplication>61 #include <> 62 62 #else 63 63 // This specialization of Q_DECLARE_TR_FUNCTIONS is not in qcoreapplication.h, … … 130 130 131 131 /*! 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 132 147 \enum QXmlStreamReader::Error 133 148 … … 245 260 well-formed XML via a simple streaming API. 246 261 247 \mainclass 262 248 263 \ingroup xml-tools 249 264 … … 299 314 300 315 The \l{QXmlStream Bookmarks Example} illustrates how to use the 301 recursive descent technique with a subclassed stream reader to read302 a n XML bookmark file (XBEL).316 recursive descent technique 317 a. 303 318 304 319 \section1 Namespaces … … 335 350 new data with the next call to readNext(). 336 351 337 For example, if you read data from the network using QHttp, you 338 would connect its \l{QHttp::readyRead()}{readyRead()} signal to a 339 custom slot. In this slot, you read all available data with 340 \l{QHttp::readAll()}{readAll()} and pass it to the XML stream reader 341 using addData(). Then you call your custom parsing function that 342 reads the XML events from the reader. 352 For example, if your application reads data from the network using a 353 \l{QNetworkAccessManager} {network access manager}, you would issue 354 a \l{QNetworkRequest} {network request} to the manager and receive a 355 \l{QNetworkReply} {network reply} in return. Since a QNetworkReply 356 is a QIODevice, you connect its \l{QNetworkReply::readyRead()} 357 {readyRead()} signal to a custom slot, e.g. \c{slotReadyRead()} in 358 the code snippet shown in the discussion for QNetworkAccessManager. 359 In this slot, you read all available data with 360 \l{QNetworkReply::readAll()} {readAll()} and pass it to the XML 361 stream reader using addData(). Then you call your custom parsing 362 function that reads the XML events from the reader. 343 363 344 364 \section1 Performance and memory consumption … … 430 450 if (d->deleteDevice) 431 451 delete d->device; 432 delete d;433 452 } 434 453 … … 569 588 QXmlStreamReader::Invalid. 570 589 571 The exception is when error() return PrematureEndOfDocumentError.590 The exception is when error() return PrematureEndOfDocumentError. 572 591 This error is reported when the end of an otherwise well-formed 573 592 chunk of XML is reached, but the chunk doesn't represent a complete … … 618 637 } 619 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 620 689 /* 621 690 * Use the following Perl script to generate the error string index list: … … 630 699 $counter += length 1 + $_; 631 700 } 632 print " \"\\0\";\n\nstatic const int QXmlStreamReader_tokenTypeString_indices[] = {\n ";701 print " \"\\0\";\n\nstatic const t QXmlStreamReader_tokenTypeString_indices[] = {\n "; 633 702 for ($j = 0; $j < $i; ++$j) { 634 703 printf "$sizes[$j], "; … … 661 730 "DTD\0" 662 731 "EntityReference\0" 663 "ProcessingInstruction\0" 664 "\0"; 665 666 static const int QXmlStreamReader_tokenTypeString_indices[] = { 732 "ProcessingInstruction\0"; 733 734 static const short QXmlStreamReader_tokenTypeString_indices[] = { 667 735 0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0 668 736 }; … … 820 888 stack_size <<= 1; 821 889 sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value))); 890 822 891 state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int))); 892 823 893 } 824 894 … … 2018 2088 The function concatenates text() when it reads either \l Characters 2019 2089 or EntityReference tokens, but skips ProcessingInstruction and \l 2020 Comment. In case anything else is read before reaching EndElement, 2021 the function returns what it read so far and raises an 2022 UnexpectedElementError. If the current token is not StartElement, an 2023 empty string is returned. 2024 */ 2025 QString QXmlStreamReader::readElementText() 2090 Comment. If the current token is not StartElement, an empty string is 2091 returned. 2092 2093 The \a behaviour defines what happens in case anything else is 2094 read before reaching EndElement. The function can include the text from 2095 child elements (useful for example for HTML), ignore child elements, or 2096 raise an UnexpectedElementError and return what was read so far. 2097 2098 \since 4.6 2099 */ 2100 QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour) 2026 2101 { 2027 2102 Q_D(QXmlStreamReader); … … 2039 2114 case Comment: 2040 2115 break; 2116 2117 2118 2119 2120 2121 2122 2123 2124 2041 2125 default: 2042 if (!d->error) 2043 d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data.")); 2044 return result; 2126 if (d->error || behaviour == ErrorOnUnexpectedElement) { 2127 if (!d->error) 2128 d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data.")); 2129 return result; 2130 } 2045 2131 } 2046 2132 } 2047 2133 } 2048 2134 return QString(); 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2049 2145 } 2050 2146 … … 2789 2885 simple streaming API. 2790 2886 2791 \mainclass2792 \inmodule QtXml2793 2887 \ingroup xml-tools 2794 2888 … … 2849 2943 2850 2944 The \l{QXmlStream Bookmarks Example} illustrates how to use a 2851 s ubclassed stream writer to write an XML bookmark file (XBEL) that2945 stream writer to write an XML bookmark file (XBEL) that 2852 2946 was previously read in by a QXmlStreamReader. 2853 2947 … … 3059 3153 int n = ++namespacePrefixCount; 3060 3154 forever { 3061 s = QLatin1 String("n") + QString::number(n++);3155 s = QLatin1) + QString::number(n++); 3062 3156 int j = namespaceDeclarations.size() - 2; 3063 3157 while (j >= 0 && namespaceDeclarations.at(j).prefix != s) … … 3132 3226 QXmlStreamWriter::~QXmlStreamWriter() 3133 3227 { 3134 Q_D(QXmlStreamWriter);3135 delete d;3136 3228 } 3137 3229 … … 3412 3504 Q_D(QXmlStreamWriter); 3413 3505 Q_ASSERT(!text.contains(QLatin1String("--")) && !text.endsWith(QLatin1Char('-'))); 3414 if (!d->finishStartElement( ) && d->autoFormatting)3506 if (!d->finishStartElement() && d->autoFormatting) 3415 3507 d->indent(d->tagStack.size()); 3416 3508 d->write("<!--"); 3417 3509 d->write(text); 3418 3510 d->write("-->"); 3511 3419 3512 } 3420 3513 -
trunk/src/corelib/xml/qxmlstream.g
r2 r561 2 2 -- 3 3 -- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 -- Contact: Qt Software Information ([email protected]) 4 -- All rights reserved. 5 -- Contact: Nokia Corporation ([email protected]) 5 6 -- 6 7 -- This file is part of the QtCore module of the Qt Toolkit. … … 21 22 -- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 -- 23 -- In addition, as a special exception, Nokia gives you certain 24 -- additional rights. These rights are described in the Nokia Qt LGPL 25 -- Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 -- package. 24 -- In addition, as a special exception, Nokia gives you certain additional 25 -- rights. These rights are described in the Nokia Qt LGPL Exception 26 -- version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 -- 28 28 -- GNU General Public License Usage … … 34 34 -- met: http://www.gnu.org/copyleft/gpl.html. 35 35 -- 36 -- If you are unsure which license is appropriate for your use, please37 -- contact the sales department at qt-sales@nokia.com.36 -- If you 37 -- @nokia.com. 38 38 -- $QT_END_LICENSE$ 39 --40 -- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE41 -- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.42 39 -- 43 40 ---------------------------------------------------------------------------- … … 162 159 cap = qMax(tos + extraCapacity + 1, cap << 1 ); 163 160 data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T))); 161 164 162 } 165 163 } … … 247 245 248 246 class QXmlStreamEntityResolver; 249 247 #ifndef QT_NO_XMLSTREAMREADER 250 248 class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ 251 249 QXmlStreamReader *q_ptr; … … 918 916 markup_list ::= markup_decl | space | pereference; 919 917 markup_list ::= markup_list markup_decl | markup_list space | markup_list pereference; 918 920 919 921 920 markup_decl ::= element_decl | attlist_decl | entity_decl | entity_done | notation_decl | processing_instruction | comment; … … 1534 1533 QStringRef namespaceUri = symString(attribute.value); 1535 1534 attributeStack.pop(); 1536 if (( namespacePrefix == QLatin1String("xml")1537 ^ namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace"))1535 if (() 1536 ^ )) 1538 1537 || namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/") 1539 1538 || namespaceUri.isEmpty() … … 1844 1843 return false; 1845 1844 } 1846 ./ 1845 #endif //QT_NO_XMLSTREAMREADER.xml 1846 1847 ./ -
trunk/src/corelib/xml/qxmlstream.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 43 43 #define QXMLSTREAM_H 44 44 45 #include <QtCore/ QIODevice>45 #include <QtCore/> 46 46 47 47 #ifndef QT_NO_XMLSTREAM 48 48 49 #include <QtCore/QString> 50 #include <QtCore/QVector> 49 #include <QtCore/qstring.h> 50 #include <QtCore/qvector.h> 51 #include <QtCore/qscopedpointer.h> 51 52 52 53 QT_BEGIN_HEADER … … 61 62 // 62 63 // The list of supported platforms is in: 63 // http://qt software.com/developer/notes/supported_platforms64 // http://qt 64 65 // 65 66 // These platforms do not support symbol moving nor duplication … … 322 323 TokenType readNext(); 323 324 325 326 327 324 328 TokenType tokenType() const; 325 329 QString tokenString() const; … … 349 353 350 354 QXmlStreamAttributes attributes() const; 355 356 357 358 359 360 361 351 362 QString readElementText(); 352 363 … … 393 404 Q_DISABLE_COPY(QXmlStreamReader) 394 405 Q_DECLARE_PRIVATE(QXmlStreamReader) 395 Q XmlStreamReaderPrivate *d_ptr;406 Qd_ptr; 396 407 397 408 }; … … 466 477 Q_DISABLE_COPY(QXmlStreamWriter) 467 478 Q_DECLARE_PRIVATE(QXmlStreamWriter) 468 Q XmlStreamWriterPrivate *d_ptr;479 Qd_ptr; 469 480 }; 470 481 #endif // QT_NO_XMLSTREAMWRITER -
trunk/src/corelib/xml/qxmlstream_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 51 51 // 52 52 53 53 54 #ifndef QXMLSTREAM_P_H 54 55 #define QXMLSTREAM_P_H 56 57 58 59 55 60 56 61 class QXmlStreamReader_Table … … 117 122 118 123 ACCEPT_STATE = 416, 119 RULE_COUNT = 2 69,124 RULE_COUNT = 2, 120 125 STATE_COUNT = 427, 121 126 TERMINAL_COUNT = 57, … … 127 132 }; 128 133 129 static const char *const spell [];130 static const intlhs [];131 static const intrhs [];132 static const intgoto_default [];133 static const intaction_default [];134 static const intaction_index [];135 static const intaction_info [];136 static const intaction_check [];134 static const char *const spell []; 135 static const lhs []; 136 static const rhs []; 137 static const goto_default []; 138 static const action_default []; 139 static const action_index []; 140 static const action_info []; 141 static const action_check []; 137 142 138 143 static inline int nt_action (int state, int nt) 139 144 { 140 const int *const goto_index = &action_index [GOTO_INDEX_OFFSET]; 141 const int *const goto_check = &action_check [GOTO_CHECK_OFFSET]; 142 143 const int yyn = goto_index [state] + nt; 144 145 if (yyn < 0 || goto_check [yyn] != nt) 145 const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; 146 if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) 146 147 return goto_default [nt]; 147 148 148 const int *const goto_info = &action_info [GOTO_INFO_OFFSET]; 149 return goto_info [yyn]; 149 return action_info [GOTO_INFO_OFFSET + yyn]; 150 150 } 151 151 … … 170 170 "IDREFS", "ENTITIES", "NMTOKEN", "NMTOKENS", "<?xml", "version", 0}; 171 171 172 const int QXmlStreamReader_Table::lhs [] = {172 const t QXmlStreamReader_Table::lhs [] = { 173 173 57, 57, 59, 59, 59, 59, 59, 59, 59, 59, 174 174 67, 68, 64, 72, 72, 72, 75, 66, 66, 66, 175 66, 79, 78, 80, 80, 80, 80, 80, 80, 8 1,176 81, 81, 81, 81, 81, 81, 8 7, 83, 88, 88,177 88, 88, 91, 92, 93, 93, 93, 93, 94, 94,178 9 6, 96, 96, 97, 97, 98, 98, 99, 99, 100,179 100, 89, 89, 95, 90, 101, 101, 103, 103, 103,180 103, 103, 103, 103, 103, 103, 103, 10 4, 105, 105,181 105, 105, 10 7, 108, 109, 109, 84, 84, 110, 110,182 11 2, 112, 85, 85, 85, 65, 65, 76, 114, 63,183 115, 116, 86, 86, 86, 117, 117, 117, 117, 117,175 66, 79, 78, 80, 80, 80, 80, 80, 80, 8, 176 81, 81, 81, 81, 81, 81, 8, 88, 177 88, 88, , 94, 178 9, 179 100, , 103, 103, 180 103, 103, 103, 103, 103, 103, 103, 10, 105, 181 105, 105, 10, 110, 182 11, 183 , 117, 117, 117, 117, 184 184 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 185 117, 117, 117, 117, 117, 117, 117, 117, 11 8, 118,186 11 9, 119, 119, 119, 119, 119, 119, 119, 122, 70,187 70, 70, 70, 123, 124, 123, 124, 123, 124, 123,188 12 4, 126, 126, 126, 126, 126, 126, 126, 126, 126,185 117, 117, 117, 117, 117, 117, 117, 117, 11, 118, 186 11, 187 70, 70, 70, , 188 12, 126, 126, 126, 126, 126, 126, 126, 126, 189 189 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 190 126, 126, 126, 12 5, 73, 113, 113, 113, 113, 127,191 12 8, 127, 128, 127, 128, 127, 128, 129, 129, 129,190 126, 126, 126, 12, 191 12, 129, 129, 192 192 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 193 193 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 194 129, 129, 1 06, 106, 106, 106, 131, 132, 131, 132,195 13 1, 131, 132, 132, 133, 133, 133, 133, 135, 71,196 71, 71, 136, 136, 137, 62, 60, 61, 138, 121,197 82, 130, 134, 120, 139, 139, 139, 139, 58, 58,198 58, 58, 58, 58, 58, 58, 58, 58, 74, 69,199 69, 77, 111, 102, 102, 102, 102, 102, 140};200 201 const int QXmlStreamReader_Table:: rhs[] = {194 129, 129, 1, 195 13, 196 71, 71, , 197 , 58, 198 58, 58, 58, 58, 58, 58, 58, 58, , 199 69, 77, 111, 102, 102, 102, 102, 102, 140}; 200 201 const [] = { 202 202 2, 1, 4, 2, 2, 2, 2, 2, 2, 0, 203 203 1, 1, 9, 2, 4, 0, 4, 4, 6, 6, 204 4, 1, 3, 1, 1, 1, 2, 2, 2, 1,205 1, 1, 1, 1, 1, 1, 4, 4, 1, 1,206 1, 1, 1, 2, 1, 1, 1, 0, 2, 2,207 2, 6, 6, 1, 5, 1, 5, 3, 5, 0,208 1, 6, 8, 4, 2, 1, 5, 1, 1, 1,209 1, 1, 1, 1, 1, 6, 7, 1, 2, 2,210 1, 4, 3, 3, 1, 2, 5, 6, 4, 6,211 3, 5, 5, 3, 4, 4, 5, 2, 3, 2,212 2, 4, 5, 5, 7, 1, 1, 1, 1, 1,204 4, 1, 3, 1, 1, 1, 2, 2, 2, , 205 1, 1, 1, 1, 1, 1, , 1, 206 1, 1, 1, , 2, 207 2, , 208 , 1, 1, 209 1, 1, 1, 1, 1, , 2, 210 , 211 , 212 2, , 1, 1, 1, 1, 213 213 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 214 214 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 215 2, 2, 2, 2, 1, 1, 1, 1, 1, 2,216 2, 3, 3, 2, 2, 2, 2, 1, 1, 1,215 , 216 2, , 1, 1, 217 217 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 218 218 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 219 1, 1, 1, 1, 1, 2, 2, 3, 3, 2,220 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,219 1, 1, 1, 1, 1, , 220 2, 2, 2, , 1, 1, 1, 1, 1, 1, 221 221 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 222 222 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 223 1, 1, 2, 2, 3, 3, 2, 2, 2, 2,224 1, 1, 1, 1, 1, 1, 1, 1, 5, 0,225 1, 3, 1, 3, 2, 4, 3, 5, 1, 3,226 3, 3, 3, 4, 1, 1, 2, 2, 2, 4,227 2, 2, 2, 2, 2, 2, 2, 0, 1, 0,228 1, 1, 1, 1, 1, 1, 1, 1, 2};229 230 const int QXmlStreamReader_Table::action_default [] = {231 10, 25 8, 0, 2, 1, 0, 124, 116, 118, 119,232 12 6, 128, 122, 11, 113, 107, 0, 108, 127, 110,233 11 4, 112, 120, 123, 125, 106, 109, 111, 117, 115,234 13 0, 121, 239, 12, 253, 135, 249, 252, 0, 129,235 1 39, 256, 16, 251, 137, 136, 0, 255, 138, 258,236 23 0, 257, 254, 0, 0, 263, 0, 246, 245, 0,237 24 8, 247, 244, 240, 98, 262, 0, 235, 0, 0,238 2 59, 96, 97, 100, 0, 131, 133, 132, 134, 0,239 0, 26 0, 0, 0, 175, 0, 172, 164, 166, 167,240 14 1, 153, 170, 161, 155, 156, 152, 158, 162, 160,241 16 8, 171, 151, 154, 157, 159, 165, 163, 173, 169,242 1 49, 174, 0, 143, 147, 145, 150, 140, 148, 0,243 14 6, 142, 144, 0, 15, 14, 261, 0, 22, 21,244 26 0, 0, 0, 20, 0, 0, 31, 36, 30, 0,245 3 2, 260, 0, 33, 0, 24, 0, 34, 0, 26,246 3 5, 25, 0, 241, 40, 39, 260, 42, 48, 260,247 4 1, 0, 43, 260, 48, 260, 0, 260, 0, 48,248 0, 4 7, 45, 46, 50, 51, 260, 260, 0, 56,249 26 0, 53, 260, 0, 57, 0, 54, 260, 52, 260,250 0, 5 5, 64, 0, 260, 60, 260, 0, 58, 61,251 6 2, 0, 260, 0, 0, 59, 63, 44, 49, 65,252 0, 3 8, 0, 0, 260, 0, 93, 94, 0, 0,253 0, 0, 26 0, 0, 209, 200, 202, 204, 177, 189,254 20 7, 198, 192, 190, 193, 188, 195, 197, 205, 208,255 18 7, 191, 194, 196, 201, 199, 203, 206, 210, 212,256 21 1, 185, 0, 0, 242, 179, 183, 181, 0, 0,257 9 2, 186, 176, 184, 0, 182, 178, 180, 91, 0,258 9 5, 0, 0, 0, 0, 0, 260, 85, 260, 0,259 26 1, 0, 86, 0, 88, 68, 73, 72, 69, 70,260 7 1, 260, 74, 75, 0, 0, 0, 268, 267, 265,261 26 6, 264, 66, 260, 0, 260, 0, 0, 67, 76,262 26 0, 0, 260, 0, 0, 77, 0, 78, 0, 81,263 8 4, 0, 0, 214, 224, 223, 0, 226, 228, 227,264 22 5, 0, 243, 216, 220, 218, 222, 213, 221, 0,265 2 19, 215, 217, 0, 80, 79, 0, 82, 0, 83,266 8 7, 99, 0, 37, 0, 0, 0, 0, 90, 89,267 0, 10 2, 23, 27, 29, 28, 0, 0, 260, 261,268 0, 26 0, 0, 105, 104, 260, 0, 103, 101, 0,269 0, 18, 26 0, 17, 0, 19, 0, 0, 250, 0,270 26 0, 0, 238, 0, 231, 237, 0, 236, 233, 260,271 26 0, 261, 232, 234, 0, 260, 0, 229, 260, 0,272 26 0, 0, 230, 0, 0, 13, 269, 9, 5, 8,273 4, 0, 7, 25 8, 6, 0, 3};274 275 const int QXmlStreamReader_Table::goto_default [] = {223 1, 1, , 2, 2, 2, 224 , 225 , 226 3, 3, 3, , 227 , 228 1, 1, 1, 1, 1, 1, 1, 1, 2}; 229 230 const t QXmlStreamReader_Table::action_default [] = { 231 10, 25, 232 12, 233 11, 234 13, 235 1, 236 23, 0, 237 24, 0, 0, 238 2, 0, 239 0, 26, 240 14, 241 16, 242 1, 0, 243 14, 0, 22, 21, 244 26, 0, 245 3, 0, 26, 246 3, 247 4, 248 0, 4, 249 26, 250 0, 5, 251 6, 252 0, 3, 0, 0, 253 0, 0, 26, 254 20, 255 18, 256 21, 0, 0, 257 9, 0, 258 9, 0, 259 26, 260 7, 261 26, 262 26, 263 8, 264 22, 0, 265 2, 266 8, 267 0, 10, 268 0, 26, 0, 269 0, 18, 26, 0, 270 26, 271 26, 0, 272 26, 9, 5, 8, 273 4, 0, 7, 25, 6, 0, 3}; 274 275 const t QXmlStreamReader_Table::goto_default [] = { 276 276 2, 4, 3, 49, 388, 43, 37, 52, 47, 41, 277 277 249, 53, 127, 84, 393, 81, 85, 126, 42, 46, … … 284 284 50, 51, 59, 0}; 285 285 286 const int QXmlStreamReader_Table::action_index [] = {286 const t QXmlStreamReader_Table::action_index [] = { 287 287 -21, -57, 33, 119, 960, 70, -57, -57, -57, -57, 288 288 -57, -57, -57, -57, -57, -57, 105, -57, -57, -57, … … 373 373 -84, -84, -84, 3, -84, 98, -84}; 374 374 375 const int QXmlStreamReader_Table::action_info [] = {375 const t QXmlStreamReader_Table::action_info [] = { 376 376 65, 332, 65, 405, 392, 385, 377, 65, 414, 410, 377 377 415, 55, 397, 374, 373, 217, 206, 408, 65, 65, … … 507 507 0, 0, 0, 0, 0, 0, 0, 0}; 508 508 509 const int QXmlStreamReader_Table::action_check [] = {509 const t QXmlStreamReader_Table::action_check [] = { 510 510 26, 18, 26, 14, 4, 4, 4, 26, 24, 14, 511 511 4, 26, 4, 4, 4, 4, 22, 55, 26, 26, … … 653 653 cap = qMax(tos + extraCapacity + 1, cap << 1 ); 654 654 data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T))); 655 655 656 } 656 657 } … … 738 739 739 740 class QXmlStreamEntityResolver; 740 741 #ifndef QT_NO_XMLSTREAMREADER 741 742 class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{ 742 743 QXmlStreamReader *q_ptr; … … 1355 1356 break; 1356 1357 1357 case 3 6:1358 case 3: 1358 1359 if (!scanString(spell[EMPTY], EMPTY, false) 1359 1360 && !scanString(spell[ANY], ANY, false) 1360 1361 && atEnd) { 1361 resume(3 6);1362 return false; 1363 } 1364 break; 1365 1366 case 4 2:1362 resume(3); 1363 return false; 1364 } 1365 break; 1366 1367 case 4: 1367 1368 if (!scanString(spell[PCDATA], PCDATA, false) && atEnd) { 1368 resume(4 2);1369 return false; 1370 } 1371 break; 1372 1373 case 6 7: {1369 resume(4); 1370 return false; 1371 } 1372 break; 1373 1374 case 6: { 1374 1375 lastAttributeIsCData = true; 1375 1376 } break; 1376 1377 1377 case 7 7:1378 case 7: 1378 1379 if (!scanAfterDefaultDecl() && atEnd) { 1379 resume(7 7);1380 return false; 1381 } 1382 break; 1383 1384 case 8 2:1380 resume(7); 1381 return false; 1382 } 1383 break; 1384 1385 case 8: 1385 1386 sym(1) = sym(2); 1386 1387 lastAttributeValue.clear(); 1387 1388 lastAttributeIsCData = false; 1388 1389 if (!scanAttType() && atEnd) { 1389 resume(8 2);1390 resume(8); 1390 1391 return false; 1391 1392 } 1392 1393 break; 1393 1394 1394 case 8 3: {1395 case 8: { 1395 1396 DtdAttribute &dtdAttribute = dtdAttributes.push(); 1396 1397 dtdAttribute.tagName.clear(); … … 1413 1414 } break; 1414 1415 1415 case 8 7: {1416 case 8: { 1416 1417 if (referenceToUnparsedEntityDetected && !standalone) 1417 1418 break; … … 1433 1434 } break; 1434 1435 1435 case 8 8: {1436 case 8: { 1436 1437 if (!scanPublicOrSystem() && atEnd) { 1437 resume(8 8);1438 resume(8); 1438 1439 return false; 1439 1440 } … … 1443 1444 } break; 1444 1445 1445 case 89: {1446 case : { 1446 1447 if (!scanPublicOrSystem() && atEnd) { 1447 resume( 89);1448 resume(); 1448 1449 return false; 1449 1450 } … … 1454 1455 } break; 1455 1456 1456 case 9 0: {1457 case 9: { 1457 1458 if (!scanNData() && atEnd) { 1458 resume(9 0);1459 resume(9); 1459 1460 return false; 1460 1461 } … … 1464 1465 } break; 1465 1466 1466 case 9 1: {1467 case 9: { 1467 1468 if (!scanNData() && atEnd) { 1468 resume(9 1);1469 resume(9); 1469 1470 return false; 1470 1471 } … … 1475 1476 } break; 1476 1477 1477 case 9 2: {1478 case 9: { 1478 1479 EntityDeclaration &entityDeclaration = entityDeclarations.top(); 1479 1480 entityDeclaration.notationName = symString(3); … … 1483 1484 //fall through 1484 1485 1485 case 9 3:1486 case 9 4: {1486 case 9: 1487 case 9: { 1487 1488 if (referenceToUnparsedEntityDetected && !standalone) { 1488 1489 entityDeclarations.pop(); … … 1502 1503 } break; 1503 1504 1504 case 9 5: {1505 case 9: { 1505 1506 setType(QXmlStreamReader::ProcessingInstruction); 1506 1507 int pos = sym(4).pos + sym(4).len; … … 1515 1516 raiseWellFormedError(QXmlStream::tr("%1 is an invalid processing instruction name.").arg(piTarget)); 1516 1517 } else if (type != QXmlStreamReader::Invalid){ 1517 resume(9 5);1518 return false; 1519 } 1520 } break; 1521 1522 case 9 6:1518 resume(9); 1519 return false; 1520 } 1521 } break; 1522 1523 case 9: 1523 1524 setType(QXmlStreamReader::ProcessingInstruction); 1524 1525 processingInstructionTarget = symString(3); … … 1527 1528 break; 1528 1529 1529 case 9 7:1530 case 9: 1530 1531 if (!scanAfterLangleBang() && atEnd) { 1531 resume(9 7);1532 return false; 1533 } 1534 break; 1535 1536 case 9 8:1532 resume(9); 1533 return false; 1534 } 1535 break; 1536 1537 case 9: 1537 1538 if (!scanUntil("--")) { 1538 resume(9 8);1539 return false; 1540 } 1541 break; 1542 1543 case 99: {1539 resume(9); 1540 return false; 1541 } 1542 break; 1543 1544 case : { 1544 1545 setType(QXmlStreamReader::Comment); 1545 1546 int pos = sym(1).pos + 4; … … 1547 1548 } break; 1548 1549 1549 case 10 0: {1550 case 10: { 1550 1551 setType(QXmlStreamReader::Characters); 1551 1552 isCDATA = true; … … 1555 1556 text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3); 1556 1557 } else { 1557 resume(10 0);1558 return false; 1559 } 1560 } break; 1561 1562 case 10 1: {1558 resume(10); 1559 return false; 1560 } 1561 } break; 1562 1563 case 10: { 1563 1564 if (!scanPublicOrSystem() && atEnd) { 1564 resume(10 1);1565 resume(10); 1565 1566 return false; 1566 1567 } … … 1569 1570 } break; 1570 1571 1571 case 10 2: {1572 case 10: { 1572 1573 NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); 1573 1574 notationDeclaration.systemId = symString(3); … … 1575 1576 } break; 1576 1577 1577 case 10 3: {1578 case 10: { 1578 1579 NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); 1579 1580 notationDeclaration.systemId.clear(); … … 1581 1582 } break; 1582 1583 1583 case 10 4: {1584 case 10: { 1584 1585 NotationDeclaration ¬ationDeclaration = notationDeclarations.top(); 1585 1586 checkPublicLiteral((notationDeclaration.publicId = symString(3))); … … 1587 1588 } break; 1588 1589 1589 case 12 8:1590 case 12: 1590 1591 isWhitespace = false; 1591 1592 // fall through 1592 1593 1593 case 1 29:1594 case 1: 1594 1595 sym(1).len += fastScanContentCharList(); 1595 1596 if (atEnd && !inParseEntity) { 1596 resume(1 29);1597 resume(1); 1597 1598 return false; 1598 1599 } 1599 1600 break; 1600 1601 1601 case 13 8:1602 case 13: 1602 1603 if (!textBuffer.isEmpty()) { 1603 1604 setType(QXmlStreamReader::Characters); … … 1606 1607 break; 1607 1608 1608 case 139:1609 1609 case 140: 1610 1610 1611 clearSym(); 1611 1612 break; 1612 1613 1613 case 141:1614 1614 case 142: 1615 1615 1616 sym(1) = sym(2); 1616 1617 break; 1617 1618 1618 case 143:1619 1619 case 144: 1620 1620 case 145: 1621 1621 case 146: 1622 1622 1623 sym(1).len += sym(2).len; 1623 1624 break; 1624 1625 1625 case 17 2:1626 case 17: 1626 1627 if (normalizeLiterals) 1627 1628 textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' '); 1628 1629 break; 1629 1630 1630 case 17 3:1631 case 17: 1631 1632 sym(1).len += fastScanLiteralContent(); 1632 1633 if (atEnd) { 1633 resume(17 3);1634 return false; 1635 } 1636 break; 1637 1638 case 17 4: {1634 resume(17); 1635 return false; 1636 } 1637 break; 1638 1639 case 17: { 1639 1640 if (!QXmlUtils::isPublicID(symString(1).toString())) { 1640 1641 raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString())); 1641 resume(174); 1642 return false; 1643 } 1644 } break; 1645 1646 case 175: 1642 resume(175); 1643 return false; 1644 } 1645 } break; 1646 1647 1647 case 176: 1648 1648 1649 clearSym(); 1649 1650 break; 1650 1651 1651 case 177:1652 1652 case 178: 1653 1653 1654 sym(1) = sym(2); 1654 1655 break; 1655 1656 1656 case 179:1657 1657 case 180: 1658 1658 case 181: 1659 1659 case 182: 1660 1660 1661 sym(1).len += sym(2).len; 1661 1662 break; 1662 1663 1663 case 212:1664 1664 case 213: 1665 1665 1666 clearSym(); 1666 1667 break; 1667 1668 1668 case 214:1669 1669 case 215: 1670 1670 1671 sym(1) = sym(2); 1671 1672 lastAttributeValue = symString(1); 1672 1673 break; 1673 1674 1674 case 216:1675 1675 case 217: 1676 1676 case 218: 1677 1677 case 219: 1678 1678 1679 sym(1).len += sym(2).len; 1679 1680 break; 1680 1681 1681 case 22 8: {1682 case 22: { 1682 1683 QStringRef prefix = symPrefix(1); 1683 1684 if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) { … … 1749 1750 } break; 1750 1751 1751 case 23 4: {1752 case 23: { 1752 1753 normalizeLiterals = true; 1753 1754 Tag &tag = tagStack_push(); … … 1759 1760 } break; 1760 1761 1761 case 23 5:1762 case 23: 1762 1763 isEmptyElement = true; 1763 1764 // fall through 1764 1765 1765 case 23 6:1766 case 23: 1766 1767 setType(QXmlStreamReader::StartElement); 1767 1768 resolveTag(); … … 1771 1772 break; 1772 1773 1773 case 23 7: {1774 case 23: { 1774 1775 setType(QXmlStreamReader::EndElement); 1775 1776 Tag &tag = tagStack_pop(); … … 1782 1783 } break; 1783 1784 1784 case 23 8:1785 case 23: 1785 1786 if (entitiesMustBeDeclared()) { 1786 1787 raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(unresolvedEntity)); … … 1791 1792 break; 1792 1793 1793 case 2 39: {1794 case 2: { 1794 1795 sym(1).len += sym(2).len + 1; 1795 1796 QString reference = symString(2).toString(); … … 1830 1831 } break; 1831 1832 1832 case 24 0: {1833 case 24: { 1833 1834 sym(1).len += sym(2).len + 1; 1834 1835 QString reference = symString(2).toString(); … … 1849 1850 } break; 1850 1851 1851 case 24 1:1852 case 24: 1852 1853 sym(1).len += sym(2).len + 1; 1853 1854 break; 1854 1855 1855 case 24 2: {1856 case 24: { 1856 1857 sym(1).len += sym(2).len + 1; 1857 1858 QString reference = symString(2).toString(); … … 1889 1890 } break; 1890 1891 1891 case 24 3: {1892 case 24: { 1892 1893 if (uint s = resolveCharRef(3)) { 1893 1894 if (s >= 0xffff) … … 1903 1904 } break; 1904 1905 1905 case 246:1906 1906 case 247: 1907 1907 1908 sym(1).len += sym(2).len; 1908 1909 break; 1909 1910 1910 case 25 8:1911 case 25: 1911 1912 sym(1).len += fastScanSpace(); 1912 1913 if (atEnd) { 1913 resume(25 8);1914 return false; 1915 } 1916 break; 1917 1918 case 26 1: {1914 resume(25); 1915 return false; 1916 } 1917 break; 1918 1919 case 26: { 1919 1920 sym(1).len += fastScanName(&sym(1).prefix); 1920 1921 if (atEnd) { 1921 resume(26 1);1922 return false; 1923 } 1924 } break; 1925 1926 case 26 2:1922 resume(26); 1923 return false; 1924 } 1925 } break; 1926 1927 case 26: 1927 1928 sym(1).len += fastScanName(); 1928 1929 if (atEnd) { 1929 resume(262); 1930 return false; 1931 } 1932 break; 1933 1934 case 263: 1930 resume(263); 1931 return false; 1932 } 1933 break; 1934 1935 1935 case 264: 1936 1936 case 265: 1937 1937 case 266: 1938 1938 case 267: 1939 1939 1940 sym(1).len += fastScanNMTOKEN(); 1940 1941 if (atEnd) { 1941 resume(26 7);1942 resume(26); 1942 1943 return false; 1943 1944 } … … 1958 1959 return false; 1959 1960 } 1961 1962 1960 1963 1961 1964 #endif // QXMLSTREAM_P_H -
trunk/src/corelib/xml/qxmlutils.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 41 42 #include < QRegExp>43 #include < QString>42 #include <> 43 #include <> 44 44 45 45 #include "qxmlutils_p.h" -
trunk/src/corelib/xml/qxmlutils_p.h
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 54 54 // 55 55 56 #include <QtCore/ QString>56 #include <QtCore/> 57 57 58 58 QT_BEGIN_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.
