use of eu.transkribus.core.util.SebisStopWatch in project TranskribusCore by Transkribus.
the class XPathPage method main.
public static void main(String[] args) throws Exception {
// File f = new File("/home/sebastianc/Downloads/035_320_001.xml");
SebisStopWatch ss = new SebisStopWatch();
// ss.start();
// PageXmlUtils.unmarshal(new File("/home/sebastianc/Downloads/035_320_001.xml"));
// ss.stop(true);
XPathPage utils = XPathPage.getInstance();
// String id = "r188";
String id = null;
TranscriptionLevel level = TranscriptionLevel.LINE;
ss.start();
String txt = utils.getUnicodeText(new File("/home/sebastianc/Downloads/035_320_001.xml").toURI().toURL(), level, id);
ss.stop(true);
System.out.println("txt = " + txt);
if (true)
return;
ClassLoader cl = XPathPage.class.getClassLoader();
// DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", cl);
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
// domFactory.setNamespaceAware(true);
// XPathFactory xpathFactory = XPathFactory.newInstance(javax.xml.xpath.XPathFactory.DEFAULT_OBJECT_MODEL_URI, "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", cl);
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();
xpath.getNamespaceContext();
DocumentBuilder builder = domFactory.newDocumentBuilder();
File f = new File("/mnt/dea_scratch/TRP/test/Klassikerausgaben_test/page/bsb00087391_00009.xml");
Document catalog = builder.parse(f);
final XPathExpression expr = xpath.compile("//*[contains(name(), 'Page')]/@imageWidth");
// Object result = expr.evaluate(catalog, XPathConstants.NUMBER);
// Double res = (Double)result;
// System.out.println(res);
Object result = expr.evaluate(catalog, XPathConstants.STRING);
String res = (String) result;
System.out.println(res);
// Object result = expr.evaluate(catalog, XPathConstants.NODESET);
// NodeList nodes = (NodeList) result;
// if (nodes.getLength() > 0) {
// String[] parents = new String[nodes.getLength()];
// for (int i = 0; i < nodes.getLength(); i++) {
// parents[i] = nodes.item(i).getNodeValue();
// System.out.println(parents[i]);
// }
// }
}
use of eu.transkribus.core.util.SebisStopWatch in project TranskribusCore by Transkribus.
the class TeiBuilderTest method main.
public static void main(String[] args) {
SebisStopWatch sw = new SebisStopWatch();
TrpDoc doc;
try {
// doc = LocalDocReader.load(LocalDocReaderTest.TEST_DOC1);
doc = LocalDocReader.load(docPath);
// test1(doc);
test2(doc);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations