]> source.dussan.org Git - poi.git/commitdiff
TIKA-3164 - add more .xsb and classes needed for TIKAs extractor
authorAndreas Beeker <kiwiwings@apache.org>
Mon, 19 Apr 2021 22:48:09 +0000 (22:48 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Mon, 19 Apr 2021 22:48:09 +0000 (22:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888985 13f79535-47bb-0310-9956-ffa450edef68

poi-integration/src/test/java/org/apache/poi/stress/POIXMLDocumentHandler.java
test-data/integration/testPDFEmbeddingAndEmbedded.docx [new file with mode: 0644]
test-data/integration/test_recursive_embedded.docx [new file with mode: 0644]

index 930c904a77aa0724912f6f5832c231607ab011a6..c99ebcb2010c2884f2d1bcaed81df076bc8c8f29 100644 (file)
@@ -59,14 +59,26 @@ public final class POIXMLDocumentHandler {
     protected static void cursorRecursive(XmlObject base) {
         XmlCursor cur = base.newCursor();
         try {
-            if (!cur.toFirstChild()) {
-                return;
-            }
-            do {
-                cursorRecursive(cur.getObject());
-            } while (cur.toNextSibling());
+            cursorRecursive(cur);
         } finally {
             cur.dispose();
         }
     }
+
+    private static void cursorRecursive(XmlCursor cur) {
+        do {
+            assertNotNull(cur.getObject());
+            cur.push();
+            for (boolean b = cur.toFirstAttribute(); b; b = cur.toNextAttribute()) {
+                assertNotNull(cur.getObject());
+            }
+            cur.pop();
+            cur.push();
+
+            if (cur.toFirstChild()) {
+                cursorRecursive(cur);
+            }
+            cur.pop();
+        } while (cur.toNextSibling());
+    }
 }
diff --git a/test-data/integration/testPDFEmbeddingAndEmbedded.docx b/test-data/integration/testPDFEmbeddingAndEmbedded.docx
new file mode 100644 (file)
index 0000000..e16bf3c
Binary files /dev/null and b/test-data/integration/testPDFEmbeddingAndEmbedded.docx differ
diff --git a/test-data/integration/test_recursive_embedded.docx b/test-data/integration/test_recursive_embedded.docx
new file mode 100644 (file)
index 0000000..cd562cb
Binary files /dev/null and b/test-data/integration/test_recursive_embedded.docx differ