Adding <?xml version="1.0" encoding="UTF-8"?> to XML DomDoc

DHendriksenDHendriksen Member Posts: 32
Hi all,

I have a codeunit where an XML Dom DOC is generated. This all works. But there is no XML declaration like <?xml version="1.0" encoding="UTF-8"?> in the XMl document.
I use the 'Microsoft XML, v5.0'.DOMDocument automation.

Does anybody know how to do this?

Thanx in advance.

Greetings,
Don

Comments

  • kapamaroukapamarou Member Posts: 1,152
    Somewhere I've used the following:


    XMLDomInst := XMLDomDocument.createProcessingInstruction('xml','version="1.0" encoding="UTF-8"');

    XMLDomNode := XMLDomDocument.appendChild(XMLDomInst);

    XMLDomDocument is -> ''Microsoft XML, v6.0'.DOMDocument60'
    XMLDomInst is -> 'Microsoft XML, v6.0'.IXMLDOMProcessingInstruction
    XMLDomNode is -> ''Microsoft XML, v6.0'.IXMLDOMNode'

    I suppose it is the same in 5... :?:
  • ara3nara3n Member Posts: 9,256
    you need to use xmldom.createProcessingInstruction function.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • DHendriksenDHendriksen Member Posts: 32
    Gentlemen,

    It works fine! ProcessingInstruction, I will never forget this.

    Thanx a lot.

    Don
  • ara3nara3n Member Posts: 9,256
    although I was a bit late answering, you are welcome. As far as never forgetting this. Give it some time. :wink:
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kapamaroukapamarou Member Posts: 1,152
    ara3n wrote:
    As far as never forgetting this. Give it some time. :wink:

    True... How many times we look back to remember how we accomplished something in the past. And then it is... Copy/Paste :oops:
Sign In or Register to comment.