module Text.HTML.Yuuko where
import Text.XML.HXT.Arrow
import qualified Text.XML.HXT.Arrow.XPathSimple as XS
import System.IO.Unsafe
yuuko :: String -> String -> [String]
yuuko = yuuko_base [(a_parse_html, v_1)]
yuuko_xml :: String -> String -> [String]
yuuko_xml = yuuko_base [(a_ignore_none_xml_contents, v_1)]
yuuko_base :: [(String, String)] -> String -> String -> [String]
yuuko_base args expr s = unsafePerformIO $
runX process
where
read_args =
[ (a_validate, v_0)
, (a_issue_warnings, v_0)
]
++ args
write_args =
[ (a_encoding, utf8)
, (a_no_xml_pi, v_0 )
]
process =
readString read_args s
>>> XS.getXPathTreesInDoc expr
>>> writeDocumentToString write_args