Tuesday, August 29, 2006

Do you need a lightweight XML parser/writer?

Then I would recommend OmniXML. It is a MSXML compatible XML parser/writer with full support for Document Object Model 1.1 specification. It is released under the Mozilla Public License 1.1 and comes with a full source code.

Some useful units are also included in the distribution - two different approaches to object persistency (OmniXMLPersistent and OmniXMLProperties), simple database persistency (OmniXMLDatabase), TIniFile-compatible interface (OmniXMLConf). A subset of XPath is also supported.

There are shortcomings, too. The most important is that you cannot verify XML document according to a XML schema. There is also no support for XML canonicalization.

Still, OmniXML is very useful when writing XML documents that stay inside a program (XML-formatted configuration files, data storage etc) or inside a component or pair of components (message exchange). For example, it is used in GExperts for data storage and I'm using it for storage and messaging.

Thursday, August 17, 2006

GpHugeFile 4.0

Today, I have released my GpHugeFile unit version 4.0. It is released under the BSD License.

For the highly impatient:

A little background is maybe in order. I have been publishing Borland Pascal (and later Borland Delphi) units since BBS times. All of them are released either as a free source or under the BSD license. After all, I wanted other programmers to use them. Over the years, some of them grew and some not. Suggestions from other users were incorporated. Some contributors even added useful code. A complete list is available on my Delphi page.

But let's return to a more interesting topic...

TGpHugeFile started as a wrapper around system calls allowing access to really large (over 2 GB) files.

Buffering (prefetching) was added next. TGpHugeFile can optionally buffer all read/written data and significantly speed up sequential (or mostly sequential) access to files. Admittedly, it doesn't work very well when files are access randomly.

In the latest (4.0) reincarnation, it can open files with Unicode names (CreateFileW is called instead of CreateFileA in that case).

There are some other goodies included:
  • It can handle direct access to files (see description for FILE_FLAG_NO_BUFFERING in the MSDN CreateFile documentation. TGpHugeFile will automatically align all buffers and read/write requests.

  • 'Close on EOF' mode is useful for very slow links (i.e. modem access). In this mode, TGpHugeFile will close file handle as soon as last block is read from the file. This will free the file for other programs while your program can still read data from the TGpHugeFile's buffer.

  • File handle is not released during Reset/Rewrite if called when file is already open. Delphi does that wrongly (closes the handle), which is not a very good idea if file is shared between applications as another application may try to open it just at the wrong moment.


There is also a TGpHugeFileStream class - a TStream descendant that wraps TGpHugeFile.

That's about all that I have to say on this topic. If you use TGpHugeFile[Stream] and you like it, leave me a mail (or a comment). I'd like to hear more about your experience with it.

Wednesday, August 16, 2006

Back in business

Just came back from a short vacation (14 days, not nearly enough) in nice city of Lukoran (island of Ugljan, Croatia).

Isn't Google Earth just great!