The sample code below
AXml. BackXml. Active:=True;
AXml. BackXml. Version:='1.0';
GBK aXml. BackXml. Encoding:=' ';
AXml. XmlNode:=aXml. BackXml. CreateNode (' document ');
AXml. BackXml. DocumentElement:=aXml. XmlNode;
AXml. XmlHead:=aXml. BackXml. CreateNode (" head ");
AXml. XmlNode..childnodes. Add (aXml. XmlHead);
//transaction code
AXml. XmlNodeSecond:=aXml. BackXml. CreateNode (' trans_type ');
AXml. XmlHead..childnodes. Add (aXml. XmlNodeSecond);
AXml. XmlNodeSecond. Text:='100';
Output shows the results
<? The XML version="1.0"?>
Normal should be
<? The XML version="1.0" encoding="GBK"?>
Less encoding="GBK"
CodePudding user response:
Yes, the feeling is a BUG but I haven't got the repairUsing XML, Text and SaveToXML are lost code
Using SaveToStream not
See I done before test: https://www.cnblogs.com/lzl_17948876/p/3829183.html
CodePudding user response:
Is not a BUG, SaveToXML is endures a string/WideString/UTF8String D2009 string is after the unicode, WideString is unicode, if you point out a non unicode, save that the content of the XML in a string? So it can only remove the XML encoding of the head field and converted to unicode store, if you save to UTF8String, encoding field will appear,