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
ignoreAttrsdocumentation explicitly states that it shall be run afterrequireAttr.The only question is how to combine these.
AttrParserhas aControl.Applicativeinstance. Therefore you can combine it with one of theApplicativeoperators.Note that while
requireAttr <tagname>has the value typeAttrParser Text,ignoreÀttrshas the no-value-typeAttrParser (). This means, you can't use the<*>operator.<*, however, is suitable for that purpose.Example: