summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/api/qxmlquery_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlpatterns/api/qxmlquery_p.h')
-rw-r--r--src/xmlpatterns/api/qxmlquery_p.h45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/xmlpatterns/api/qxmlquery_p.h b/src/xmlpatterns/api/qxmlquery_p.h
index 66e9f5b..dcbd19b 100644
--- a/src/xmlpatterns/api/qxmlquery_p.h
+++ b/src/xmlpatterns/api/qxmlquery_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtXmlPatterns module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -142,13 +142,10 @@ public:
if(!m_functionFactory)
{
- if(queryLanguage == QXmlQuery::XQuery10)
- m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d);
- else
- {
- Q_ASSERT(queryLanguage == QXmlQuery::XSLT20);
+ if(queryLanguage == QXmlQuery::XSLT20)
m_functionFactory = QPatternist::FunctionFactoryCollection::xslt20Factory(namePool.d);
- }
+ else
+ m_functionFactory = QPatternist::FunctionFactoryCollection::xpath20Factory(namePool.d);
}
const QPatternist::GenericStaticContext::Ptr genericStaticContext(new QPatternist::GenericStaticContext(namePool.d,
@@ -164,6 +161,14 @@ public:
if(!contextItem.isNull())
m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::AtomicValue::qtToXDMType(contextItem), m_staticContext));
+ else if( queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintField
+ || queryLanguage == QXmlQuery::XmlSchema11IdentityConstraintSelector
+ || queryLanguage == QXmlQuery::XPath20)
+ m_staticContext = QPatternist::StaticContext::Ptr(new QPatternist::StaticFocusContext(QPatternist::BuiltinTypes::node, m_staticContext));
+
+ for (int i = 0; i < m_additionalNamespaceBindings.count(); ++i) {
+ m_staticContext->namespaceBindings()->addBinding(m_additionalNamespaceBindings.at(i));
+ }
return m_staticContext;
}
@@ -207,19 +212,6 @@ public:
return m_resourceLoader;
}
-
- static inline QUrl normalizeQueryURI(const QUrl &uri)
- {
- Q_ASSERT_X(uri.isEmpty() || uri.isValid(), Q_FUNC_INFO,
- "The URI passed to QXmlQuery::setQuery() must be valid or empty.");
- if(uri.isEmpty())
- return QUrl::fromLocalFile(QCoreApplication::applicationFilePath());
- else if(uri.isRelative())
- return QUrl::fromLocalFile(QCoreApplication::applicationFilePath()).resolved(uri);
- else
- return uri;
- }
-
void setRequiredType(const QPatternist::SequenceType::Ptr &seqType)
{
Q_ASSERT(seqType);
@@ -278,6 +270,11 @@ public:
return m_expr;
}
+ inline void addAdditionalNamespaceBinding(const QXmlName &binding)
+ {
+ m_additionalNamespaceBindings.append(binding);
+ }
+
QXmlNamePool namePool;
QPointer<QAbstractMessageHandler> messageHandler;
/**
@@ -321,6 +318,8 @@ public:
QPatternist::SequenceType::Ptr m_requiredType;
QPatternist::FunctionFactory::Ptr m_functionFactory;
QPatternist::NetworkAccessDelegator::Ptr m_networkAccessDelegator;
+
+ QList<QXmlName> m_additionalNamespaceBindings;
};
QT_END_NAMESPACE