hxt 9.3.1.12 → 9.3.1.13
raw patch · 2 files changed
+17/−6 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hxt.cabal +3/−1
- src/Text/XML/HXT/Arrow/Pickle/Xml.hs +14/−5
hxt.cabal view
@@ -1,6 +1,6 @@ -- arch-tag: Haskell XML Toolbox main description file Name: hxt-Version: 9.3.1.12+Version: 9.3.1.13 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.@@ -16,6 +16,8 @@ hxt-regex-xmlschema contain the extensions. hxt-unicode contains encoding and decoding functions, hxt-charproperties char properties for unicode and XML.+ .+ Changes from 9.3.1.12: Bug when unpickling an empty attribute value removed . Changes from 9.3.1.11: Bug fix in haddock comments .
src/Text/XML/HXT/Arrow/Pickle/Xml.hs view
@@ -82,6 +82,10 @@ import qualified Control.Arrow.ListArrows as X -- -} +{- debug code+import qualified Debug.Trace as T+-- -}+ -- ------------------------------------------------------------ data St = St { attributes :: [XmlTree]@@ -199,9 +203,14 @@ case findAtt as of Nothing -> throwMsg $ "no attribute value found for " ++ show qn Just (a, as') -> do modify (\ s -> s {attributes = as'})- return a+ return $ nonEmptyVal a where- findAtt = findElem (maybe False (== qn) . XN.getAttrName)+ findAtt = findElem (maybe False (== qn) . XN.getAttrName)+ nonEmptyVal a'+ | null (XN.getChildren a') = XN.setChildren [et] a'+ | otherwise = a'+ where+ et = XN.mkText "" getNSAtt :: String -> Unpickler () getNSAtt ns = do as <- gets attributes@@ -312,8 +321,8 @@ unpickleElem' :: PU a -> Int -> XmlTree -> UnpickleVal a unpickleElem' p l t- = fst- . runUP (appUnPickle p)+ = -- T.trace ("unpickleElem': " ++ show t) $+ ( fst . runUP (appUnPickle p) ) $ St { attributes = fromMaybe [] . XN.getAttrl $ t , contents = XN.getChildren t@@ -778,7 +787,7 @@ xpInt :: PU Int xpInt = xpWrapEither (readMaybe, show) xpText where- readMaybe xs+ readMaybe xs@(_:_) | all isDigit xs = Right . foldl' (\ r c -> 10 * r + (fromEnum c - fromEnum '0')) 0 $ xs readMaybe ('-' : xs) = fmap (0 -) . readMaybe $ xs readMaybe ('+' : xs) = readMaybe $ xs