[Haskell] HaXML incorrect interpretation of XML spec!

S. Alexander Jacobson alex at alexjacobson.com
Wed Oct 27 20:24:44 EDT 2004

The XML spec defines the prolog(1) as follows:

  [22]   	prolog	   ::=   	XMLDecl? Misc* (doctypedecl Misc*)?

In other words you can have Misc before AND after
the doctype declaration!

HaXml defines the prolog(2) as:

  data Prolog = Prolog (Maybe XMLDecl) (Maybe DocTypeDecl)

HaXml therefore does not allow PIs before the
beginning of the top level element.  This is a
problem in practice for people who want to use
e.g. XML-Stylesheets(3) where if one is using XSL
to produce HTML it is necessary to put
the stylesheet declaration BEFORE the root element
(if the root element is not HTML).  e.g.

  <?xml version="1.0"?>
  <?xml:stylesheet type="text/xsl" href="style.xsl"?>
  <foo id="57" category="2"/>

Is there some way to puta PI before the
root element in combinators?


(1) http://www.w3.org/TR/REC-xml/#sec-prolog-dtd
(2) http://www.cs.york.ac.uk/fp/HaXml/HaXml/Text.XML.HaXml.Types.html#Prolog
(3) http://www.w3.org/TR/xml-stylesheet/
S. Alexander Jacobson tel:917-770-6565 http://alexjacobson.com

More information about the Haskell mailing list