diff --git a/autotests/samplefiles/test_with_container.svg b/autotests/samplefiles/test_with_container.svg
new file mode 100644
--- /dev/null
+++ b/autotests/samplefiles/test_with_container.svg
@@ -0,0 +1,9 @@
+
+
+
diff --git a/autotests/xmlextractortest.h b/autotests/xmlextractortest.h
--- a/autotests/xmlextractortest.h
+++ b/autotests/xmlextractortest.h
@@ -37,6 +37,7 @@
void benchMarkXmlExtractor();
void testXmlExtractor();
void testXmlExtractorNoContent();
+ void testXmlExtractorContainer();
};
#endif // XMLEXTRACTORTESTS_H
diff --git a/autotests/xmlextractortest.cpp b/autotests/xmlextractortest.cpp
--- a/autotests/xmlextractortest.cpp
+++ b/autotests/xmlextractortest.cpp
@@ -113,5 +113,25 @@
QVERIFY(result.text().isEmpty());
}
+void XmlExtractorTests::testXmlExtractorContainer()
+{
+ XmlExtractor plugin{this};
+
+ SimpleExtractionResult result(testFilePath(QStringLiteral("test_with_container.svg")),
+ QStringLiteral("image/svg"),
+ ExtractionResult::ExtractEverything);
+ plugin.extract(&result);
+
+ QString content = QStringLiteral("Some text below \n");
+
+ QCOMPARE(result.types().size(), 1);
+ QCOMPARE(result.types().at(0), Type::Image);
+
+ QCOMPARE(result.properties().size(), 0);
+
+ content.replace(QLatin1Char('\n'), QLatin1Char(' '));
+ QCOMPARE(result.text(), content);
+}
+
QTEST_GUILESS_MAIN(XmlExtractorTests)
diff --git a/src/extractors/xmlextractor.cpp b/src/extractors/xmlextractor.cpp
--- a/src/extractors/xmlextractor.cpp
+++ b/src/extractors/xmlextractor.cpp
@@ -39,7 +39,8 @@
return;
}
- if (node.localName() == QLatin1String("g")) {
+ if ((node.localName() == QLatin1String("g")) ||
+ (node.localName() == QLatin1String("a"))) {
QDomElement e = node.firstChildElement();
for (; !e.isNull(); e = e.nextSiblingElement()) {
extractSvgText(result, e);