[
Lists Home |
Date Index |
Thread Index
]
- From: "Robert Hanson" <rhanson@blast.net>
- To: <perl-xml@listserv.activestate.com>
- Date: Sat, 29 Apr 2000 15:55:30 -0400
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
documents.
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 (http://www.xml.com/pub/2000/04/26/rax/index.html) 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 (rhanson@blast.net)
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...
=======================
NAME
XML::RAX - Record-oriented API for XML
----------------------------------------------------------------------------
----
SYNOPSIS
use XML::RAX;
my $R = new XML::RAX();
# open from XML data
$R->open( $xml_text );
$R->setRecord('Record');
# open XML from file
$R->openfile( 'test.xml' );
$R->setRecord('Record');
# iterate through recordset
my $rec = $R->readRecord();
while ( $rec )
print "Phone = ''.$rec->getField('Phone').``\n'';
$rec = $R->readRecord();
}
----------------------------------------------------------------------------
----
DESCRIPTION
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:
http://www.xml.com/pub/2000/04/26/rax/index.html
----------------------------------------------------------------------------
----
AUTHOR
Robert Hanson
----------------------------------------------------------------------------
----
CREDITS
The RAX API was created by Sean McGrath and first introduced in his article
on XML.com.
----------------------------------------------------------------------------
----
COPYRIGHT
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.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************
|