KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > formview > displayer > test > TestJericho


1 /*
2  * Created on 23 janv. 2006
3  *
4  * TODO To change the template for this generated file go to
5  * Window - Preferences - Java - Code Style - Code Templates
6  */

7 package net.sourceforge.formview.displayer.test;
8
9 import java.util.Iterator JavaDoc;
10 import java.util.List JavaDoc;
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 /**
19  * Description :
20  * Created on 23 janv. 2006
21  * @author azerr
22  */

23 public class TestJericho {
24     
25     public static void main(String JavaDoc[] args) {
26         StringBuffer JavaDoc htmlContent = new StringBuffer JavaDoc("<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 JavaDoc l = sourceDocument.findAllElements(Tag.SELECT);
37         for (Iterator JavaDoc 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