I'm using Text.XML.Stream.Parse
from xml-conduit
to parse a large XML file.
My inner parser looks like this:
parseUserRow = tagName "row" (requireAttr "name") $ \name -> do -- [....]
When running it, I get a long error message like this:
xmltest.hs: UnparsedAttributes -- [...]
How can I resolve this issue?
Note: This question was answered by the asker immediately so it intentionally does not show any research effort.
The
ignoreAttrs
documentation explicitly states that it shall be run afterrequireAttr
.The only question is how to combine these.
AttrParser
has aControl.Applicative
instance. Therefore you can combine it with one of theApplicative
operators.Note that while
requireAttr <tagname>
has the value typeAttrParser Text
,ignoreÀttrs
has the no-value-typeAttrParser ()
. This means, you can't use the<*>
operator.<*
, however, is suitable for that purpose.Example: