EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SaveToStream remove namespace

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#11161
Posted: 09/28/2009 12:55:56
by Gabriel Herdt (Standard support level)
Joined: 04/09/2008
Posts: 37

Hi again,
In my procedure

Parameter FXMLDocument.OuterXML have value =
Code
Code
Parameter have value= <?xml version="1.0" encoding="utf-8"?>
<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.10"><idLote>38310</idLote><NFe xmlns="http://www.portalfiscal.inf.br/nfe"> ...    


But save value =
Code

Parameter have value= <?xml version="1.0" encoding="utf-8"?>
<enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.10"><idLote>38310</idLote><NFe> ...



I Can Resolve this problem? My Tag <NFe> differs.

Code
Procedure TRDmConBas.SalvaArq(Caminho: string);
var
  F: {$ifndef DELPHI_NET}TFileStream{$else}FileStream{$endif};
begin
  {$ifndef DELPHI_NET}
  F := TFileStream.Create(Caminho, fmCreate or fmOpenWrite);
  {$else}
  F := System.IO.FileStream.Create(Caminho, FileMode.Create, FileAccess.ReadWrite);
  {$endif}
  try
    MessageDlg('salva- '+FXMLDocument.OuterXML, mtWarning, [mbOK], 0);
    FXMLDocument.SaveToStream(F, xcmCanon, 'utf-8');
  except
    on E : Exception do
    begin
      MessageDlg('Error: ' + E.Message, mtError, [mbOk], 0);
    end;
  end;

  FreeAndNil(F);
end;


Gabriel Herdt
Consystec
#11162
Posted: 09/28/2009 13:14:49
by Eugene Mayevski (EldoS Corp.)

Please specify how you obtain the original XML - do you load it or you create it on-the-fly?


Sincerely yours
Eugene Mayevski
#11163
Posted: 09/28/2009 13:22:35
by Dmytro Bogatskyy (EldoS Corp.)

Quote
I Can Resolve this problem? My Tag <NFe> differs.
...
FXMLDocument.SaveToStream(F, xcmCanon, 'utf-8');

The solution is not to save xml document in the canonical form. (Use xcmNone parameter for SaveToStream method.)
The canonicalization removes superfluous namespace declarations from each element.
#11164
Posted: 09/28/2009 13:42:19
by Gabriel Herdt (Standard support level)
Joined: 04/09/2008
Posts: 37

Thanks for help.
Resolved!


Gabriel Herdt
Consystec

Reply

Statistics

Topic viewed 1391 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!