1 7 package net.sourceforge.formview.displayer.test; 8 9 import java.util.Iterator ; 10 import java.util.List ; 11 12 import au.id.jericho.lib.html.Element; 13 import au.id.jericho.lib.html.OutputDocument; 14 import au.id.jericho.lib.html.Source; 15 import au.id.jericho.lib.html.StringOutputSegment; 16 import au.id.jericho.lib.html.Tag; 17 18 23 public class TestJericho { 24 25 public static void main(String [] args) { 26 StringBuffer htmlContent = new StringBuffer ("<html>"); 27 htmlContent.append("<input name='CCCCCCCCCc' />"); 28 htmlContent.append("<select name=\"selectList\" >\n"); 29 htmlContent.append("<option value=\"ITEM0\" >Item0</option>"); 30 htmlContent.append("<option value=\"ITEM1\" selected=\"selected\">Item1</option>"); 31 htmlContent.append("</select>\n"); 32 htmlContent.append("</html>"); 33 OutputDocument outputDocument = new OutputDocument(htmlContent); 34 Source sourceDocument = new Source(htmlContent); 35 36 List l = sourceDocument.findAllElements(Tag.SELECT); 37 for (Iterator iter = l.iterator(); iter.hasNext();) { 38 Element element = (Element) iter.next(); 39 StringOutputSegment s = new StringOutputSegment(element, "<input type='text' name='aaaa' />AAAAAAAAAAAAAAAAAAAAAA"); 40 outputDocument.add(s); 41 } 42 43 44 45 46 System.out.println(outputDocument.toString()); 47 } 48 } 49 | Popular Tags |