A common Haskell HTML library is
Text.Html(tex, 2010) and relative Text.XHtml
used above, which uses element-transforming style
to build pages. Produced content is well-formed
and tag-conforming due to their structured building
method and HTML escaping of text content. Any
attribute can be added to any tag, thus not being
attribute-conforming. All tags are of the same type
and can be added in any order leading to tag ordering
and inclusion/exclusion violations. Blaze-html(Meier
and der Jeugt, 2010) and Hamlet(Snoyman, 2010) are
similar Haskell libraries, but unfortunately they also
suffer from the same lack of compliance guarantees.
XMLC for Java allows an application developer to
manipulate a DOM structure obtained from parsing a
HTML or XML template file(xml, 2008). Manipula-
tion of the DOM is therefore similar to DOM manip-
ulations in JavaScript. When all transformations are
complete the DOM is serialized and sent to the user.
XMLC does not restrict operations which would re-
sult in invalid content being sent to the user.
Separating structure from content in a web set-
ting is advantageous for security as well. Robert-
son & Vigna(Robertson and Vigna, 2009) explore us-
ing a strongly typed system for HTML generation as
well as producing SQL queries in the web applica-
tion. Their goal is to increase security by preventing
injection attacks targeting the ad-hoc mixing of con-
tent and structure in SQL by representing structure
in a typed way and filtering inserted content. Thus,
the client or SQL server’s parser will not be fooled
by the attempted injection attack. Our work similarly
mitigates injection attacks but does not address web
application vulnerabilities relating to a database.
6 CONCLUSIONS
We have shown how (X)HTML W3C compliance can
be achieved by Haskell while performing on par with
more mature dynamic (X)HTML production systems.
We generalize the W3C (X)HTML specifications into
five classes of requirements a web production sys-
tem must be able to enforce to produce compliant
output. The inclusion & exclusion nesting require-
ment of nearly all (X)HTML DTD’s has proven diffi-
cult to enforce and thus ignored by web production
libraries. Our (X)HTML library, CH-(X)HTML, is
able to partially enforce four of the five classes of
requirements at compile-time, including inclusion &
exclusion, with full compliance attainable at run-time.
Use of the library is straightforward due to multi-
parameter type classes and functional dependencies
allowing a coding style similar to straight (X)HTML,
while guaranteeing strong compliance for all pro-
duced content.
REFERENCES
Brewer, J. and Henry, S. L. (2006). Policies relating to web
accessibility. http://www.w3.org/WAI/Policy/.
Bringert, B. (2010). cgi: A library for writing cgi programs.
http://hackage.haskell.org/package/cgi.
Bringert, B. and Lemmih (2010). fastcgi: A
haskell library for writing fastcgi programs.
http://hackage.haskell.org/package/fastcgi.
CGI (2010). The common gateway interface.
http://hoohoo.ncsa.illinois.edu/cgi/.
Chen, S., Hong, D., and Shen, V. Y. (2005). An experimen-
tal study on validation problems with existing html
webpages. In International Conference on Internet
Computing, pages 373–379.
Collins, G., Beardsley, D., yu Guo, S., and Sanders,
J. (2010). Snap: A haskell web framework.
http://snapframework.com/.
Davies, D. (2005). W3c compliance and seo.
http://www.evolt.org/w3c-compliance-and-seo.
Directgov (2010). The disability discrimination act (dda).
http://www.direct.gov.uk/en/DisabledPeople/Rights
AndObligations/DisabilityRights/DG
4001068.
Elder, M. and Shaw, J. (2010). Happstack.
http://happstack.com/index.html.
Group, W. H. W. (2002). Xhtml 1.0: The ex-
tensible hypertext markup language (sec-
ond edition). http://www.w3.org/TR/xhtml1/,
http://www.w3.org/TR/xhtml1/.
Hansen, R. (2009). Xss (cross site scripting) prevention
cheat sheet. http://ha.ckers.org/xss.html.
Happs (2010). Happs. http://happs.org/.
Html5 (2010). Html5. http://dev.w3.org/html5/spec/
Overview.html.
Jaxb (2010). jaxb. https://jaxb.dev.java.net/.
Kemp, A. (2010). Turbinado. http://wiki.github.com/
alsonkemp/turbinado.
Kiselyov, O. (2010). Hsxml: Typed sxml.
http://okmij.org/ftp/Scheme/xml.html#typed-SXML.
Marlow, S. and Bringert, B. (2010). Mohws: Modu-
lar haskell web server. http://hackage.haskell.org/cgi-
bin/hackage-scripts/package/mohws.
Meier, S. and der Jeugt, J. V. (2010). Blazehtml.
http://jaspervdj.be/blaze/.
Moss, T. (2010). Disability discrimination act (dda) & web
accessibility. http://www.webcredible.co.uk/user-
friendly-resources/web-accessibility/uk-website-
legal-requirements.shtml
Nørmark, K. (2005). Web programming in scheme with
laml. J. Funct. Program., 15(1):53–65.
WEBIST 2011 - 7th International Conference on Web Information Systems and Technologies
78