Create XML using XML DOM. How can I set charset?

frgustofrgusto Member Posts: 32
I'm using codeunit XML DOM Management to create an XML file.
XML DOM Management use 'Microsoft XML, v3.0'.DOMDocument.

How can I set charset for the XML file?

I'd like to use charset ISO 8859-1 for the file.

Thankyou,
Fredrik Gustafsson

Comments

  • kokkok Member Posts: 10
    :)


    OleProcInstr := XMLReport.createProcessingInstruction('xml',
    ' version="1.0" encoding="' + TxtEncoding + '"');

    TxtEncoding = your charset (you can change it)

    check CU 12408
  • frgustofrgusto Member Posts: 32
    Thanks a lot!

    CU 12408 is not a standard CU? I can't find it.
  • kokkok Member Posts: 10
    Name DataType Subtype Length
    XMLReport Automation 'Microsoft XML, v2.6'.FreeThreadedDOMDocument

    CreateXMLDoc(VAR OleXMLDoc : Automation "Unknown Automation Server.Unknown Class";TxtEncoding : Text[60];VAR OleRootNode : Automation "
    XMLReport := OleXMLDoc;
    IF ISCLEAR(XMLReport) THEN
    CREATE(XMLReport);

    OleProcInstr := XMLReport.createProcessingInstruction('xml',
    ' version="1.0" encoding="' + TxtEncoding + '"');
    XMLReport.appendChild(OleProcInstr);
    CLEAR(OleProcInstr);

    OleRootNode := XMLReport.createElement(TxtRootTagName);
    XMLReport.appendChild(OleRootNode);
  • garakgarak Member Posts: 3,263
    edited 2008-06-27
    this information is stored in the xml Header. so take a look into Codeunits 6224 .. 6226 or 7902

    Regards
    Do you make it right, it works too!
  • kokkok Member Posts: 10
    Name DataType Subtype Length
    ProcInstr Automation 'Microsoft XML, v2.6'.IXMLDOMProcessingInstruction
    Var Name DataType Subtype Length
    Íåò Encoding Text 60


    AddXMLHeader(Encoding : Text[60])
    ProcInstr := XMLReport.createProcessingInstruction('xml',
    ' version="1.0" encoding="' + Encoding + '"');
    XMLReport.appendChild(ProcInstr);
    CLEAR(ProcInstr);
  • frgustofrgusto Member Posts: 32
    Finally found cu 7902:
    CREATE(XMLDoc);
    
    IF XMLDeclaration THEN BEGIN
      XMLNewProcessInst := XMLDoc.createProcessingInstruction('xml','version="1.0" encoding="UTF-8"');
      XMLDoc.appendChild(XMLNewProcessInst);
    END;
    
Sign In or Register to comment.