Questions tagged [hxt]

The Haskell XML Toolbox (HXT) is a collection of tools for processing XML with Haskell.

The Haskell XML Toolbox (HXT) is a collection of tools for processing XML with Haskell.

Links

109 questions
27
votes
2 answers

Running Haskell HXT outside of IO?

All the examples I've seen so far using the Haskell XML toolkit, HXT, uses runX to execute the parser. runX runs inside the IO monad. Is there a way of using this XML parser outside of IO? Seems to be a pure operation to me, don't understand why I'm…
Muchin
  • 4,887
  • 4
  • 23
  • 25
8
votes
1 answer

Is it possible to use Text or ByteString on HXT in Haskell?

I think HXT, a XML/HTML processing library in Haskell, has really flexible and powerful methods for traversing and manipulating DOM trees by Arrows. http://adit.io/posts/2012-04-14-working_with_HTML_in_haskell.html It seems, however, HXT has only…
Hiro
  • 475
  • 4
  • 11
7
votes
1 answer

How do i replace Nodes in HXT?

Given a sample xml file: Content Content how do i replace every tag with a different tag so i get a different file:
fho
  • 6,787
  • 26
  • 71
7
votes
1 answer

HXT: Left-Factoring Nondeterministic Arrows?

I'm trying to come to terms with Haskell's XML Toolbox (HXT) and I'm hitting a wall somewhere, because I don't seem to fully grasp arrows as a computational tool. Here's my problem, which I hoped to illustrate a little better using a GHCi session: >…
Aleksandar Dimitrov
  • 9,275
  • 3
  • 41
  • 48
7
votes
1 answer

How to validate XML (via an XSD file) in Haskell?

I am already using HXT for transforming XML. Now I want to validate the input and output against a XSD-file. HXT only seem to include RELAXNG and DTD validators. I don't really care to use something else for just validating.
maxschlepzig
  • 35,645
  • 14
  • 145
  • 182
7
votes
1 answer

What's Haskell's attitude towards Unicode in XML?

I want to know what is the official solution to processing Unicode XML in Haskell is. I notice that HXT uses a simple String representation (a list of Unicode characters!!!) for…
fatuhoku
  • 4,815
  • 3
  • 30
  • 70
6
votes
1 answer

Calling an IO Monad inside an Arrow

Perhaps I'm going about this the wrong way, but I'm using HXT to read in some vertex data that I'd like to use in an array in HOpenGL. Vertex arrays need to be a Ptr which is created by calling newArray. Unfortunately newArray returns an IO Ptr, so…
John
  • 452
  • 2
  • 14
6
votes
1 answer

Counting and filtering Arrow for HXT

I'm trying to parse an XML, but I want to filter and extract only a determinate number of children from a given node. For example: And then if I execute…
Jorge Diz
  • 85
  • 3
6
votes
3 answers

Haskell HXT for extracting a list of values

I'm trying to figure my way through HXT with XPath and arrows at the same time and I'm completely stuck on how to think through this problem. I've got the following HTML:
a
b
Muchin
  • 4,887
  • 4
  • 23
  • 25
6
votes
2 answers

Avoid long tuple definitions in haskell

For my work with hxt I implemented the following function: -- | Construction of a 8 argument arrow from a 8-ary function. Same -- implementation as in @Control.Arrow.ArrowList.arr4@. arr8 :: ArrowList a => (b1 -> b2 -> b3 -> b4 -> b5 -> b6 -> b7 ->…
Stephan Kulla
  • 4,739
  • 3
  • 26
  • 35
5
votes
1 answer

Arrows/HXT and Type Signatures

I am trying to learn Arrows in Haskell, so I am writing a simple application with the arrow based HXT library for XML. The examples in the HXT wikis and tutorials forgo function type signatures. However, I am quite fond of types and am trying to…
providence
  • 29,135
  • 13
  • 46
  • 62
5
votes
1 answer

HXT: Surprising behavior when reading and writing HTML to String in pure code

I want to read HTML from a String, process it and return the changed document as a String using HXT. As this operation does not require IO, I would rather execute the Arrow with runLA than with runX. The code look like this (omitting the processing…
jgre
  • 787
  • 5
  • 11
5
votes
1 answer

Getting Data from a Simple XML

I am trying to extract some data from an XML input with 6 lines, using HXT. I want to keep HXT, too, because of the Curl integration and because I have other XML files with thousands of lines, later. My XML looks like this:
Lanbo
  • 15,118
  • 16
  • 70
  • 147
5
votes
1 answer

Extracting Values from a Subtree

I am parsing an XML file with HXT and I am trying to break up some of the node extraction into modular pieces (I have been using this as my guide). Unfortunately, I cannot figure out how to apply some of the selectors once I do the first level…
Ecognium
  • 2,046
  • 1
  • 19
  • 35
5
votes
1 answer

HXT ignoring HTML DTD, replacing it with XML DTD

I'm having a bit of trouble figuring out why HXT is replacing my DTD's. Firstly, here is my input file to be parsed: foo

foo

and this is the output…
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
1
2 3 4 5 6 7 8