/** * Returns the Text defined with the Spans in the List divided by a WS */ public String getText( List<Span> sl ){ StringBuilder result = new StringBuilder(); for( Span s: sl ){ result.append( s.getText( text )+' '); } int delChar = result.length()-1; if(delChar>0) result.deleteCharAt( delChar ); return result.toString(); }
/** * Returns the Text in the Span List in a String...<br> * all Spans must refer to the text returned by getText(). */ public String getText(List<Span> sl){ final String temp = getText(); StringBuilder result = new StringBuilder(); for( Span s: sl ) result.append( s.getText( temp )+' ' ); result.deleteCharAt( result.length()-1 ); return result.toString(); }
/** * Retruns the Link text or link caption. */ public String getText(){ if( home_cc == null ) { return null; } return pos.getText( home_cc.getText() ); }
private void setHighlights(Article article, ParsedPage page) { final List<String> highlights = new ArrayList<String>(20); for (final Paragraph p : page.getParagraphs()) { for (final Span t : p.getFormatSpans(Content.FormatType.BOLD)) { highlights.add(t.getText(p.getText())); } for (final Span t : p.getFormatSpans(Content.FormatType.ITALIC)) { highlights.add(t.getText(p.getText())); } } article.setHighlights(highlights); }