|
TagBuffer
is a small Java library for building tag-specified structures, primarily HTML pages or XML documents. The projects will focus on speed, small footprint and few classes. A 4th beta version is available for download
TagBuffer is similar to Jakarta's Element Construction Set (ECS) but with a lower object overhead. (http://jakarta.apache.org/ecs/ ) Applications may be servlets wishing to avoid excessive use of objects or stand-alone programs building other structured data. TagBuffer is hosted on SourceForge at http://sourceforge.net/projects/tagbuffer/ The current project manager can be reached via sourceforge message |
|
Small example | ||
TagBuffer tb = new TagBuffer("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">"); tb.set("td", "valign=top"); tb. open("html"). open("body", "background=#ffffff"). open("h2").append("TagBuffer example").close(). open("table"). open("tr"). open("td").append("cell 1").close(). open("td").append("cell 2").close(). open("td").open("a", "href=http://www.slashdot.org"). append("cell 3").close("td"). close("html"); System.out.println(tb.toString());Which will generate: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <body background="#ffffff"> <h2>TagBuffer example</h2> <table> <tr> <td valign="top">cell 1</td> <td valign="top">cell 2</td> <td valign="top"> <a href="http://www.slashdot.org">cell 3</a> </td> </tr> </table> </body> </html> |