diff --git a/src/main/java/w2phtml/pageSplitters/BasicSplitter.java b/src/main/java/w2phtml/pageSplitters/BasicSplitter.java
index c69d20e..a2823b4 100644
--- a/src/main/java/w2phtml/pageSplitters/BasicSplitter.java
+++ b/src/main/java/w2phtml/pageSplitters/BasicSplitter.java
@@ -20,13 +20,7 @@ public class BasicSplitter {
this.officeReader = officeReader;
this.factory = factory;
}
- protected static boolean appendChild(Node parent, Node child) {
- boolean dataMoved;
- parent.appendChild(child);
- dataMoved = true;
- return dataMoved;
- }
-
+
protected static void addHyphen(Node para, Node paraBefore) {
//Debug.printNode(paraBefore);
//Debug.printNode(para);
diff --git a/src/main/java/w2phtml/pageSplitters/ParagraphSplitter.java b/src/main/java/w2phtml/pageSplitters/ParagraphSplitter.java
index 947001c..b45a4d7 100644
--- a/src/main/java/w2phtml/pageSplitters/ParagraphSplitter.java
+++ b/src/main/java/w2phtml/pageSplitters/ParagraphSplitter.java
@@ -10,6 +10,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import pro.litvinovg.xml.Debug;
import w2phtml.office.OfficeReader;
public class ParagraphSplitter extends BasicSplitter implements ISplitter {
@@ -22,7 +23,9 @@ public class ParagraphSplitter extends BasicSplitter implements ISplitter {
@Override
public boolean Split(Node para) {
Node parent = para.getParentNode();
- //System.out.println("handlePara");
+ //System.out.println("PRINT PARA START");
+ //Debug.prettyPrintXml(parent);
+
Node paraFirstPart = para.cloneNode(false);
boolean dataMoved = false;
int i = 0;
@@ -31,10 +34,8 @@ public class ParagraphSplitter extends BasicSplitter implements ISplitter {
//System.out.println("In WHILE HANDLE PARA");
Node child = childs.item(i);
//NOT TEXT NODES
- if ((child.getNodeType() == Node.ELEMENT_NODE)) {
- String childName = child.getNodeName();
- //SPB FOUND
if (containsSPB(child)){
+ String childName = child.getNodeName();
//System.out.println(childName);
if (childName.equals(TEXT_SOFT_PAGE_BREAK)){
//removeSPB
@@ -55,17 +56,15 @@ public class ParagraphSplitter extends BasicSplitter implements ISplitter {
}
break;
//Other elements
- } else if (childName.equals(TEXT_BOOKMARK_START)){
+ } else if (child.getNodeName() != null && child.getNodeName().equals(TEXT_BOOKMARK_START)){
paraFirstPart.appendChild(child.cloneNode(true));
i++;
} else {
- dataMoved = appendChild(paraFirstPart, child);
+ dataMoved = true;
+ paraFirstPart.appendChild(child);
}
//TEXT NODES
- } else {
- dataMoved = appendChild(paraFirstPart, child);
- }
-
+
}
addHyphen(para,paraFirstPart);
@@ -73,7 +72,8 @@ public class ParagraphSplitter extends BasicSplitter implements ISplitter {
removeIndent(para);
parent.insertBefore(paraFirstPart, para);
}
-
+ //System.out.println("PRINT PARA END");
+ //Debug.prettyPrintXml(parent);
return dataMoved;
}