X-Git-Url: http://git.dolda2000.com/gitweb/?a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Fnext%2FHtml.java;fp=src%2Fdolda%2Fjsvc%2Fnext%2FHtml.java;h=6d6c24e68876b7438c439182a28ca36dbc30f474;hb=816cbb00faa568491d867a28b9570f8018e088b1;hp=0000000000000000000000000000000000000000;hpb=bce78e9e695e185501a05474b4862fe30a45863f;p=jsvc.git diff --git a/src/dolda/jsvc/next/Html.java b/src/dolda/jsvc/next/Html.java new file mode 100644 index 0000000..6d6c24e --- /dev/null +++ b/src/dolda/jsvc/next/Html.java @@ -0,0 +1,39 @@ +package dolda.jsvc.next; + +import org.w3c.dom.*; + +public class Html extends DocBuffer { + public static final String ns = "http://www.w3.org/1999/xhtml"; + + private Html(String pubid, String sysid) { + super(ns, "html", "html", pubid, sysid); + } + + public static Html xhtml11(String title) { + Html buf = new Html("-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"); + Node html = buf.doc.getDocumentElement(); + Node head = DomUtil.insertel(html, "head"); + head.appendChild(buf.makecursor("head")); + Node tit = DomUtil.insertel(head, "title"); + DomUtil.inserttext(tit, title); + Node body = DomUtil.insertel(html, "body"); + body.appendChild(buf.makecursor("body")); + return(buf); + } + + public Element el(String name, Node contents, String... attrs) { + return(el(ns, name, contents, attrs)); + } + + public Element csslink(String href, String name) { + Element el = el("link", null, "rel=stylesheet", "type=text/css"); + if(name != null) + el.setAttribute("title", name); + el.setAttribute("href", href); + return(el); + } + + public void addcss(String href, String name) { + insert("head", csslink(href, name)); + } +}