XML 注释和 Delphi XMl 数据绑定
有人对 delphi 中的注释 和 XML 数据绑定感兴趣吗?我尝试使用向导加载 xml,但出现错误。 XML 看起来像这样:
<!-- For more info go: https://www.energia.ee/et/home/electricity/rates -->
<settings>
<!-- Electrical energy basic rate (Elektrienergia põhitariif) -->
<electrical_basic_rate>3.19</electrical_basic_rate>
<!-- Network service basic rate (Võrguteenuse põhitariif) -->
<network_service_basic_rate>4.13</network_service_basic_rate>
<!-- Renewable energy charge (Taastuvenergia tasu) -->
<renewable_energy_charge>0.61</renewable_energy_charge>
<!-- Electricity excise tax (Elektriaktsiis) -->
<electricity_excise_tax>0.447</electricity_excise_tax>
</settings>
我在 3 维线上收到错误。错误消息如下所示:
奇怪的是第一条评论没有给出错误。对我来说看起来像一个 Delphi XE bug..
Have anybody had a isse with comments <!--´comment -->
and XML data binding in delphi. Im tryng to load the xml with the wizard but im getting error. XML looks like this:
<!-- For more info go: https://www.energia.ee/et/home/electricity/rates -->
<settings>
<!-- Electrical energy basic rate (Elektrienergia põhitariif) -->
<electrical_basic_rate>3.19</electrical_basic_rate>
<!-- Network service basic rate (Võrguteenuse põhitariif) -->
<network_service_basic_rate>4.13</network_service_basic_rate>
<!-- Renewable energy charge (Taastuvenergia tasu) -->
<renewable_energy_charge>0.61</renewable_energy_charge>
<!-- Electricity excise tax (Elektriaktsiis) -->
<electricity_excise_tax>0.447</electricity_excise_tax>
</settings>
I get error on the 3-d line. Error message looks like this:
Strange is that the first comment is not giving a error. Looks like a Delphi XE bug to me..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它实际上是因为这个
õ
字符而损坏的,我将它们全部更改为o
并且它起作用了。我添加了
将文件从 ANSI 转换为 UTF-8
它按预期工作,带有
õ
字符。如果您使用 UTF-8 编码而不是 ANSI,它也可以在没有编码行的情况下工作
It's actually broken because of this
õ
character, I changed them all too
and it worked.I added
<?xml version="1.0" encoding="UTF-8"?>
the converted the file from ANSI to UTF-8and it worked as expected, with the
õ
character.It also works with out the encoding line if you use a UTF-8 Encoding instead of ANSI