From 9898cbc5eda0f8f8f80d20a4e17e52bfb35dfd1c Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Fri, 12 Mar 2021 20:41:39 +0100 Subject: [PATCH] Added isRootElement method to figure out if splitting element has parent --- src/main/java/w2phtml/pageSplitters/BasicSplitter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/w2phtml/pageSplitters/BasicSplitter.java b/src/main/java/w2phtml/pageSplitters/BasicSplitter.java index a2823b4..b179a2e 100644 --- a/src/main/java/w2phtml/pageSplitters/BasicSplitter.java +++ b/src/main/java/w2phtml/pageSplitters/BasicSplitter.java @@ -101,6 +101,14 @@ public class BasicSplitter { return false; } + private static boolean isRootElement(Node node) { + Node parent = node.getParentNode(); + if (parent.getNodeName().equals("office:text")) { + return true; + } + return false; + } + protected static void removeSPB(Node node) { if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getNodeName().equals(TEXT_SOFT_PAGE_BREAK)) {