Package: haxml
Version: 1.13.1-2
Severity: important

  Severity "important" because this is a fairly basic functionality
gap for an XML writing library.

  It appears that when you output text in an XML document using
"literal", the text you pass is just copied to the output verbatim.
This leads to rather nasty surprises when using HaXml to generate
new XML content (rather than just blindly shuffling around pieces
of an input document).

  For instance, see the attached program.  HaXML doesn't escape either
the double-quote in an attribute value or the brackets in text data,
leading to an invalid HTML document.

  It might be that "literal" is intended to do this -- but an
abstraction for XML I/O really should provide a simple mechanism for
generating valid XML by default, and I can't find a way to get the
desired result without escaping everything by hand.

  Daniel

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-1-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages haxml depends on:
ii  libc6                     2.3.6-18       GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.2.1+dfsg-4 Multiprecision arithmetic library

Versions of packages haxml recommends:
ii  libghc6-haxml-dev             1.13.1-2   GHC6 libraries for using XML docum
ii  libhugs-haxml                 1.13.1-2   GHC6 libraries for using XML docum

-- no debconf information
module Main where

import Text.PrettyPrint
import Text.XML.HaXml.Combinators
import Text.XML.HaXml.Html.Generate
import Text.XML.HaXml.Pretty

doc :: CFilter
doc = html [
            htitle [
                    literal "What's wrong with HaXML"
                   ],
            replaceAttrs [("class", "the \"best>"), ("bgcolor", "blue")] `o`
                         hbody [
                                literal "<i>XML is a structured container format, not a random byte sequence."
                               ]
           ]

main :: IO ()
main = print $ vcat $ map content $ doc undefined

Reply via email to