packages feed

hxt 9.3.1.1 → 9.3.1.2

raw patch · 5 files changed

+50/−19 lines, 5 files

Files

hxt.cabal view
@@ -1,6 +1,6 @@ -- arch-tag: Haskell XML Toolbox main description file Name:           hxt-Version:        9.3.1.1+Version:        9.3.1.2 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.@@ -15,6 +15,8 @@                 hxt-curl, hxt-tagsoup, hxt-relaxng, hxt-xpath, hxt-xslt, 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.1: new parser xreadDoc                 .                 Changes from 9.3.1.0: in readString all input decoding switched off                 .
src/Text/XML/HXT/Arrow/ParserInterface.hs view
@@ -35,9 +35,12 @@ parseXmlDTDPart                 :: ArrowXml a => a (String, XmlTree) XmlTree parseXmlDTDPart                 =  arr2L XP.parseXmlDTDPart -parseXmlContent                 :: ArrowXml a => a String XmlTree-parseXmlContent                 =  arrL XP.xread+xreadCont                       :: ArrowXml a => a String XmlTree+xreadCont                       =  arrL XP.xread +xreadDoc                        :: ArrowXml a => a String XmlTree+xreadDoc                        =  arrL XP.xreadDoc+ parseXmlEntityEncodingSpec   , parseXmlDocEncodingSpec   , removeEncodingSpec          :: ArrowXml a => a XmlTree XmlTree@@ -67,7 +70,10 @@ parseHtmlDoc                    :: ArrowList a => a (String, String) XmlTree parseHtmlDoc                    = arr2L HP.parseHtmlDocument -parseHtmlContent                :: ArrowList a => a String XmlTree-parseHtmlContent                = arrL  HP.parseHtmlContent+hread                           :: ArrowList a => a String XmlTree+hread                           = arrL   HP.parseHtmlContent++hreadDoc                        :: ArrowList a => a String XmlTree+hreadDoc                        = arrL $ HP.parseHtmlDocument "string"  -- ------------------------------------------------------------
src/Text/XML/HXT/Arrow/ReadDocument.hs view
@@ -2,7 +2,7 @@  {- |    Module     : Text.XML.HXT.Arrow.ReadDocument-   Copyright  : Copyright (C) 2005 Uwe Schmidt+   Copyright  : Copyright (C) 2005-2013 Uwe Schmidt    License    : MIT     Maintainer : Uwe Schmidt (uwe@fh-wedel.de)@@ -21,7 +21,9 @@     , readString     , readFromString     , hread+    , hreadDoc     , xread+    , xreadDoc     ) where @@ -39,7 +41,7 @@                                                 , rememberDTDAttrl                                                 , removeDocWhiteSpace                                                 )-import Text.XML.HXT.Arrow.ParserInterface+import qualified Text.XML.HXT.Arrow.ParserInterface as PI import Text.XML.HXT.Arrow.ProcessDocument       ( getDocumentContents                                                 , parseXmlDocument                                                 , parseXmlDocumentWithExpat@@ -479,24 +481,38 @@ hread :: ArrowXml a => a String XmlTree hread     = fromLA $-      parseHtmlContent                      -- substHtmlEntityRefs is done in parser+      PI.hread                              -- substHtmlEntityRefs is done in parser       >>>                                   -- as well as subst HTML char refs       editNTreeA [isError :-> none]         -- ignores all errors -{- no longer neccesary, text nodes are merged in parser-      >>>-      canonicalizeContents--- -}+-- | like hread, but accepts a whole document, not a HTML content +hreadDoc :: ArrowXml a => a String XmlTree+hreadDoc+    = fromLA $+      PI.hreadDoc                           -- substHtmlEntityRefs is done in parser+      >>>                                   -- as well as subst HTML char refs+      editNTreeA [isError :-> none]         -- ignores all errors+ -- ------------------------------------------------------------  -- |--- parse a string as XML content, substitute all predefined XML entity refs and canonicalize tree+-- parse a string as XML CONTENT, (no xml decl or doctype decls are allowed),+-- substitute all predefined XML entity refs and canonicalize tree -- This xread arrow delegates all work to the xread parser function in module XmlParsec  xread :: ArrowXml a => a String XmlTree-xread-    = parseXmlContent+xread = PI.xreadCont++-- |+-- a more general version of xread which+-- parses a whole document including a prolog+-- (xml decl, doctype decl) and processing+-- instructions. Doctype decls remain uninterpreted,+-- but are in the list of results trees.++xreadDoc :: ArrowXml a => a String XmlTree+xreadDoc = PI.xreadDoc  {- -- the old version, where the parser does not subst char refs and cdata xread                   = root [] [parseXmlContent]       -- substXmlEntityRefs is done in parser
src/Text/XML/HXT/Parser/HtmlParsec.hs view
@@ -119,7 +119,7 @@ parseHtmlDocument       = parseHtmlFromString htmlDocument  parseHtmlContent        :: String -> XmlTrees-parseHtmlContent        = parseHtmlFromString htmlContent "text"+parseHtmlContent        = parseHtmlFromString htmlContent "string"  -- ------------------------------------------------------------ 
src/Text/XML/HXT/Parser/XmlParsec.hs view
@@ -37,6 +37,7 @@     , textDecl     , encodingDecl     , xread+    , xreadDoc      , parseXmlContent     , parseXmlDocEncodingSpec@@ -618,13 +619,19 @@ -- see also: 'parseXmlContent'  xread                   :: String -> XmlTrees-xread str+xread                   = xread' content         -- take the content parser for parsing the string++xreadDoc                :: String -> XmlTrees+xreadDoc                = xread' document'       -- take the document' parser for parsing the string++xread'                   :: XParser () XmlTrees -> String -> XmlTrees+xread' content' str     = parseXmlFromString parser (withNormNewline ()) loc str     where     loc = "string: " ++ show (if length str > 40 then take 40 str ++ "..." else str)     parser = do-             res <- content             -- take the content parser for parsing the string-             eof                        -- and test on everything consumed+             res <- content'+             eof                        -- test on everything consumed              return res  -- |