XML::Handler::Pdb - Generate a Palm PDB from XML data
Using SAX::Machines:
use XML::SAX::Machines qw(Pipeline); use XML::Handler::Pdb; Pipeline( XML::Handler::Pdb->new( Output => $outfile )->parse_uri("pdb.xml") );
Using directly:
use XML::SAX; use XML::Handler::Pdb; XML::SAX::ParserFactory->parser( Handler => XML::Handler::Pdb->new( Verbose => 0, Output => $output ) )->parse_uri($source);
With this module one can generate a Palm database (.pdb file) from an XML description. The datatypes supported by this module are targetted towards NSBasic. The NSBasic IDE is a superb way of creating PalmOS applications, more can be found on http://www.nsbasic.com. Supported datatypes are: int, short, byte, float, double, date, time and text.
This is the root element and must always be present. The element also has 3 mandatory attributes. The type attribute must alwas be DATA, because this module can only generate data oriented databases and no resource databases like a prc file. The name attribute contains the name of the database, used to open the database from PalmOS. The creator attribute must match the creator id of the Palm application that uses this database.
type
DATA
name
creator
A record is a row in a Palm database. The only attribute a record can have is the category it belongs to. The attribute category can accepts a vlaue from 0 to 15. A record in a Palm database can contain an arbitrary amount of fields.
category
fields
The field is a data item in the Palm database. It can be one of the next types: int, date, time, byte, float, double, short and text. One record can have as many fields as necessary. Records can also have different types and a different number of fields. Offcourse, your application will need to deal with this.
field
The next section talks about the defined datatypes and how to apply them.
<field type="int" value="42" />
An integer occupies 4 bytes when serialized.
<field type="short" value="7" />
A short occupies 2 bytes on IO.
<field type="byte" value="1" />
A byte occupies 1 byte on IO.
<field type="float" value="3.14" /> <field type="double" value="2.7" />
A float and double occupy 8 bytes when serialized.
<field type="text">Blah Blah blah </field>
When serialized, a text string is closed by a /0 character.
<field type="time" value"13:20:01" />
NSBasic uses the next formula to represent a time:
hours*10000+minutes*100+seconds
This is serialized as a float, occupying 8 bytes of IO.
<field type="date" value="2003-02-19" />
NSBasic uses the next formula to represent a date:
(years-1900)*10000+months*100*days
Please use http://rt.cpan.org/ for reporting bugs.
Johan Van den Brande <johan@vandenbrande.com>
This is free software, distributed underthe same terms as Perl itself.
To install XML::Handler::Pdb, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Handler::Pdb
CPAN shell
perl -MCPAN -e shell install XML::Handler::Pdb
For more information on module installation, please visit the detailed CPAN module installation guide.