Date: Sat, 29 Apr 2000 15:55:30 -0400
From: Robert Hanson <>

I don't know how many people have had a chance to read Sean McGrath's
article on RAX yesterday, but he defines a very simple API for reading XML

What he has done is let the programmer read in the information just as you
would normally read a recordset... record by record, and field by field.  I
admit that not all XML documents fit into records and fields, but in cases
where it does, using the RAX API is much simpler than using SAX or DOM.

Because RAX is "record-oriented", it is stream based, and you get the
benefit of not having to load the entire document into memory like you would
if you were using DOM.

In Sean's article ( he
describes the API and gives a Python implementation of RAX.  What I have
done is taken his API and created a Perl implementation.

Currently the module is only available be emailing me (
until I get it up on a web site.  When I find a home for it, I'll post that
information to the XML-Perl list.

The POD distributed with XML::RAX follows...


XML::RAX - Record-oriented API for XML


use XML::RAX;
my $R = new XML::RAX();

# open from XML data
$R->open( $xml_text );

# open XML from file
$R->openfile( 'test.xml' );

# iterate through recordset
my $rec = $R->readRecord();

while ( $rec )

  print "Phone = ''.$rec->getField('Phone').``\n'';
  $rec = $R->readRecord();


This interface allows you to access an XML document as you would a database
recordset. In instances where the XML document fits a record/field type
format, using the RAX interface will usually be simpler than using DOM or
SAX to access the data.

XML::RAX requires XML::Parser.

See Sean McGrath's article on RAX for an good overview of RAX:


Robert Hanson


The RAX API was created by Sean McGrath and first introduced in his article


Copyright (c) 2000 Robert Hanson. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms as
Perl itself.

This is xml-dev, the mailing list for XML developers.
List archives are available at