Skip to content
Christian Clausner edited this page Jan 2, 2018 · 9 revisions

Loading page content from XML and iterating over content

		
	//Load page
	Page page = PageXmlInputOutput.readPage("c:\\temp\\text.xml");
			
	//Iterate over regions
	for (int i=0; i<page.getLayout().getRegionCount(); i++) {
		Region region = page.getLayout().getRegion(i);
	}
			
	//Iterate over regions using iterator
	for (RegionIterator it = new RegionIterator(page.getLayout(), RegionType.TextRegion, null); it.hasNext(); ) {
		Region region = (Region)it.next();
	}
			
	//Iterate over text lines
	for (LowLevelTextObjectIterator it = new LowLevelTextObjectIterator(page.getLayout(), LowLevelTextType.TextLine, null); it.hasNext(); ) {
		TextLine textLine = (TextLine)it.next();
	}			
			
} catch (Exception e) {
	e.printStackTrace();
}
Clone this wiki locally