A bug about the Delphi XML processing Unit

Source: Internet
Author: User

XML processing Unit xmldoc using Delphi xmlintf

When getting the XML text content, the higher version of Delphi loses the encoding description .... On the D7 is normal, the following is the test source:

Procedure Tform1.button1click (sender:tobject); var  nxmldoc:ixmldocument;  I:integer;  Nms:tmemorystream;  Nss:tstringstream;  Nstr:string;begin  Nxmldoc: = Txmldocument.create (nil);  Nxmldoc.active: = True;  Nxmldoc.encoding: = ' GB2312 ';  Nxmldoc.addchild (' test ');  For I: = 0 to 4 do    nXMLDoc.DocumentElement.AddChild (' Test '). NodeValue: = i;  With Memo1 do  begin    Lines.clear;    Lines.add ('----nXMLDoc.XML.Text----');    Lines.add (");    Lines.add (nXMLDoc.XML.Text);  End;  NMS: = tmemorystream.create;  Nxmldoc.savetostream (NMS);  Nms. Position: = 0;  With Memo2 do  begin    Lines.clear;    Lines.loadfromstream (NMS);    Lines.insert (0, ");    Lines.insert (0, '----nxmldoc.savetostream----');  End;  Nms.free;  Nxmldoc.savetoxml (NSTR);  With Memo3 do  begin    Lines.clear;    Lines.add ('----nxmldoc.savetoxml----');    Lines.add (");    Lines.add (NSTR);  End;end;

The following is the same code for the execution effect in Delphi7 and Delphi2010 respectively

Comparisons can be found in XML. Text and SaveToXML These 2 methods, on 2010, input later encoding= "GB2312" encoding information will be lost

Version tests that use XE5 are also lost, only normal on D7

Delphi7 Results

Delph2010 Results

Http://www.cnblogs.com/hs-kill/p/3829183.html

A bug about the Delphi XML processing Unit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.