delphi 10 生成XML文件时 无法生成 语言信息 encoding
delphi 7 下正常 berlin tokyo均无效
示例代码如下
aXml.BackXml.Active := True;
aXml.BackXml.Version := '1.0';
aXml.BackXml.Encoding :='GBK';
aXml.XmlNode :=aXml.BackXml.CreateNode('document');
aXml.BackXml.DocumentElement := aXml.XmlNode;
aXml.XmlHead := aXml.BackXml.CreateNode('head');
aXml.XmlNode.ChildNodes.Add(aXml.XmlHead);
//交易代码
aXml.XmlNodeSecond:=aXml.BackXml.CreateNode('trans_type');
aXml.XmlHead.ChildNodes.Add(aXml.XmlNodeSecond);
aXml.XmlNodeSecond.Text:='100';
输出显示结果
<?xml version="1.0"?>
<document><head><trans_type>100</trans_type></head></document>
正常应该是
<?xml version="1.0" encoding="GBK"?><document><head><trans_type>100</trans_type></head></document>
少了 encoding="GBK"