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

Stack overflow with large number of child nodes #15

Open mdiep opened 3 years ago

mdiep commented 3 years ago

If an XML node has a large number of child nodes, the children function will overflow the stack because it cannot be tail-call optimized as written.

$ elm repl
---- Elm 0.19.1 ----------------------------------------------------------------
Say :help for help and :exit to exit! More at <https://elm-lang.org/0.19.1/repl>
--------------------------------------------------------------------------------
> import XmlParser
> XmlParser.parse ("<parent>" ++ String.repeat 2000 "<child></child>" ++ "</parent>")
RangeError: Maximum call stack size exceeded
miniBill commented 1 year ago

https://github.com/miniBill/elm-xml-parser fixes this