Taxi::Mysql::Format::XML - hit list formatter: XML


NAME

Taxi::Mysql::Format::XML - hit list formatter: XML (flat)

(Back to Top)


SYNOPSIS

 ##========================================================================
 ## PRELIMINARIES
 use Taxi::Mysql::Format::XML;
 ##========================================================================
 ## Constructors etc.
 $q = $CLASS_OR_OBJ->new(%args);
 ##========================================================================
 ## XML Generation
 $hitElt     = $fmt->hitElement($hit);
 $hitListElt = $fmt->hitListElement($hitList);
 $hitListDoc = $fmt->hitListDocument($hitList);
 ##========================================================================
 ## API
 $mimeType = $fmt->contentType();
 $doc      = $fmt->toDocument($hits);
 $str      = $fmt->toString($hits);
 $bool     = $fmt->toFile($hits,$file);
 $bool     = $fmt->toFh($hits,$fh);

(Back to Top)


DESCRIPTION

Taxi::Mysql::Format::XML is a class for formatting HitList objects as a ``flat'' series of XML records.

Globals etc.

Variable: @ISA

Taxi::Mysql::Format::XML inherits from and implements the API specified by Taxi::Mysql::Format::Base.

Constructors etc.

new
 $q = $CLASS_OR_OBJ->new(%args);

Object structure / known %args:

   {
    ##-- XML formatting
    xmlVersion    => $version,  ##-- output XML version (default="1.0")
    xmlEncoding   => $encoding, ##-- output XML encoding (default="UTF-8")
    xmlHitListElt => $listElt,  ##-- element for whole HitList (root); default='hitlist'
    xmlHitElt     => $hitElt,   ##-- element for single hits; default='hit'
    xmlTokElt     => $tokElt,   ##-- element for single tokens; default='tok'
    xmlHitNAttr   => $hitNAttr, ##-- hit-number attribute (default="n")
    pretty        => $level,    ##-- $format argument for XML::LibXML::Document->toXXX()
    ##-- Source data (from ../Format)
    index  => $index,     ##-- underlying Taxi::Mysql object
   }

XML Generation

hitElement
 $hitElt = $fmt->hitElement($hit);

Generate and return an XML::LibXML::Element representing a single Hit $hit.

hitListElement
 $hitListElt = $fmt->hitListElement($hitList);

Generate and return an XML::LibXML::Element representing the HitList $hitList. Default implementation calls $fmt->hitElement() for each hit in $hitList.

hitListDocument
 $hitListDoc = $fmt->hitListDocument($hitList);

Generate and return an XML::LibXML::Document representing $hitList. Default implementation calls $fmt->hitListElement().

API

contentType
 $mimeType = $fmt->contentType();

Default returns 'text/xml'.

toDocument
 $doc = $fmt->toDocument($hits);

New API method in Taxi::Mysql::Format::XML. Default implementation wraps hitListDocument().

toString
 $str = $fmt->toString($hits);

Convert '$hits' to a string.

toFile
 $bool = $fmt->toFile($hits,$file);
toFh
 $bool = $fmt->toFh($hits,$fh);

(Back to Top)


ACKNOWLEDGEMENTS

Perl by Larry Wall.

(Back to Top)


AUTHOR

Bryan Jurish <moocow@ling.uni-potsdam.de>

(Back to Top)


COPYRIGHT AND LICENSE

Copyright (C) 2006 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

(Back to Top)


SEE ALSO

perl(1), Taxi::Mysql(3perl), Taxi::Mysql::Format(3perl), Taxi::Mysql::Format::Base(3perl), Taxi::Mysql::Format::Text(3perl), Taxi::Mysql::Format::XMLBibl(3perl), Taxi::Mysql::Format::XSLT(3perl), Taxi::Mysql::Format::XSLTBibl(3perl), Taxi::Mysql::Format::HTML(3perl).

(Back to Top)

 Taxi::Mysql::Format::XML - hit list formatter: XML