Skip to content

Instantly share code, notes, and snippets.

@danchoi
Last active August 29, 2015 14:06
Show Gist options
  • Save danchoi/d9b48976d16876017c28 to your computer and use it in GitHub Desktop.
Save danchoi/d9b48976d16876017c28 to your computer and use it in GitHub Desktop.
HaXml SAX example
[(N "AnalystId",264201849),(N "PersonID",22744894),(N "FirstName",Brian),(N "LastName",Purdy),(N "MiddleName",G.),(N "CurrentProFlag",true),(N "HasResearchFlag",true),(N "ContributorShortName",PI Financial Corp.),(N "EmailAddress",[email protected]),(N "PhoneNumber",403-543-2823),(N "Prefix",Mr.),(N "ResearchContributorId",928),(N "Suffix",CFA, P.E.),(N "Title",Energy Services Analyst)]
[(N "AnalystId",52747961),(N "PersonID",52747958),(N "FirstName",Mark),(N "LastName",Purdy),(N "CurrentProFlag",false),(N "HasResearchFlag",true),(N "ContributorShortName",Deutsche Bank),(N "Prefix",Mr.),(N "ResearchContributorId",5),(N "Title",Equity Analyst)]
module Main where
import Text.XML.HaXml.SAX
proc (SaxElementOpen "ResearchAnalystInfo" xs) = do
print xs
proc _ = return ()
main = do
c <- getContents
let (elems, _) = saxParse "analyst_y.xml" c
mapM_ proc elems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment