diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index 249409004..8f320c390 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -229,19 +229,46 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { } return this; } - private List htmlToParagraphPieces(String html) throws IOException, FHIRException { + + private List htmlToParagraphPieces(String html) { List myPieces = new ArrayList(); - String[] paragraphs = html.replace("

", "").split("<\\/p>|
"); - for (int i=0;i"+html+""); + boolean first = true; + for (XhtmlNode c : node.getChildNodes()) { + if (first) { + first = false; + } else { myPieces.add(new Piece("br")); + myPieces.add(new Piece("br")); + } + if (c.getNodeType() == NodeType.Text) { + if (!Utilities.isWhitespace(c.getContent())) + addNode(myPieces, c); + } else if ("p".equals(c.getName())) { + for (XhtmlNode g : c.getChildNodes()) { + addNode(myPieces, g); + } + } else { + Piece x = new Piece(c.getName()); + x.getChildren().addAll(c.getChildNodes()); + myPieces.add(x); } - myPieces.addAll(htmlFormattingToPieces(paragraphs[i])); } +// String[] paragraphs = html.replace("

", "").split("<\\/p>|
"); +// for (int i=0;i