xml-enumerator 0.0.1 → 0.0.1.1
raw patch · 3 files changed
+20/−10 lines, 3 files
Files
Text/XML/Enumerator/Parse.hs view
@@ -254,9 +254,7 @@ return $ TokenBeginDocument as else do skipSpace- x <- toText <$> takeWhile (/= qmark)- word8' qmark- word8' gt+ x <- toText . S.pack <$> manyTill anyWord8 (try $ string "?>") return $ TokenInstruction $ Instruction name x parseComment = do word8' dash@@ -626,11 +624,13 @@ E.drop 1 t <- contentToText c takeContents $ front . (:) t- Just EventBeginDocument -> takeContents front- Just EventEndDocument -> takeContents front- Just EventInstruction{} -> takeContents front- Just EventDoctype{} -> takeContents front- Just EventComment{} -> takeContents front+ Just EventBeginDocument -> helper+ Just EventEndDocument -> helper+ Just EventInstruction{} -> helper+ Just EventDoctype{} -> helper+ Just EventComment{} -> helper+ where+ helper = E.drop 1 >> takeContents front -- | The same as 'parseFile', but throws any exceptions. parseFile_ :: String -> (Text -> Maybe Text) -> Iteratee SEvent IO a -> IO a
Text/XML/Enumerator/Render.hs view
@@ -103,7 +103,17 @@ newElemStack (NSLevel _ nsmap) (Name local (Just ns) Nothing) = (NSLevel (Just ns) nsmap, TName Nothing local, [(TName Nothing "xmlns", [ContentText ns])]) newElemStack (NSLevel def nsmap) (Name local (Just ns) (Just pref)) =- (NSLevel def nsmap', TName (Just pref) local, [(TName (Just "xmlns") pref, [ContentText ns])])+ case Map.lookup ns nsmap of+ Just pref'+ | pref == pref' ->+ ( NSLevel def nsmap+ , TName (Just pref) local+ , []+ )+ _ -> ( NSLevel def nsmap'+ , TName (Just pref) local+ , [(TName (Just "xmlns") pref, [ContentText ns])]+ ) where nsmap' = Map.insert ns pref nsmap
xml-enumerator.cabal view
@@ -1,5 +1,5 @@ name: xml-enumerator-version: 0.0.1+version: 0.0.1.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michaels@suite-sol.com>