| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 if (!data.isEmpty()) { | 192 if (!data.isEmpty()) { |
| 193 m_stream.addData(data); | 193 m_stream.addData(data); |
| 194 parse(); | 194 parse(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 void XMLDocumentParser::initializeParserContext(const char*) | 200 void XMLDocumentParser::initializeParserContext(const char*) |
| 201 { | 201 { |
| 202 DocumentParser::startParsing(); | 202 m_parserStopped = false; |
| 203 m_sawError = false; | 203 m_sawError = false; |
| 204 m_sawXSLTransform = false; | 204 m_sawXSLTransform = false; |
| 205 m_sawFirstElement = false; | 205 m_sawFirstElement = false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void XMLDocumentParser::doEnd() | 208 void XMLDocumentParser::doEnd() |
| 209 { | 209 { |
| 210 #if ENABLE(XSLT) | 210 #if ENABLE(XSLT) |
| 211 if (m_sawXSLTransform) { | 211 if (m_sawXSLTransform) { |
| 212 document()->setTransformSource(new TransformSource(m_originalSourceForTr
ansform)); | 212 document()->setTransformSource(new TransformSource(m_originalSourceForTr
ansform)); |
| 213 document()->setParsing(false); // Make the doc think it's done, so it wi
ll apply xsl sheets. | 213 document()->setParsing(false); // Make the doc think it's done, so it wi
ll apply xsl sheets. |
| 214 document()->styleSelectorChanged(RecalcStyleImmediately); | 214 document()->styleSelectorChanged(RecalcStyleImmediately); |
| 215 document()->setParsing(true); | 215 document()->setParsing(true); |
| 216 DocumentParser::stopParsing(); | 216 m_parserStopped = true; |
| 217 } | 217 } |
| 218 #endif | 218 #endif |
| 219 | 219 |
| 220 if (m_stream.error() == QXmlStreamReader::PrematureEndOfDocumentError | 220 if (m_stream.error() == QXmlStreamReader::PrematureEndOfDocumentError |
| 221 || (m_wroteText && !m_sawFirstElement && !m_sawXSLTransform && !m_sawErr
or)) | 221 || (m_wroteText && !m_sawFirstElement && !m_sawXSLTransform && !m_sawErr
or)) |
| 222 handleError(fatal, qPrintable(m_stream.errorString()), lineNumber(), col
umnNumber()); | 222 handleError(fatal, qPrintable(m_stream.errorString()), lineNumber(), col
umnNumber()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 int XMLDocumentParser::lineNumber() const | 225 int XMLDocumentParser::lineNumber() const |
| 226 { | 226 { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 String attrURI = attr.namespaceUri().isEmpty() ? String() : String
(attr.namespaceUri()); | 343 String attrURI = attr.namespaceUri().isEmpty() ? String() : String
(attr.namespaceUri()); |
| 344 String attrQName = attr.qualifiedName(); | 344 String attrQName = attr.qualifiedName(); |
| 345 newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingP
ermission); | 345 newElement->setAttributeNS(attrURI, attrQName, attrValue, ec, scriptingP
ermission); |
| 346 if (ec) // exception setting attributes | 346 if (ec) // exception setting attributes |
| 347 return; | 347 return; |
| 348 } | 348 } |
| 349 } | 349 } |
| 350 | 350 |
| 351 void XMLDocumentParser::parse() | 351 void XMLDocumentParser::parse() |
| 352 { | 352 { |
| 353 while (!isStopped() && !m_parserPaused && !m_stream.atEnd()) { | 353 while (!m_parserStopped && !m_parserPaused && !m_stream.atEnd()) { |
| 354 m_stream.readNext(); | 354 m_stream.readNext(); |
| 355 switch (m_stream.tokenType()) { | 355 switch (m_stream.tokenType()) { |
| 356 case QXmlStreamReader::StartDocument: { | 356 case QXmlStreamReader::StartDocument: { |
| 357 startDocument(); | 357 startDocument(); |
| 358 } | 358 } |
| 359 break; | 359 break; |
| 360 case QXmlStreamReader::EndDocument: { | 360 case QXmlStreamReader::EndDocument: { |
| 361 endDocument(); | 361 endDocument(); |
| 362 } | 362 } |
| 363 break; | 363 break; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.1//EN") | 703 && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.1//EN") |
| 704 && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.0//EN")) | 704 && publicId != QLatin1String("-//WAPFORUM//DTD WML 1.0//EN")) |
| 705 handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()
); | 705 handleError(fatal, "Invalid DTD Public ID", lineNumber(), columnNumber()
); |
| 706 #endif | 706 #endif |
| 707 if (!m_parsingFragment) | 707 if (!m_parsingFragment) |
| 708 document()->parserAddChild(DocumentType::create(document(), name, public
Id, systemId)); | 708 document()->parserAddChild(DocumentType::create(document(), name, public
Id, systemId)); |
| 709 | 709 |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| OLD | NEW |