سؤال

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.

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top