D
D
domanskiy2019-08-27 17:09:31
VBScript
domanskiy, 2019-08-27 17:09:31

How to save formatted XML with comments using MSXML2.MXXMLWriter from VBScript?

There is VBScript that creates an XML file.
To make the XML look human readable, I use MSXML2.MXXMLWriter. But when using this library, all comments are removed from the XML.
I create comments like this:

Set xmlParser = CreateObject("Msxml2.DOMDocument")

'Создание объявления XML
xmlParser.appendChild(xmlParser.createProcessingInstruction("xml", "version='1.0' encoding='windows-1251'"))
'Создание комментария
xmlParser.appendChild(xmlParser.createComment("Текст комментария"))

If you just write an XML file , then there are comments in the file.
xmlParser.save("C:\Test.xml")

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question