(XML editor dialog) Hide whitespace nodes outside of text elements even when xml:space="preserve" is in root node

Migrated from https://bugs.launchpad.net/inkscape/+bug/167125

Steps to reproduce:

  • Open a file with xml:space="preserve" in the root node that still has formatting applied: test_bug.svg
  • Open XML editor dialog
  • See newlines littering the text

image

What should have happened?

Content nodes that are outside the text nodes are hidden.

I'm focussing on those nodes that are purely whitespace, but I think it'd be an invalid svg if it had text outside the text nodes? Not sure.

Inkscape Version and Operating System:

1.1-dev (9cc6961eb1, 2020-03-09) Linux Mint 19.1
0.92.3 ppa Linux Mint 19.1 (note that newlines are displayed as newlines, not the NL character
0.43-2 win32 on Windows 10 (tested to see what OP saw. Its more or less the same as 0.92.3)

Edited by Nathan Lee