blob: 104cca1fe0613139c0ec3b10b37c3ff3e99d4481 (
plain)
1
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
42
43
44
|
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "xmlutils.h"
#include "xmlutils_libxslt.h"
#include "qtcompat.h"
using namespace Qt::StringLiterals;
XQuery::XQuery() = default;
XQuery::~XQuery() = default;
QString XQuery::evaluate(QString xPathExpression, QString *errorMessage)
{
// XQuery can't have invalid XML characters
xPathExpression.replace(u'&', u"&"_s);
xPathExpression.replace(u'<', u"<"_s);
return doEvaluate(xPathExpression, errorMessage);
}
std::shared_ptr<XQuery> XQuery::create(const QString &focus, QString *errorMessage)
{
#if defined(HAVE_LIBXSLT)
return libXml_createXQuery(focus, errorMessage);
#else
Q_UNUSED(focus);
*errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
return {};
#endif
}
QString xsl_transform(const QString &xml, const QString &xsl, QString *errorMessage)
{
#if defined(HAVE_LIBXSLT)
return libXslt_transform(xml, xsl, errorMessage);
#else
Q_UNUSED(xsl);
*errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
return xml;
#endif
}
|