X-Git-Url: http://dolda2000.com/gitweb/?p=jsvc.git;a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Fnext%2FHtml.java;h=c90bb40b2d891638c96b03915e5a40003a6e18b3;hp=6d6c24e68876b7438c439182a28ca36dbc30f474;hb=5203590bbc5672cc6cc2df1b95179a97a2e42cda;hpb=41c47d4cde58eb352552cf641f472266d6bd23a3 diff --git a/src/dolda/jsvc/next/Html.java b/src/dolda/jsvc/next/Html.java index 6d6c24e..c90bb40 100644 --- a/src/dolda/jsvc/next/Html.java +++ b/src/dolda/jsvc/next/Html.java @@ -1,10 +1,15 @@ package dolda.jsvc.next; import org.w3c.dom.*; +import org.w3c.dom.ls.*; +import javax.xml.validation.*; +import java.net.*; +import java.io.*; public class Html extends DocBuffer { public static final String ns = "http://www.w3.org/1999/xhtml"; - + private static final Schema schema = DomUtil.loadxsd("xhtml1-strict.xsd"); + private Html(String pubid, String sysid) { super(ns, "html", "html", pubid, sysid); } @@ -36,4 +41,16 @@ public class Html extends DocBuffer { public void addcss(String href, String name) { insert("head", csslink(href, name)); } + + public void validate() { + Validator val = schema.newValidator(); + try { + val.validate(new javax.xml.transform.dom.DOMSource(doc)); + } catch(org.xml.sax.SAXException e) { + throw(new RuntimeException(e)); + } catch(java.io.IOException e) { + /* Should never happen. */ + throw(new Error(e)); + } + } }