OmniXML by Kluug.net - fast XML library for Delphi & Lazarus

Latest Version

1.14 (2013/05/17)

Basic info

OmniXML by Kluug.net is an updated OmniXML version. Original code: www.omnixml.com.

OmniXML Features

Library design

  • Use the same XML library for all your Pascal projects including:
    1. Delphi VCL (Delphi 6 and newer).
    2. Delphi FMX on Windows/OSX (Delphi XE2 and newer).
    3. Delphi FMX on iOS: NEXTGEN compilers (Delphi XE4 and newer).
    4. Lazarus on Windows/Linux/OSX (Lazarus 1.0.8 and newer).
  • Native pascal object oriented code
  • No external dll libraries are required
  • Full unicode support even for D7, D2007
  • About 10 times faster than Delphi's built-in IXMLDocument

Kluug.net modifications

  • Version 1.14: NEXTGEN compiler (Delphi for iOS) support.
  • Version 1.11: Buffered read and write, improved compatibility with Delphi's IXmlDocument (thanks to Ralf Stocker).
  • Version 1.8: I found a bottleneck and was able to improve the performance significantly. Mostly these compilers were affected by the bottleneck: Delphi 6 - XE, Delphi OSX and Lazarus (everything except Delphi XE2+ VCL).
  • Native (and fully automatic) support of the the xml:space attribute.
  • Much more convenient interface.
  • FireMonkey support: Win32+Win64+MacOSX tested.
  • Lazarus support: Win32+Win64+MacOSX+Linux tested.

Installation

Installation

OmniXML is a runtime library. Just add the source code directory to your Delphi library path.

If you want to (or need), you can compile the supplied package for your Delphi version (in dpk directory).

Example code

OmniXML should be very close to Delphi's IXMLDocument. Furthermore you can take advantage of new added functionality that makes creating and reading XML documents easier.

Please take a short look into IXMLNode and IXMLElement definition for a full list of properties and methods. Everything should be self-explanatory.

Here is a short example code:

Delphi 2009 and newer

procedure TestOmniXML;
var
  XML: IXMLDocument;
  Children: IXMLNodeList;
  Node: IXMLNode;
  Attribute: IXMLAttr;
begin
  //CREATE XML DOC
  XML := CreateXMLDoc('root', True);

  with XML.DocumentElement.AddChild('child') do begin
    Attributes['attribute1'] := 'value1';
  end;
  with XML.DocumentElement.AddChild('child') do begin
    Attributes['attribute2'] := 'value2';
  end;

  XML.SaveToFile('S:\test.xml');

  //READ XML DOC
  XML := CreateXMLDoc;

  XML.LoadFromFile('S:\test.xml');
  Children := XML.DocumentElement.SelectNodes('child');
  for Node in Children do begin
    for Attribute in Node.Attributes do
      ShowMessage(Node.NodeName+'['+
        Attribute.NodeName+'] = '+
        Attribute.NodeValue);
  end;
end;

Delphi 7

procedure TestOmniXML;
var
  XML: IXMLDocument;
  Children: IXMLNodeList;
  I, L: Integer;
begin
  //CREATE XML DOC
  XML := CreateXMLDoc('root', True);

  with XML.DocumentElement.AddChild('child') do begin
    Attributes['attribute1'] := 'value1';
  end;
  with XML.DocumentElement.AddChild('child') do begin
    Attributes['attribute2'] := 'value2';
  end;

  XML.SaveToFile('S:\test.xml');

  //READ XML DOC
  XML := CreateXMLDoc;

  XML.LoadFromFile('S:\test.xml');
  Children := XML.DocumentElement.SelectNodes('child');
  for I := 0 to Children.Count-1 do begin
    for L := 0 to Children[I].Attributes.Count-1 do
      ShowMessage(Children[I].NodeName+'['+
        Children[I].Attributes.Item[L].NodeName+'] = '+
        Children[I].Attributes.Item[L].NodeValue);
  end;
end;

License

OmniXML by Kluug.net is released under the Mozilla Public License 1.1 - the same as the original OmniXML.

OmniXML was originally developed by Miha Remec, Primož Gabrijelčič and other contributors. Last modifications were made by Ondrej Pokorny.

Download

Please be sure you check the license information before downloading any of the files below.

Libraries with full source code

Contact me for more information (you can write in czech/english/german/russian): Email