<?xml version="1.0" encoding="UTF-16" standalone="no" ?> - <Mytest xmlns="http://www.w3.org/HTML/1998/html"> <String>tada</String> </Mytest>
OBJECT Report 50000 XML Import { OBJECT-PROPERTIES { Date=02/17/07; Time=[ 8:47:52 PM]; Modified=Yes; Version List=Example; } PROPERTIES { ProcessingOnly=Yes; OnInitReport=BEGIN FileName := 'c:\example.xml'; END; OnPostReport=BEGIN Process; MESSAGE('finished'); END; } DATAITEMS { } REQUESTFORM { PROPERTIES { Width=13090; Height=3520; SaveValues=Yes; } CONTROLS { { 1 ;TextBox ;3520 ;330 ;9350 ;440 ;AssistEdit=Yes; SourceExpr=FileName; OnAssistEdit=VAR FileDialog@1000000000 : Codeunit 412; BEGIN FileName := FileDialog.OpenFile('Hello ' + USERID + ' Please Select the XML File.','',4,'xml',0); END; } { 1000000003;Label ;220 ;330 ;3300 ;440 ;CaptionML=ENU=File Name } { 1000000000;CheckBox;3850;1100 ;440 ;440 ;ShowCaption=No; SourceExpr=Export } { 1000000001;Label ;110 ;1100 ;3300 ;440 ;CaptionML=ENU=Export } } } CODE { VAR Export@1000000000 : Boolean; FileName@1000000005 : Text[100]; Batch@1000000001 : Code[20]; Mytextline@1000000002 : Text[1000]; TempBlob@1000000003 : TEMPORARY Record 99008535; BinaryLine@1000000004 : Binary[1000]; Char@1000000006 : Char; I@1000000007 : Integer; NameSP@1000000008 : Text[100]; boo@1000000010 : Boolean; PROCEDURE Process@1000000001(); VAR myxml@1000000003 : XMLport 50000; myfile@1000000002 : File; Istream@1000000001 : InStream; Ostream@1000000000 : OutStream; BEGIN IF Export THEN BEGIN IF EXISTS(FileName) THEN ERASE(FileName); myfile.CREATE(FileName); myfile.CREATEOUTSTREAM(Ostream); myxml.SETDESTINATION(Ostream); myxml.EXPORT; myfile.CLOSE; END ELSE BEGIN TempBlob.Blob.CREATEOUTSTREAM(Ostream); myfile.OPEN(FileName); NameSP := 'xmlns="http://www.w3.org/HTML/1998/html"'; REPEAT CLEAR(BinaryLine); CLEAR(Mytextline); myfile.READ(BinaryLine); FOR I := 1 TO MAXSTRLEN(Mytextline) DO BEGIN Char := BinaryLine[I]; Mytextline := Mytextline + FORMAT(Char); END; //this is where I search for NameSP and delete it. IF STRPOS(Mytextline,NameSP) <> 0 THEN Mytextline := DELSTR(Mytextline,STRPOS(Mytextline,NameSP),STRLEN(NameSP)); CLEAR(BinaryLine); FOR I := 1 TO STRLEN(Mytextline) DO BEGIN Char := 0; Ostream.WRITE(Mytextline[I]); IF boo THEN BEGIN Ostream.WRITE(Char); END ELSE IF I > 2 THEN BEGIN Ostream.WRITE(Char); boo := TRUE; END; END; UNTIL myfile.LEN = myfile.POS; TempBlob.Blob.EXPORT('C:\newxml.xml',FALSE); CLEAR(Istream); TempBlob.Blob.CREATEINSTREAM(Istream); myxml.SETSOURCE(Istream); myxml.IMPORT; myfile.CLOSE; END; END; BEGIN END. } } OBJECT XMLport 50000 CustomsLink 7501 { OBJECT-PROPERTIES { Date=02/16/07; Time=[ 8:14:21 PM]; Modified=Yes; Version List=Example; } PROPERTIES { } ELEMENTS { { [{4A7B5064-43B7-4F89-819C-5E9BCB3842C4}]; ;Mytest ;Element ;Text ; VariableName=Mytest } { [{51DE76D0-B5D7-491F-AEE1-A1B3D6E308C6}];1 ;String ;Element ;Text ; VariableName=String; Export::OnBeforePassVariable=BEGIN String := 'tada'; END; } } EVENTS { } CODE { BEGIN END. } }
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
It worked directly!
=D>