UweSchmidt / hxt

Haskell XML Toolbox
http://www.fh-wedel.de/~si/HXmlToolbox/index.html
124 stars 35 forks source link

No opening tag found for </img> #69

Open FintanH opened 7 years ago

FintanH commented 7 years ago

When parsing an <img> element with a corresponding closing tag </img> the parser thinks there was no opening tag for the closing tag. This means to elements get generated as shown below.

*Text.XML.HXT.Core λ> let doc = readString [withParseHTML yes, withRemoveWS yes, withWarnings yes] "<img src=\"some/url\" alt=\"alt\"></img>"

*Text.XML.HXT.Core λ> children <- runX $ doc >>> getChildren

warning: ""<img src=\"some/url\" alt=\"alt\"></img>"" (line 1, column 36) no opening tag found for </img>
*Text.XML.HXT.Core λ> children
[NTree (XTag "img" [NTree (XAttr "src") [NTree (XText "some/url") []],NTree (XAttr "alt") [NTree (XText "alt") []]]) [],NTree (XTag "img" []) []]

I'm using hxt 9.3.1.16