Questions tagged [xml-conduit]

A Haskell conduit-based XML parsing library

xml-conduit is a Haskell XML parsing frame work built ontop of conduit

26 questions
1
vote
1 answer

Select nodes matching one of several conditions (OR)

Using Text.XML.Cursor, is there a convenient way of selecting nodes matching one of several conditions (like an or function)? How can I get the cursors of all

and

nodes (in the right order) in the following example?
snøreven
  • 1,904
  • 2
  • 19
  • 39

1
vote
1 answer

Parsing elements with namespace etc. in XML

This question is about how to parse xml content with xmlns attributes etc. I wrote code to parse it which works. I will appreciate pointers on whether it can be done better. I have an XML file test.xml as below:
Sal
  • 4,312
  • 1
  • 17
  • 26
1
vote
1 answer

Not sure how to parse this using Text.XML.Cursor

I'm trying to parse XML that looks like this:

Collection A

Property 1Property 2

Collection 2

Property 1Property 88
I would like to parse that info as…
davorb
  • 613
  • 1
  • 9
  • 17
1
vote
1 answer

How to ignore unclosed tags in XML or HTML?

I'm writing a parser in Haskell for the site using the packages Text.XML and Text.XML.Cursor. There are unclosed tags and get an error: Main.hs: Error parsing XML file dat.html: 29:1-29:8: Expected end element for: Name {nameLocalName = "br",…
1
vote
2 answers

case insensitive tag matching with xml-conduit?

What's the best way to perform case-insensitive tag and attribute name matching using xml-conduit? For example, consider the findNodes function from the HTML parsing example on FP Complete's School of…
ErikR
  • 51,541
  • 9
  • 73
  • 124
0
votes
0 answers

How to check on nodes' content in Text.XML.Cursor?

I have this XPath works with xmllint //td[text() = 'USD']/../td[6]/text() Now I want it to be done in Haskell. But following (not complete of the original XPath) does not work at all. I got empty list error on head. cur $// element "td" &// check…
Magicloud
  • 818
  • 1
  • 7
  • 17
0
votes
1 answer

Using xml-conduit how to parse mediawiki dump files

I am trying to parse mediawiki dump files using xml-conduit. There are two tags that I am interested in, SiteInfo and Page. Here is a sample xml: https://gist.github.com/shadow-fox/7ff8df7a953e0ca9534bef45700686fe {-# LANGUAGE OverloadedStrings…
Pranaya Behera
  • 545
  • 1
  • 9
  • 24
0
votes
1 answer

xml-conduit parse xml attributes

Parsing XML with xml-conduit I stumbled upon the following problem: when I have multiple attributes, with the same base name but different prefixes only the first in (lexical) order. How can I get the prefixed values if both a prefixed and…
epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74
0
votes
1 answer

xml-conduit - combining tagParsers

I have been trying to parse an XML-datastructure with xml-conduit, which seems to work after a bit of learning. But what I am now stuck on is the following. Given a list of tag-parsers how do I use choose to combine them data SumType = A Text | B…
epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74
0
votes
1 answer

html-conduit (HTML -> XHTML in Haskell)

I am a beginner to Haskell. I have some code that uses xml-conduit, and it's all working well, I am able to transform it as I want. let src_file = "blah.xhtml" Document prologue root epilogue <- readFile def{psDecodeEntities=decodeHtmlEntities}…
user2633351
  • 173
  • 4
0
votes
0 answers

How can I extract the tags and content of children using xml-conduit?

UPDATE: After many different attempts I have for now concluded that the behaviour seen below is expected and that I am only running into difficulties because I am using ToJson later on. Will update if I solve it…
Tom
  • 1
  • 2
1
2