how add encoding into xml for export

george175george175 Member Posts: 26
Hello everybody,

how can I add encode - into xml? :-) i need this - <?xml version="1.0" encoding="UTF-8"?>
from this <?xml version="1.0"?>

Iam using XML DOM Management for creating xml


<?xml version="1.0"?>

-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1="http://www.teccom-eu.net/wsdl"&gt;
-<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot; xmlns:s="http://schemas.xmlsoap.org/soap/envelope/&quot; s:mustUnderstand="1">
-<o:UsernameToken xmlns:u="http://www.teccom-eu.net/wsdl&quot; u:Id="uuid-441ec92f-002a-4c40-adea-a40eb7159b2e">
<o:Username>6790000000930</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TcCUser_2006!</o:Password&gt;
</o:UsernameToken>
</o:Security>
-<SOAP-ENV:Body>
-<ProcessRequest>
<RequestElement> <FunctionCallRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;



thx Everyone

Answers

  • Remco_ReinkingRemco_Reinking Member Posts: 74
    <?xml version="1.0" encoding="utf-8" ?>
  • george175george175 Member Posts: 26
    <?xml version="1.0" encoding="utf-8" ?>

    How can I insert encoding="utf-8" into xml header please?
  • Remco_ReinkingRemco_Reinking Member Posts: 74
    My answer was a bit short, but in stead of
    <?xml version="1.0"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://sch.................
    

    you should start it with
    <?xml version="1.0" encoding="utf-8" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://sch..................
    

    That's alll.
  • george175george175 Member Posts: 26
    My answer was a bit short, but in stead of
    <?xml version="1.0"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://sch.................
    

    you should start it with
    <?xml version="1.0" encoding="utf-8" ?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://sch..................
    

    That's alll.

    Yes, but problem is, that I need to put this automatically with function in NAV. I have to connect two system with web services and second one
    requires encoding in xml header.

    XMLDOMMgt create xml just with <?xml version="1.0"?> instead this <?xml version="1.0" encoding="utf-8" ?> :(
  • george175george175 Member Posts: 26

    XMLDeclaration := XmlDoc.CreateXmlDeclaration('1.0','UTF-8','');
    XmlDoc.AppendChild(XMLDeclaration);

    put this before root element


    Name DataType Subtype Length
    XMLDeclaration DotNet System.Xml.XmlDeclaration.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
  • micieborismicieboris Member Posts: 7
    In the XML DOM Management codeunit, there is a function called 'AddDeclaration' (Can't say if it's for all versions). You can use that one. It does just the same as what george175 mentioned:

    XMLDOMMgt.AddDeclaration(XmlDoc,'1.0','UTF-8','');
  • timosman369timosman369 Member Posts: 16
    George,

    Are you able to share your code? I'm trying to do the same but I don't have code which add ANY declaration. Even when I'm adding (or trying) it doesn't add it or errors...

    I have tried to create node with 'processinginstruction' type, insertbefore function, createxmldeclaration, and few more but it still doesn't display what I want to.


    Please help.
Sign In or Register to comment.