private Document createDocument(List<BxPage> pages, Object... hints) throws ParserConfigurationException, TransformationException { Document doc = TrueVizUtils.newDocumentBuilder().newDocument(); Element root = doc.createElement("Document"); appendProperty(doc, root, "DocID", ""); appendProperty(doc, root, "DocTitle", ""); appendProperty(doc, root, "DocPubName", ""); appendProperty(doc, root, "DocVolNum", ""); appendProperty(doc, root, "DocIssueNum", ""); appendProperty(doc, root, "DocMargins", ""); appendProperty(doc, root, "DocDate", ""); appendProperty(doc, root, "DocPages", ""); Element imageNode = doc.createElement("DocImage"); appendProperty(doc, imageNode, "Name", ""); appendProperty(doc, imageNode, "Format", ""); appendProperty(doc, imageNode, "Depth", ""); appendProperty(doc, imageNode, "Compression", ""); appendProperty(doc, imageNode, "Capture", ""); appendProperty(doc, imageNode, "Quality", ""); root.appendChild(imageNode); appendLanguage(doc, root, "", "", ""); appendFont(doc, root, "", "", "", ""); appendProperty(doc, root, "ReadingDir", ""); appendProperty(doc, root, "CharOrient", ""); appendClassification(doc, root, "", ""); appendProperty(doc, root, "GT_Text", ""); for (BxPage page : pages) { appendPage(doc, root, page, hints); } doc.appendChild(root); return doc; }
private BxPage importSource(InputSource source) throws IOException, ParserConfigurationException, SAXException { Document doc = TrueVizUtils.newDocumentBuilder().parse(source); if ("Page".equalsIgnoreCase(doc.getDocumentElement().getTagName())) { BxPage page = parsePageNode(doc.getDocumentElement()); return page; } else if ("Document".equalsIgnoreCase(doc.getDocumentElement().getTagName())) { } throw new UnsupportedDataTypeException( "There were no example of this type contact kura for more info"); }