The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XML::Handler::Pdb - Generate a Palm PDB from XML data

SYNOPSIS

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);

DESCRIPTION

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.

SYNTAX

<pdb>

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.

<record>

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.

<field>

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.

The next section talks about the defined datatypes and how to apply them.

int
 <field type="int" value="42" />

An integer occupies 4 bytes when serialized.

short
 <field type="short" value="7" />

A short occupies 2 bytes on IO.

byte
 <field type="byte" value="1" />

A byte occupies 1 byte on IO.

float, double
 <field type="float" value="3.14" />
 <field type="double" value="2.7" />

A float and double occupy 8 bytes when serialized.

text
 <field type="text">Blah Blah blah </field>

When serialized, a text string is closed by a /0 character.

time
 <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.

date
 <field type="date" value="2003-02-19" />

NSBasic uses the next formula to represent a date:

 (years-1900)*10000+months*100*days

This is serialized as a float, occupying 8 bytes of IO.

BUGS

Please use http://rt.cpan.org/ for reporting bugs.

AUTHOR

Johan Van den Brande <johan@vandenbrande.com>

LICENSE

This is free software, distributed underthe same terms as Perl itself.