Feature Request: Option to preserve whitespace#4

openedMar 7, 2026byCcncptpr

I have noticed, that this library normalizes all whitespace. Meaning all (consecutive) spaces, tabs and new lines, are being transformed into one space. I noticed that, while trying to parse an iCalender string, extracted from a CalDAV XML response, that was missing all its valuable new lines.

I only needed (and ever used) the Erlang XML parser, where it was as simple as changing normalize to preserve in

erlang
1{Elem, _} = xmerl_scan:string(binary_to_list(XmlBin), [{space, normalize}]),

I would gladly contribute this change back, but:

  • normalization could make sense in other cases than mine, so giving a user the choice would probably be good.
  • I have no idea whether it is an equally easy change for the JavaScript XML parser.

Would this be a wanted addition? Can this behavior be changed for JS?