summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
diff options
context:
space:
mode:
authorTobias Koenig <tokoe@kde.org>2009-05-16 10:19:10 (GMT)
committerTobias Koenig <tokoe@kde.org>2009-05-16 10:19:10 (GMT)
commit135a028d9dc9a28a0a072665a7dc43b7e9e187be (patch)
treed259e1d265589d10a541899d4982ab4e656900eb /src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
parent210bd7b6033e41aad61fe131002dc5e496d7427a (diff)
downloadQt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.zip
Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.gz
Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.bz2
Add W3C XML Schema validation support
This was done by Tobias Koenig, as part of an internship at Trolltech/Qt Software, started at Wed Oct 1 18:32:43 2008 +0200, and the last commit being part of this commit dating Tue Feb 24 11:03:36 2009 +0100. This is work consisting of about 650 commits squashed into one, where the first commit was 61b280386c1905a15690fdd917dcbc8eb09b6283, in the repository before Qt's history cut.
Diffstat (limited to 'src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h')
-rw-r--r--src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
index 863fd65..56f547a 100644
--- a/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
+++ b/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.h
@@ -52,12 +52,12 @@
#ifndef Patternist_AccelTreeResourceLoader_H
#define Patternist_AccelTreeResourceLoader_H
-#include <QtCore/QHash>
#include <QtCore/QEventLoop>
#include <QtNetwork/QNetworkReply>
#include "qabstractxmlreceiver.h"
#include "qacceltree_p.h"
+#include "qacceltreebuilder_p.h"
#include "qdeviceresourceloader_p.h"
#include "qnamepool_p.h"
#include "qnetworkaccessdelegator_p.h"
@@ -115,13 +115,25 @@ namespace QPatternist
{
public:
/**
+ * Describes the behaviour of the resource loader in case of an
+ * error.
+ */
+ enum ErrorHandling
+ {
+ FailOnError, ///< The resource loader will report the error via the report context.
+ ContinueOnError ///< The resource loader will report no error and return an empty QNetworkReply.
+ };
+
+ /**
* AccelTreeResourceLoader does not own @p context.
*/
AccelTreeResourceLoader(const NamePool::Ptr &np,
- const NetworkAccessDelegator::Ptr &networkDelegator);
+ const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder<true>::Features = AccelTreeBuilder<true>::NoneFeature);
virtual Item openDocument(const QUrl &uri,
const ReportContext::Ptr &context);
+ virtual Item openDocument(QIODevice *source, const QUrl &documentUri,
+ const ReportContext::Ptr &context);
virtual SequenceType::Ptr announceDocument(const QUrl &uri, const Usage usageHint);
virtual bool isDocumentAvailable(const QUrl &uri);
@@ -133,7 +145,6 @@ namespace QPatternist
const ReportContext::Ptr &context,
const SourceLocationReflection *const where);
-
/**
* @short Helper function that do NetworkAccessDelegator::get(), but
* does it blocked.
@@ -149,14 +160,14 @@ namespace QPatternist
*/
static QNetworkReply *load(const QUrl &uri,
QNetworkAccessManager *const networkManager,
- const ReportContext::Ptr &context);
+ const ReportContext::Ptr &context, ErrorHandling handling = FailOnError);
/**
* @overload
*/
static QNetworkReply *load(const QUrl &uri,
const NetworkAccessDelegator::Ptr &networkDelegator,
- const ReportContext::Ptr &context);
+ const ReportContext::Ptr &context, ErrorHandling handling = FailOnError);
/**
* @short Returns the URIs this AccelTreeResourceLoader has loaded
@@ -165,14 +176,17 @@ namespace QPatternist
virtual QSet<QUrl> deviceURIs() const;
virtual void clear(const QUrl &uri);
+
private:
static bool streamToReceiver(QIODevice *const dev,
- QAbstractXmlReceiver *const receiver,
+ AccelTreeBuilder<true> *const receiver,
const NamePool::Ptr &np,
const ReportContext::Ptr &context,
const QUrl &uri);
bool retrieveDocument(const QUrl &uri,
const ReportContext::Ptr &context);
+ bool retrieveDocument(QIODevice *source, const QUrl &documentUri,
+ const ReportContext::Ptr &context);
/**
* If @p context is @c null, no error reporting should be done.
*/
@@ -185,6 +199,7 @@ namespace QPatternist
const NamePool::Ptr m_namePool;
const NetworkAccessDelegator::Ptr m_networkAccessDelegator;
QHash<QPair<QUrl, QString>, QString> m_unparsedTexts;
+ AccelTreeBuilder<true>::Features m_features;
};
}