@Test public void testAppendCharacter() throws Exception { assertXpath("count(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[1]/CharacterCorners)", 1); assertXpath("count(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[1]/CharacterID)", 1); assertXpath("count(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[1]/CharacterNext)", 1); assertXpath("string(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[1]/GT_Text/@Value)", "a"); assertXpath("string(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[2]/GT_Text/@Value)", "b"); assertXpath("string(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[1]/Font/@Type)", "font-1"); assertXpath("string(/Document/Page[1]/Zone[1]/Line[1]/Word[1]/Character[2]/Font/@Type)", "font-2"); }
private void appendCharacter(Document doc, Element parent, BxChunk chunk, Object... hints) { Element node = doc.createElement("Character"); appendPropertyIfNotNull(doc, node, "CharacterID", chunk.getId()); appendBounds(doc, node, "CharacterCorners", chunk.getBounds(), hints); appendPropertyIfNotNull(doc, node, "CharacterNext", chunk.getNextId()); Element font = doc.createElement("Font"); font.setAttribute("Size", ""); font.setAttribute("Spacing", ""); font.setAttribute("Style", ""); font.setAttribute("Type", chunk.getFontName()); node.appendChild(font); appendProperty(doc, node, "GT_Text", chunk.toText()); parent.appendChild(node); }
BxDocumentToTrueVizWriter { private void appendCharacter(Document doc, Element parent, BxChunk chunk, Object... hints) { Element node = doc.createElement("Character"); appendPropertyIfNotNull(doc, node, "CharacterID", chunk.getId()); appendBounds(doc, node, "CharacterCorners", chunk.getBounds(), hints); appendPropertyIfNotNull(doc, node, "CharacterNext", chunk.getNextId()); Element font = doc.createElement("Font"); font.setAttribute("Size", ""); font.setAttribute("Spacing", ""); font.setAttribute("Style", ""); font.setAttribute("Type", chunk.getFontName()); node.appendChild(font); appendProperty(doc, node, "GT_Text", chunk.toText()); parent.appendChild(node); } }
BxDocumentToTrueVizWriter { private void appendCharacter(Document doc, Element parent, BxChunk chunk, Object... hints) { Element node = doc.createElement("Character"); appendPropertyIfNotNull(doc, node, "CharacterID", chunk.getId()); appendBounds(doc, node, "CharacterCorners", chunk.getBounds(), hints); appendPropertyIfNotNull(doc, node, "CharacterNext", chunk.getNextId()); Element font = doc.createElement("Font"); font.setAttribute("Size", ""); font.setAttribute("Spacing", ""); font.setAttribute("Style", ""); font.setAttribute("Type", chunk.getFontName()); node.appendChild(font); appendProperty(doc, node, "GT_Text", chunk.toText()); parent.appendChild(node); }  }
BxDocumentToTrueVizWriter { private void appendCharacter(Document doc, Element parent, BxChunk chunk, Object... hints) { Element node = doc.createElement("Character"); appendPropertyIfNotNull(doc, node, "CharacterID", chunk.getId()); appendBounds(doc, node, "CharacterCorners", chunk.getBounds(), hints); appendPropertyIfNotNull(doc, node, "CharacterNext", chunk.getNextId()); Element font = doc.createElement("Font"); font.setAttribute("Size", ""); font.setAttribute("Spacing", ""); font.setAttribute("Style", ""); font.setAttribute("Type", chunk.getFontName()); node.appendChild(font); appendProperty(doc, node, "GT_Text", chunk.toText()); parent.appendChild(node); }  String write(List<BxPage> objects, Object... hints); void write(Writer writer, List<BxPage> objects, Object... hints); }
BxDocumentToTrueVizWriter { private void appendCharacter(Document doc, Element parent, BxChunk chunk, Object... hints) { Element node = doc.createElement("Character"); appendPropertyIfNotNull(doc, node, "CharacterID", chunk.getId()); appendBounds(doc, node, "CharacterCorners", chunk.getBounds(), hints); appendPropertyIfNotNull(doc, node, "CharacterNext", chunk.getNextId()); Element font = doc.createElement("Font"); font.setAttribute("Size", ""); font.setAttribute("Spacing", ""); font.setAttribute("Style", ""); font.setAttribute("Type", chunk.getFontName()); node.appendChild(font); appendProperty(doc, node, "GT_Text", chunk.toText()); parent.appendChild(node); }  String write(List<BxPage> objects, Object... hints); void write(Writer writer, List<BxPage> objects, Object... hints); static final String MINIMAL_OUTPUT_SIZE; static final Map<BxZoneLabel, String> ZONE_LABEL_MAP; }