[Haskell-cafe] Predicates in HaXml
Tom Spencer
t.e.spencer at gmail.com
Sun Nov 21 06:52:51 EST 2004
> This is probably the simplest way of doing your specific task, but
> there are of course other ways. The tool Xtract has a parser for
> XPath-like expressions, including more complex predicates, which get
> translated directly to combinator-style accessors. Unfortunately,
> the set of combinators used in Xtract is slightly different from
> those in the rest of HaXml, but they bear a close relationship.
Before i start, I apologise for the simplicity of these questions, here goes:
I am just trying out a few things with the Xtract tool. I have a
simple XML document:
<greetings>
<greeting>hello</greeting>
<greeting>world</greeting>
</greetings>
I am using the Xtract query /greetings/greeting[1]/- hoping to get the
text "world"
e.g.
mkElem "h1" [applypred (keep) (parseXtract "/greetings/greeting[1]/-")]
but this just returns the entire xml document. Have i got something
fundamentally wrong here?
Thanks
Tom Spencer
More information about the Haskell-Cafe
mailing list