web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

XMLPort Cdata

(1) ShareShare
ReportReport
Posted on by 108
I am try  to use XMlPort  with Cdata, this is the code:
 
xmlport 50150 PrintCdata
{
    Format = xml;
    Direction = Export;
    Encoding = UTF16;
 
    schema
    {
        textelement(NodeName1)
        {
            tableelement(NodeName2; /Purchase Header/)
            {
                fieldelement(NumeroOrden; NodeName2./No./) { }
 
                textelement(tipocdata1)
                {
 
                    trigger OnBeforePassVariable()
                    var
                        TempBlob: Codeunit /Temp Blob/;
                        tipocdata: XmlCData;
                        cadena, cadena2, cadena3, FileName : text;
                        OutStreamP: OutStream;
                        InStreamP: InStream;
                        i, cadenaCharNo : Integer;
                    begin
 
                        cadena := 'L';
                        tipocdata := XmlCData.Create(cadena);
                        tipocdata.WriteTo(cadena2);
                        tipocdata1 := cadena2;
 
 
 
                        //mlCData.WriteTo(WriteOptions: XmlWriteOptions, var Text: Text)
                        //tipocdata.WriteTo(cadena2);
 
                        //TempBlob.CreateOutStream(OutStreamP, TextEncoding::UTF8);
                        //OutStreamP.Write(cadena2);
                        //TempBlob.Run();
                        //TempBlob.CreateInStream(InStreamP);
                        //InStreamP.Read(cadena3);
 
                        // FileName := 'archicdata.txt';
                        // DownloadFromStream(InStreamP, 'Download XML Export', '', '', FileName);
                        //Message('tipodoc  %1', tipocdata);
                        /*
                                                for i := 1 to StrLen(cadena2) do begin
                                                    cadenaCharNo := cadena2[i];
                                                    Message('cadena %1', cadenaCharNo);
                                                end;
                                                */
                      
 
                    end;
 
                }
 
            }
 
        }
 
    }


 
}
 
The result is this :
 
 
<?xml version=/1.0/ encoding=/ISO-8859-2/ standalone=/no/?>
<NodeName1>
  <NodeName2>
    <NumeroOrden>FC0000053</NumeroOrden>
    <tipocdata1>&lt;![CDATA[L]]&gt;</tipocdata1>
  </NodeName2>
</NodeName1>
 
The file XML is writing a /&lt;! /   How can I modify this? 
 
I try with TempBlob, reading char by char,  nothig work. 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    102,123 Super User 2026 Season 1 on at
    Hi, there is a similar question below, I hope it can give you some tips.
     
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,556 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,028 Super User 2026 Season 1

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 877 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans