elm-xml-parser icon indicating copy to clipboard operation
elm-xml-parser copied to clipboard

Stack overflow with large number of child nodes

Open mdiep opened this issue 3 years ago • 1 comments

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

mdiep avatar Jun 10 '21 13:06 mdiep

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

miniBill avatar Jul 12 '23 13:07 miniBill