NAME

Bio::MAGE::XMLWriter - a module for exporting MAGE-ML

SYNOPSIS

use Bio::MAGE::XMLWriter;

my $writer = Bio::MAGE::XMLWriter->new(@args);
my $fh = \*STDOUT;
$writer->obj2mageml($fh,@object_list);

DESCRIPTION

Methods for transforming information from a MAGE-OM objects into MAGE-ML.

METHODS

write($MAGE_object);

write() prints the objects contained in $MAGE_object as MAGE-ML to the file handle used by the writer.

NAME

Bio::MAGE::XMLReader - a module for exporting MAGE-ML

SYNOPSIS

  use Bio::MAGE::XMLReader;

  my $reader = Bio::MAGE::XMLReader->new(handler=>$handler,
					 sax1=>$sax1,
					 verbose=>$verbose,
					 log_file=>\*STDERR,
					);

  # set the sax1 attribute
  $reader->sax1($bool);

  # get the current value
  $value = $reader->sax1();

  # set the content/document handler - this method is provided for completeness
  # the value should be set in the call to the constructor to be effective
  $reader->handler($HANDLER);

  # get the current handler
  $handler = $reader->handler();

  # set the attribute
  $reader->verbose($integer);

  # get the current value
  $value = $reader->verbose();

  # set the attribute
  $reader->log_file($filename);

  # get the current value
  $value = $reader->log_file();

  my $fh = \*STDOUT;
  my $mage = $reader->read($file_name);

DESCRIPTION

Methods for transforming information from a MAGE-OM objects into MAGE-ML.

ATTRIBUTE METHODS

These methods have a polymorphic setter/getter method that sets an attribute which affects the parsing of MAGE-ML. If given a value, the method will save the value to the attribute, if invoked with no argument it will return the current value of the attribute.

These attributes can all be set in the call to the constructor using the named parameter style.

sax1

This attribute determines whether a SAX1 parser and DocumentHandler or a SAX2XMLReader and a ContentHandler will be used for parsing. The default is to use a SAX2 parser.

handler

If an application needs a custom handler it can set this attribute in the call to the constructor. It is advised that the object use inherit either from Bio::MAGE::ContentHandler (if using SAX2) or Bio::MAGE::DocumentHandler if using SAX1. In particular, whatever class is used, it needs to implement the following methods:

  • verbose

    called with the integer parameter that specifies the desired level of output

  • log_file

    called with the file handle to which ouput should be sent

  • init

    called during the constructor for any needed work

verbose

This attribute determines the desired level of output during the parse. The default is no output. A positive value increases the amount of information.

log_file

This attribute specifies a file handle to which parse output will be directed. It is only needed if verbose is positive.

INSTANCE METHODS

$self->read($file_name)

This method will open the MAGE-ML file specified by $file_name and if the handler attribute is not set, it will create either a SAX2 parser or a SAX1 parser (depending on the value of the C <sax1> attribute) and parse the file.

read() can read from STDIN by specifying '-' as the filename. This enables you to handle compressed XML files:

gzip -dc file.xml.gz | read.pl [options]

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 176:

'=item' outside of any '=over'

Around line 620:

You forgot a '=back' before '=head1'