1

I've created a new element/tag with doc->createElement named file, and then appended that to my files tag as a child element. After adding a few file-tags, the output in the xml file looks like this:

<file/><file/><file/><file/><file/></files>

My problem is that it isn't nicely formatted, like so:

<file/>
<file/>
<file/>

Is there any way to add whitespaces in between the elements after CreateElement and AppendChild? I've checked out Doc->put_preserveWhiteSpace, but that does just seem to set whether or not you keep whitespaces from the original XML document.

Boehmi
  • 951
  • 3
  • 9
  • 20
  • For me following solution has worked: https://stackoverflow.com/questions/36408049#36408781 – Paul Feb 08 '21 at 10:18

1 Answers1

2

Have you tried simply appending a "text" node with a new line after each <file/>?

ankon
  • 4,128
  • 2
  • 26
  • 26