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

Latest Version

1.19 (2013/10/31)
OmniXML by Kluug.net has been discontinued. Most of the new features developed by Kluug.net will be merged with the original OmniXML project and will be available on its homepage.

Kluug.net has developed a new XML library: OXml. Please consider using it instead of OmniXML. It offers you more performance, less memory usage and direct access to XML files without DOM.

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 D6-D2007
  • About 10 times faster than Delphi's built-in IXMLDocument
  • Supports UTF-16, UTF-8 and single-byte (ISO, WIN, KOI8) encodings on all compilers and platforms.

Kluug.net modifications

  • Version 1.17: support for single-byte encodings (ISO, WIN, KOI8...) accross all compilers and platforms.
  • 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