jinjor / elm-xml-parser

XML parser for Elm
http://package.elm-lang.org/packages/jinjor/elm-xml-parser/latest
BSD 3-Clause "New" or "Revised" License
21 stars 10 forks source link

Fix stack overflow with CData edge case #9

Open edwardsnjd opened 5 years ago

edwardsnjd commented 5 years ago

Thanks for this great library!

I hit an issue when parsing CData content ending with a square bracket, ]:

<a>
  <![CDATA[ note extra sq bracket here ->]]]>
</a>

I added some tests for this case and had a go at making them all pass again. My understanding of the spec is that nothing is parsed inside the CData content so we can safely chomp until the end token: https://www.w3.org/TR/REC-xml/#sec-cdata-sect

I'm an elm newcomer and didn't fully understand the existing implementation, so would appreciate any input.