Skip to content

Commit

Permalink
query-converter/XPath.hs: add function parseXPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-H committed Mar 1, 2018
1 parent 776197a commit 32ef57e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion query-converter/XPath.hs
Expand Up @@ -12,10 +12,12 @@ import ErrM
import Data.Char (isDigit)

execXPath :: String -> [Document] -> IO ()
execXPath s docs = putStrLn $ case pXPath (myLexer s) of
execXPath s docs = putStrLn $ case parseXPath s of
Ok x -> prXPValue $ queryXPath x docs
Bad s -> s

parseXPath = pXPath . myLexer

queryXPath :: XPath -> [Document] -> XPValue
queryXPath xp docs = getXPValues $ concatMap (matchXPath xp) [el | DXML _ _ el <- docs]

Expand Down

0 comments on commit 32ef57e

Please sign in to comment.