4

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>
Mohamad
  • 1,089
  • 4
  • 19
  • 37
  • 4
    Surely you just read what's inside the – David Heffernan Oct 12 '11 at 08:02

1 Answers1

7

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;
gabr
  • 26,580
  • 9
  • 75
  • 141