aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/xmlutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/xmlutils.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/xmlutils.cpp b/sources/shiboken6/ApiExtractor/xmlutils.cpp
new file mode 100644
index 000000000..ccacd4ce7
--- /dev/null
+++ b/sources/shiboken6/ApiExtractor/xmlutils.cpp
@@ -0,0 +1,42 @@
+// 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"&lt;"_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
+ *errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
+ return std::shared_ptr<XQuery>();
+#endif
+}
+
+QString xsl_transform(const QString &xml, const QString &xsl, QString *errorMessage)
+{
+#if defined(HAVE_LIBXSLT)
+ return libXslt_transform(xml, xsl, errorMessage);
+#else
+ *errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
+ return xml;
+#endif
+}