~ valid xhtml
authorAlexandre Bertails <bertails@w3.org>
Wed, 02 Feb 2011 19:08:01 -0500
changeset 317 f5050941adff
parent 316 a555d4d071aa
child 318 7144a09e48ac
~ valid xhtml
directmapping-webapp/src/main/scala/Servlet.scala
--- a/directmapping-webapp/src/main/scala/Servlet.scala	Wed Feb 02 18:55:59 2011 -0500
+++ b/directmapping-webapp/src/main/scala/Servlet.scala	Wed Feb 02 19:08:01 2011 -0500
@@ -2,6 +2,7 @@
 
 import javax.servlet.http.{HttpServlet, HttpServletRequest, HttpServletResponse} 
 import scala.xml.XML
+import scala.xml.dtd.{DocType, PublicID}
 
 import org.w3.rdf._
 import org.w3.rdb.RDB._
@@ -48,13 +49,21 @@
   override def doGet(request:HttpServletRequest, response:HttpServletResponse) =
     processIndex(request, response)
 
+  val xhtmlDoctype = DocType("html",
+                             PublicID("-//W3C//DTD XHTML 1.0 Strict//EN",
+                                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"),
+                             Nil)
+
   def render(sql:String, result:Option[String]) =
     <html xmlns="http://www.w3.org/1999/xhtml">
-      <head><title>Direct Mapping</title></head>
+      <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <title>Direct Mapping</title>
+      </head>
       <body>
         <h1>Try the <a href="http://www.w3.org/2001/sw/rdb2rdf/directMapping/">Direct Mapping</a> application!</h1>
         { if (result isDefined) <pre name="result" id="result">{ result.get }</pre> }
-        <form method="POST" action="/">
+        <form method="post" action="/">
           <p>
             <textarea rows="15" cols="80" name="sql" id="sql">{ sql }</textarea><br />
             <input name="hierarchy" checked="checked" type="checkbox" />Detects hierarchy relation
@@ -84,7 +93,7 @@
 
     response.setContentType("application/xml; charset='" + encoding + "'")
 
-    XML.write(response.getWriter, html, encoding, false, null) 
+    XML.write(response.getWriter, html, encoding, false, xhtmlDoctype) 
 
   }
 
@@ -94,7 +103,7 @@
 
     response.setContentType("application/xml; charset='" + encoding + "'")
 
-    XML.write(response.getWriter, index, encoding, false, null) 
+    XML.write(response.getWriter, index, encoding, false, xhtmlDoctype)
 
   }