Simple way to use XML in Delphi  
         
 samples
Sample 1. Create a simple XML document and save it to file.
Sample 2. Use helper functions to save class properties.

Sample 1. Create a simple XML document and save it to file.
program simple;

uses OmniXML;

var
  XMLDoc: IXMLDocument;

begin
  XMLDoc := CreateXMLDoc;
  XMLDoc.DocumentElement := XMLDoc.CreateElement('root');
  XMLDoc.DocumentElement.SetAttribute('attr', 'value');
  XMLDoc.Save('document.xml');
end.
Sample 2. Use helper functions to save class properties (note: class should be derived from TPersistent and properties should be published).
program persistent;

uses
  Classes, OmniXML, OmniXMLPersistent;

type
  TmyXML = class(TPersistent)
  private
    FSomeNumber: Integer;
    FSomeString: String;
  published
    property SomeNumber: Integer read FSomeNumber write FSomeNumber;
    property SomeString: String read FSomeString write FSomeString;
  end;

var
  myXML: TmyXML;

begin
  myXML := TmyXML.Create;
  try
    myXML.SomeString := 'cool';
    TOmniXMLWriter.SaveToFile(myXML, 'filename.xml', pfNodes, ofIndent);
  finally
    myXML.Free;
  end;
end.