diff --git a/hxt.cabal b/hxt.cabal
--- a/hxt.cabal
+++ b/hxt.cabal
@@ -1,6 +1,6 @@
 -- arch-tag: Haskell XML Toolbox main description file
 Name:           hxt
-Version:        9.3.1.15
+Version:        9.3.1.16
 Synopsis:       A collection of tools for processing XML with Haskell.
 Description:    The Haskell XML Toolbox bases on the ideas of HaXml and HXML,
                 but introduces a more general approach for processing XML with Haskell.
@@ -17,6 +17,8 @@
                 hxt-unicode contains encoding and decoding functions,
                 hxt-charproperties char properties for unicode and XML.
                 .
+                Changes from 9.3.1.15: Bug in quoting PI instructions in showXmlTrees fixed
+                .
                 Changes from 9.3.1.14: For ghc-7.10 network-uri is automatically selected 
                 .
                 Changes from 9.3.1.13: ghc-7.10 compatibility
@@ -64,7 +66,7 @@
 Stability:      Stable
 Category:       XML
 Homepage:       https://github.com/UweSchmidt/hxt
-Copyright:      Copyright (c) 2005-2015 Uwe Schmidt
+Copyright:      Copyright (c) 2005-20161 Uwe Schmidt
 Build-type:     Simple
 Cabal-version:  >=1.8
 
@@ -214,18 +216,17 @@
  extensions: MultiParamTypeClasses DeriveDataTypeable FunctionalDependencies FlexibleInstances CPP
 
  build-depends: base       >= 4     && < 5,
-                containers >= 0.2   && < 1,
-                directory  >= 1     && < 2,
-                filepath   >= 1     && < 2,
+                containers >= 0.2,
+                directory  >= 1,
+                filepath   >= 1,
                 parsec     >= 2.1   && < 4,
-                HUnit      >= 1.2   && < 2,
                 mtl        >= 2.0.1 && < 3,
-                deepseq    >= 1.1   && < 2,
-                bytestring >= 0.9   && < 1,
-                binary     >= 0.5   && < 1,
-                hxt-charproperties  >= 9.1    && < 10,
-                hxt-unicode         >= 9.0.1  && < 10,
-                hxt-regex-xmlschema >= 9.2    && < 10
+                deepseq    >= 1.1,
+                bytestring >= 0.9,
+                binary     >= 0.5,
+                hxt-charproperties  >= 9.1,
+                hxt-unicode         >= 9.0.1,
+                hxt-regex-xmlschema >= 9.2
 
  if flag(network-uri)
    build-depends: network-uri >= 2.6
diff --git a/src/Control/Arrow/ArrowTree.hs b/src/Control/Arrow/ArrowTree.hs
--- a/src/Control/Arrow/ArrowTree.hs
+++ b/src/Control/Arrow/ArrowTree.hs
@@ -147,7 +147,7 @@
     --
     -- This expression selects
     -- all top level \"table\" elements within an \"html\" element, an expression.
-    -- Attantion: This does not correspond
+    -- Attention: This does not correspond
     -- to the XPath selection path \"html\/\/table\". The latter on matches all table elements
     -- even nested ones, but @\/\/>@ gives in many cases the appropriate functionality.
 
diff --git a/src/Data/Tree/NTree/TypeDefs.hs b/src/Data/Tree/NTree/TypeDefs.hs
--- a/src/Data/Tree/NTree/TypeDefs.hs
+++ b/src/Data/Tree/NTree/TypeDefs.hs
@@ -23,7 +23,6 @@
 module Data.Tree.NTree.TypeDefs
 where
 
-import           Control.Applicative ((<$>))
 import           Control.DeepSeq     (NFData (..))
 import           Control.FlatSeq     (WNFData (..), rlnf)
 
@@ -31,6 +30,11 @@
 import           Data.Monoid         ((<>))
 import           Data.Tree.Class     (Tree (..))
 import           Data.Typeable       (Typeable)
+
+#if MIN_VERSION_base(4,8,2)
+#else
+import           Control.Applicative ((<$>))
+#endif
 
 #if MIN_VERSION_base(4,8,0)
 #else
diff --git a/src/Text/XML/HXT/Arrow/DocumentInput.hs b/src/Text/XML/HXT/Arrow/DocumentInput.hs
--- a/src/Text/XML/HXT/Arrow/DocumentInput.hs
+++ b/src/Text/XML/HXT/Arrow/DocumentInput.hs
@@ -231,7 +231,7 @@
    If the source name is empty, the input is read from standard input.
 
    The source is transformed into an absolute URI. If the source is a relative URI, or a file name,
-   it is expanded into an absolut URI with respect to the current base URI.
+   it is expanded into an absolute URI with respect to the current base URI.
    The default base URI is of protocol \"file\" and points to the current working directory.
 
    The currently supported protocols are \"http\", \"file\", \"stdin\" and \"string\".
diff --git a/src/Text/XML/HXT/Arrow/XmlOptions.hs b/src/Text/XML/HXT/Arrow/XmlOptions.hs
--- a/src/Text/XML/HXT/Arrow/XmlOptions.hs
+++ b/src/Text/XML/HXT/Arrow/XmlOptions.hs
@@ -241,7 +241,7 @@
 -- ------------------------------------------------------------
 
 -- |
--- select options from a predefined list of option desciptions
+-- select options from a predefined list of option descriptions
 
 selectOptions   :: [String] -> [OptDescr a] -> [OptDescr a]
 selectOptions ol os
diff --git a/src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs b/src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs
--- a/src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs
+++ b/src/Text/XML/HXT/Arrow/XmlState/SystemConfig.hs
@@ -31,12 +31,12 @@
 
 -- config options
 
--- | @withTace level@ : system option, set the trace level, (0..4)
+-- | @withTrace level@ : system option, set the trace level, (0..4)
 
 withTrace                       :: Int -> SysConfig
 withTrace                       = setS theTraceLevel
 
--- | @withSysAttr key value@ : store an arbitarty key value pair in system state
+-- | @withSysAttr key value@ : store an arbitrary key value pair in system state
 
 withSysAttr                     :: String -> String -> SysConfig
 withSysAttr n v                 = chgS theAttrList (addEntry n v)
diff --git a/src/Text/XML/HXT/DOM/ShowXml.hs b/src/Text/XML/HXT/DOM/ShowXml.hs
--- a/src/Text/XML/HXT/DOM/ShowXml.hs
+++ b/src/Text/XML/HXT/DOM/ShowXml.hs
@@ -32,6 +32,7 @@
 import           Text.XML.HXT.DOM.TypeDefs
 import           Text.XML.HXT.DOM.XmlKeywords
 import           Text.XML.HXT.DOM.XmlNode     (getDTDAttrl, mkDTDElem)
+import           Text.Regex.XMLSchema.Generic(sed)
 
 -- -----------------------------------------------------------------------------
 --
@@ -61,12 +62,17 @@
 -- a 2. quoting funtion for attribute values
 -- and an encoding function after tree conversion
 
-xshow'                          :: (Char -> StringFct) -> (Char -> StringFct) -> (Char -> StringFct) -> XmlTrees -> Blob
+xshow'                          :: (Char -> StringFct) ->
+                                   (Char -> StringFct) ->
+                                   (Char -> StringFct) ->
+                                   XmlTrees -> Blob
 xshow' cquot aquot enc ts       = stringToBlob $ (concatMap' enc (showTrees ts "")) ""
     where
     showTrees                   = showXmlTrees (concatMap' cquot) (concatMap' aquot)
 
-xshow''                         :: (Char -> StringFct) -> (Char -> StringFct) -> XmlTrees -> String
+xshow''                         :: (Char -> StringFct) ->
+                                   (Char -> StringFct) ->
+                                   XmlTrees -> String
 xshow'' cquot aquot ts          = showTrees ts ""
     where
     showTrees                   = showXmlTrees (concatMap' cquot) (concatMap' aquot)
@@ -77,7 +83,9 @@
 
 -- ------------------------------------------------------------
 
-showXmlTrees                    :: (String -> StringFct) -> (String -> StringFct) -> XmlTrees -> StringFct
+showXmlTrees                    :: (String -> StringFct) ->
+                                   (String -> StringFct) ->
+                                   XmlTrees -> StringFct
 showXmlTrees cf af
     = showTrees
       where
@@ -127,7 +135,10 @@
                                 = showString "<!--" . showString c . showString "-->"
 
       showXmlTree (NTree (XCdata d) _)
-                                = showString "<![CDATA[" . showString d . showString "]]>"
+                                = showString "<![CDATA[" . showString d' . showString "]]>"
+                                  where
+                                    -- quote "]]>" in CDATA contents
+                                    d' = sed (const "]]&gt;") "\\]\\]>" d
 
       showXmlTree (NTree (XPi n al) _)
                                 = showString "<?"
@@ -138,8 +149,11 @@
                                   showPiAttr        :: XmlTree -> StringFct
                                   showPiAttr a@(NTree (XAttr an) cs)
                                       | qualifiedName an == a_value
-                                          = showBlank . showTrees cs
+                                          -- <?some-pi ... ?>
+                                          -- no XML quoting of PI value
+                                          = showBlank . showXmlTrees showString showString cs
                                       | otherwise
+                                          -- <?xml version="..." ... ?>
                                           = showXmlTree a
                                   showPiAttr a
                                       = showXmlTree a -- id
@@ -441,4 +455,3 @@
 {-# INLINE concatMap' #-}
 
 -- -----------------------------------------------------------------------------
-
diff --git a/src/Text/XML/HXT/DOM/TypeDefs.hs b/src/Text/XML/HXT/DOM/TypeDefs.hs
--- a/src/Text/XML/HXT/DOM/TypeDefs.hs
+++ b/src/Text/XML/HXT/DOM/TypeDefs.hs
@@ -75,7 +75,7 @@
                 | XCdata          String                        -- ^ CDATA section                                       (leaf)
                 | XPi             QName XmlTrees                -- ^ Processing Instr with qualified name                (leaf)
                                                                 --   with list of attributes.
-                                                                --   If tag name is xml, attributs are \"version\", \"encoding\", \"standalone\",
+                                                                --   If tag name is xml, attributes are \"version\", \"encoding\", \"standalone\",
                                                                 --   else attribute list is empty, content is a text child node
                 | XTag            QName XmlTrees                -- ^ tag with qualified name and list of attributes (inner node or leaf)
                 | XDTD            DTDElem  Attributes           -- ^ DTD element with assoc list for dtd element features
diff --git a/src/Text/XML/HXT/Parser/HtmlParsec.hs b/src/Text/XML/HXT/Parser/HtmlParsec.hs
--- a/src/Text/XML/HXT/Parser/HtmlParsec.hs
+++ b/src/Text/XML/HXT/Parser/HtmlParsec.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP                #-}
+
 -- ------------------------------------------------------------
 
 {- |
@@ -33,7 +35,10 @@
 
 where
 
-import Control.Applicative                      ( (<$>) )
+#if MIN_VERSION_base(4,8,2)
+#else
+import Control.Applicative                      ((<$>))
+#endif
 
 import Data.Char                                ( toLower
                                                 , toUpper
diff --git a/src/Text/XML/HXT/Parser/XmlParsec.hs b/src/Text/XML/HXT/Parser/XmlParsec.hs
--- a/src/Text/XML/HXT/Parser/XmlParsec.hs
+++ b/src/Text/XML/HXT/Parser/XmlParsec.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP                #-}
+
 -- ------------------------------------------------------------
 
 {- |
@@ -58,7 +60,10 @@
     )
 where
 
+#if MIN_VERSION_base(4,8,2)
+#else
 import           Control.Applicative                   ((<$>))
+#endif
 
 import           Text.ParserCombinators.Parsec         (between, char, eof,
                                                         getInput, getPosition,
diff --git a/src/Text/XML/HXT/Parser/XmlTokenParser.hs b/src/Text/XML/HXT/Parser/XmlTokenParser.hs
--- a/src/Text/XML/HXT/Parser/XmlTokenParser.hs
+++ b/src/Text/XML/HXT/Parser/XmlTokenParser.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP                #-}
+
 -- ------------------------------------------------------------
 
 {- |
@@ -83,8 +85,12 @@
     )
 where
 
-import Control.Applicative                      ( (<$>) )
+#if MIN_VERSION_base(4,8,2)
+#else
+import Control.Applicative                      ((<$>))
+#endif
 
+
 import Data.Char.Properties.XMLCharProps        ( isXmlChar
                                                 , isXmlCharCR
                                                 )
@@ -591,7 +597,7 @@
 mergeTextNodes :: XmlTrees -> XmlTrees
 mergeTextNodes
     = foldr addText []
-    where 
+    where
       addText :: XmlTree -> XmlTrees -> XmlTrees
       addText t []
           = [t]
@@ -599,5 +605,3 @@
           = mergeText t t1 ++ ts
 
 -- ------------------------------------------------------------
-
-
diff --git a/src/Text/XML/HXT/Version.hs b/src/Text/XML/HXT/Version.hs
--- a/src/Text/XML/HXT/Version.hs
+++ b/src/Text/XML/HXT/Version.hs
@@ -1,4 +1,4 @@
 module Text.XML.HXT.Version
 where
 hxt_version :: String
-hxt_version = "9.1.0"
+hxt_version = "9.3.1.15"
