@Test public void parseWithFontStyle() { HTMLElement element = new HTMLElement( "<html><font style=\"font-size: 24pt;\">Örtlicher Ausbildungsplan für den <br>Studiengang</font></html>"); FontDescriptor fontDesc = element.getFontDescriptor(); assertEquals(24, fontDesc.Height); assertEquals("Örtlicher Ausbildungsplan für den\nStudiengang", element.getText()); element = new HTMLElement( "<html><p style=\"font-size: 24pt;\">Örtlicher Ausbildungsplan für den <br>Studiengang</font></html>"); fontDesc = element.getFontDescriptor(); assertEquals(24, fontDesc.Height); }
public FontDescriptor getFontDescriptor() { FontDescriptor fontDescriptor = new FontDescriptor(); ElementIterator iterator = new ElementIterator(htmlDocument); Element elem = iterator.next(); while (elem != null) { if (elem.getAttributes().isDefined(CSS.Attribute.FONT_SIZE)) { String size = elem.getAttributes().getAttribute(CSS.Attribute.FONT_SIZE).toString(); fontDescriptor.Height = Short.valueOf(size.replaceAll("pt", "")); break; } elem = iterator.next(); } return fontDescriptor; }
HTMLElement { public FontDescriptor getFontDescriptor() { FontDescriptor fontDescriptor = new FontDescriptor(); ElementIterator iterator = new ElementIterator(htmlDocument); Element elem = iterator.next(); while (elem != null) { if (elem.getAttributes().isDefined(CSS.Attribute.FONT_SIZE)) { String size = elem.getAttributes().getAttribute(CSS.Attribute.FONT_SIZE).toString(); fontDescriptor.Height = Short.valueOf(size.replaceAll("pt", "")); break; } elem = iterator.next(); } return fontDescriptor; } }
HTMLElement { public FontDescriptor getFontDescriptor() { FontDescriptor fontDescriptor = new FontDescriptor(); ElementIterator iterator = new ElementIterator(htmlDocument); Element elem = iterator.next(); while (elem != null) { if (elem.getAttributes().isDefined(CSS.Attribute.FONT_SIZE)) { String size = elem.getAttributes().getAttribute(CSS.Attribute.FONT_SIZE).toString(); fontDescriptor.Height = Short.valueOf(size.replaceAll("pt", "")); break; } elem = iterator.next(); } return fontDescriptor; } HTMLElement(String html); }
HTMLElement { public FontDescriptor getFontDescriptor() { FontDescriptor fontDescriptor = new FontDescriptor(); ElementIterator iterator = new ElementIterator(htmlDocument); Element elem = iterator.next(); while (elem != null) { if (elem.getAttributes().isDefined(CSS.Attribute.FONT_SIZE)) { String size = elem.getAttributes().getAttribute(CSS.Attribute.FONT_SIZE).toString(); fontDescriptor.Height = Short.valueOf(size.replaceAll("pt", "")); break; } elem = iterator.next(); } return fontDescriptor; } HTMLElement(String html); FontDescriptor getFontDescriptor(); int getRGBColor(); String getHref(); String getText(); }
HTMLElement { public FontDescriptor getFontDescriptor() { FontDescriptor fontDescriptor = new FontDescriptor(); ElementIterator iterator = new ElementIterator(htmlDocument); Element elem = iterator.next(); while (elem != null) { if (elem.getAttributes().isDefined(CSS.Attribute.FONT_SIZE)) { String size = elem.getAttributes().getAttribute(CSS.Attribute.FONT_SIZE).toString(); fontDescriptor.Height = Short.valueOf(size.replaceAll("pt", "")); break; } elem = iterator.next(); } return fontDescriptor; } HTMLElement(String html); FontDescriptor getFontDescriptor(); int getRGBColor(); String getHref(); String getText();  }