gpt4 book ai didi

xml - Delphi 和 XML CDATA

转载 作者:数据小太阳 更新时间:2023-10-29 02:04:12 25 4
gpt4 key购买 nike

如何使用 Delphi 从 XML 文件中提取 CData?这是我的 XML 文件:

<?xml version="1.0"?>
<root>
<PartoBeetaXMLVersion value="0.1">
<VersionID value="111"/>
<Developer value="1Dev"/>
<CDate value="10/12/2011"/>
<Script>
<![CDATA[
alter table tblPersonels
add UID int null,
RID int null
]]>
</Script>
</PartoBeetaXMLVersion>
</root>

最佳答案

OmniXML你会这样做:

uses
OmniXML,
OmniXMLUtils;

function GetScriptCData(const fileName: string): string
var
xml: IXMLDocument;
begin
Result := '';
xml := CreateXMLDoc;
if XMLLoadFromFile(xml, fileName) then
Result := GetNodeCData(xml.SelectSingleNode('/root/PartoBeetaXMLVersion/Script'));
end;

关于xml - Delphi 和 XML CDATA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7736563/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com