diff --git a/roundtrip-xml.cabal b/roundtrip-xml.cabal
--- a/roundtrip-xml.cabal
+++ b/roundtrip-xml.cabal
@@ -1,5 +1,5 @@
 Name:           roundtrip-xml
-Version:        0.3.0.2
+Version:        0.3.0.5
 Synopsis:       Bidirectional (de-)serialization for XML.
 Description:    Roundtrip allows the definition of bidirectional
                 (de-)serialization specifications. This package provides
@@ -26,17 +26,17 @@
 Executable tests
   If flag(tests)
     Build-Depends:
-        base == 4.*
-      , HTF == 0.7.*
-      , filepath == 1.2.*
-      , text == 0.11.*
-      , bytestring == 0.9.*
-      , roundtrip == 0.2.*
-      , roundtrip-string == 0.1.*
+        base >= 4 && < 5
+      , HTF
+      , filepath
+      , text
+      , bytestring
+      , roundtrip
+      , roundtrip-string
       , roundtrip-xml
-      , enumerator >= 0.4.8 && < 0.5
-      , xml-enumerator == 0.3.*
-      , reference == 0.1.*
+      , enumerator
+      , xml-enumerator
+      , reference
   Else
     Buildable: False
   Hs-Source-Dirs: tests
@@ -55,18 +55,18 @@
       Text.Roundtrip.Xml.ParserInternal
     , Text.Roundtrip.Xml.Pretty
   Build-depends:
-      base == 4.*
-    , safe == 0.3.*
-    , bytestring == 0.9.*
-    , containers >= 0.3 && < 0.6
-    , mtl >= 1.1.1.1
-    , text == 0.11.*
-    , enumerator >= 0.4.8 && < 0.5
-    , xml-enumerator == 0.3.*
-    , xml-types == 0.3.*
-    , blaze-builder == 0.3.*
-    , blaze-builder-enumerator == 0.2.*
-    , pretty == 1.0.*
-    , reference == 0.1.*
-    , roundtrip == 0.2.*
-    , roundtrip-string == 0.1.*
+      base >= 4 && < 5
+    , safe
+    , bytestring
+    , containers
+    , mtl
+    , text
+    , enumerator
+    , xml-enumerator
+    , xml-types
+    , blaze-builder
+    , blaze-builder-enumerator
+    , pretty
+    , reference
+    , roundtrip
+    , roundtrip-string
diff --git a/src/Text/Roundtrip/Xml/Enumerator/Parser.hs b/src/Text/Roundtrip/Xml/Enumerator/Parser.hs
--- a/src/Text/Roundtrip/Xml/Enumerator/Parser.hs
+++ b/src/Text/Roundtrip/Xml/Enumerator/Parser.hs
@@ -84,7 +84,7 @@
 instance (Monad m, Reference r m) => Stream (Cursor r m a) (E.Iteratee a m) a where
   uncons = unconsStream
 
-type XmlParseIteratee r m a = GenXmlParser (Cursor r m RtEventWithPos) (E.Iteratee RtEventWithPos m) a
+type XmlParseIteratee r m = GenXmlParser (Cursor r m RtEventWithPos) (E.Iteratee RtEventWithPos m)
 
 type PureXmlParseIteratee a = forall s . XmlParseIteratee (STRef s) (ST s) a
 
diff --git a/src/Text/Roundtrip/Xml/Enumerator/Printer.hs b/src/Text/Roundtrip/Xml/Enumerator/Printer.hs
--- a/src/Text/Roundtrip/Xml/Enumerator/Printer.hs
+++ b/src/Text/Roundtrip/Xml/Enumerator/Printer.hs
@@ -20,7 +20,7 @@
 import qualified Data.Enumerator.Binary as EB
 import qualified Data.Enumerator.Text as ET
 import qualified Data.Text.Lazy as TL
-import qualified Text.XML.Enumerator.Render as Xml
+import qualified Text.XML.Stream.Render as Xml
 import Blaze.ByteString.Builder (Builder, toLazyByteString, toByteString)
 
 import Data.XML.Types
diff --git a/src/Text/Roundtrip/Xml/Parser.hs b/src/Text/Roundtrip/Xml/Parser.hs
--- a/src/Text/Roundtrip/Xml/Parser.hs
+++ b/src/Text/Roundtrip/Xml/Parser.hs
@@ -21,7 +21,7 @@
 
 import qualified Data.Enumerator as E
 import qualified Data.Enumerator.List as EL
-import qualified Text.XML.Enumerator.Parse as EP
+import qualified Text.XML.Stream.Parse as EP
 import qualified Data.Map as Map
 import Data.Map (Map)
 import qualified Data.List as List
@@ -52,14 +52,14 @@
 
 type XmlParser a = GenXmlParser [RtEventWithPos] Identity a
 
-type EventGen a = EP.DecodeEntities -> E.Enumeratee a Event Identity [Event]
+type EventGen a = EP.ParseSettings -> E.Enumeratee a Event Identity [Event]
 
 genEvents :: [a] -> EventGen a -> Either SomeException [Event]
 genEvents items f =
     runIdentity $ E.run $
                   E.joinI $
                   E.enumList chunkSize items E.$$
-                  f EP.decodeEntities E.$$
+                  f EP.def E.$$
                   EL.consume
     where
       chunkSize = 1
@@ -182,7 +182,7 @@
 matchEvent matcher desc =
     do state <- getState
        case state of
-         Just _ -> parserZero
+         Just _ -> ("cannot match " ++ desc ++ " in state " ++ show state) `debug` parserZero
          Nothing -> tokenPrim show (\_ t _ -> wp_pos t) debugMatcher
    where
      debugMatcher ev =
@@ -209,7 +209,7 @@
     do let f (RtBeginElement name' attrs) | name == name' = Just attrs
            f _ = Nothing
        attrs <- matchEvent f ("begin-element " ++ ppStr name)
-       unless (null attrs) (putState $ Just attrs)
+       unless (null attrs) (putStateDebug $ Just attrs)
        return ()
 
 xmlParserAttrValue :: Monad m => Name -> PxParser s m T.Text
@@ -222,8 +222,8 @@
                (prefix, (_, t) : suffix) ->
                    do let m' = prefix ++ suffix
                       if null m'
-                         then putState Nothing
-                         else putState (Just m')
+                         then putStateDebug Nothing
+                         else putStateDebug (Just m')
                       return t
                _ -> parserZero
 
@@ -241,3 +241,5 @@
 
 -- debug = Debug.Trace.trace
 debug _ x = x
+
+putStateDebug x = ("setting state to " ++ show x) `debug` putState x
diff --git a/src/Text/Roundtrip/Xml/Printer.hs b/src/Text/Roundtrip/Xml/Printer.hs
--- a/src/Text/Roundtrip/Xml/Printer.hs
+++ b/src/Text/Roundtrip/Xml/Printer.hs
@@ -23,7 +23,7 @@
 import qualified Data.Enumerator.List as EL
 import qualified Data.Enumerator.Binary as EB
 import qualified Data.Enumerator.Text as ET
-import qualified Text.XML.Enumerator.Render as EX
+import qualified Text.XML.Stream.Render as EX
 
 import qualified Data.ByteString as BS
 import qualified Data.ByteString.Lazy as BSL
@@ -39,6 +39,8 @@
              | PxAttribute Name T.Text
                deriving (Show)
 
+-- FIXME: don't use lists for  collecting the events, this makes an inefficient
+-- monoid. Better use Data.Sequence?!
 newtype XmlPrinter a = XmlPrinter { unXmlPrinter :: Printer Identity [PxEvent] a }
 
 instance IsoFunctor XmlPrinter where
@@ -59,7 +61,7 @@
 -- However, currently no other functions exists for such a conversion.
 runXmlPrinterGen :: Monad m => XmlPrinter a -> a
                  -> (m (Either SomeException [c]) -> Either SomeException [c])
-                 -> E.Enumeratee Event c m [c] -> Maybe [c]
+                 -> (EX.RenderSettings -> E.Enumeratee Event c m [c]) -> Maybe [c]
 runXmlPrinterGen p x run render =
     case runXmlPrinter p x of
       Nothing -> Nothing
@@ -67,7 +69,7 @@
           case run $
                E.run $
                E.enumList 20 l E.$$
-               E.joinI $ (render E.$$ EL.consume)
+               E.joinI $ (render EX.def E.$$ EL.consume)
           of Left _ -> Nothing
              Right t -> Just t
 
diff --git a/tests/Tests.hs b/tests/Tests.hs
--- a/tests/Tests.hs
+++ b/tests/Tests.hs
@@ -157,6 +157,36 @@
                         (xmlElem "e" (xmlElem "f" (xmlElem "g" xmlText))))))
 
 --
+-- Backtracking inside attributes
+--
+backtrackingAttrSpec :: XmlSyntax d => d (T.Text, T.Text)
+backtrackingAttrSpec =
+    xmlElem "root"
+      (xmlElem "x" (xmlAttrValue "foo" <*> xmlAttrValue "bar")) <||>
+    xmlElem "root"
+      (xmlElem "x" (xmlAttrValue "foo" <* xmlFixedAttr "baz" "2") <*> xmlElem "bar" xmlText)
+
+test_back1 =
+    do x <- parseFromFile (testFile "005.xml") backtrackingAttrSpec
+       assertEqual ("1", "2") x
+
+test_back2 =
+    do x <- parseFromFile (testFile "006.xml") backtrackingAttrSpec
+       assertEqual ("1", "2") x
+
+backtrackingAttrSpec2 :: XmlSyntax d => d T.Text
+backtrackingAttrSpec2 =
+    xmlElem "root" (xmlAttrValue "foo" <|> xmlAttrValue "bar")
+
+test_back3 =
+    do x <- parseFromFile (testFile "007.xml") backtrackingAttrSpec2
+       assertEqual "1" x
+
+test_back4 =
+    do x <- parseFromFile (testFile "008.xml") backtrackingAttrSpec2
+       assertEqual "1" x
+
+--
 -- Utils & main
 --
 
@@ -203,7 +233,6 @@
                   "mismatch between regular parsing and enumerator-based parsing" x x'
                 return x
          Left err -> fail (show err)
-
 
 main =
     do args <- getArgs
