NativeXml Help
Example A: Loading/saving/export of XML
This example shows how to load an XML document and then export it in readable format to a TMemo field.

Drop a TEdit (Edit1), TButton (Button1) and a TMemo on your form, then connect the code below to the OnClick event of the button. Fill in the filename in Edit1, then click the button and you will see the contents of the XML file listed in the memo control.

procedure TForm1.Button1Click(Sender: TObject);
var
  ADoc: TNativeXml;
begin
  Memo1.Lines.Clear;
  ADoc := TNativeXml.Create;
  try
    ADoc.LoadFromFile(Edit1.Text);
    ADoc.XmlFormat := xfReadable;
    Memo1.Lines.Text := ADoc.WriteToString;
  finally
    ADoc.Free;
  end;
end;
Note that ADoc.XmlFormat := xfReadable will make sure that the document is listed in readable form (with carriage returns and indents).