Reputation: 1117
How can I extract CData from a XML file with Delphi ? this is my XML file:
<?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>
Upvotes: 4
Views: 3577
Reputation: 26840
With OmniXML you would do:
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;
Upvotes: 7