NAME

XML::Grammar::ProductsSyndication - an XML Grammar for ProductsSyndication.

VERSION

Version 0.0406

SYNOPSIS

use XML::Grammar::ProductsSyndication;

my $synd =
    XML::Grammar::ProductsSyndication->new(
        {
            'source' =>
            {
                'file' => "products.xml",
            },
        }
    );

# A LibXML compatible XHTML DOM
my $xhtml = $synd->transform_into_html({ 'output' => "xml" });

# Not implemented yet!
$synd->download_preview_images(
    {
        'dir' => "mydir/",
    }
    );

FUNCTIONS

XML::Grammar::ProductsSyndication->new({ arg1 => "value"...})

The constructor - accepts a single hash reference with the following keys:

'source'

A reference to a hash that contains the information for the source XML for the file. Currently supported is a 'file' key that contains a path to the file.

'data_dir'

Points to the data directory where the DTD files, the XSLT stylesheet, etc. are stored. Should not be generally over-ridden.

$processor->is_valid()

Checks if the filename validates according to the DTD.

$processor->transform_into_html({ 'output' => $output, })

Transforms the output into HTML, and returns the results. If 'output' is 'xml' returns the XML::LibXML XML DOM. If 'output' is 'string' returns the XML as a monolithic string. Other 'output' formats are undefined.

$self->update_cover_images({...});

Updates the cover images from Amazon. Receives one hash ref being the arguments. Valid keys are:

  • size

    The request size of the image - 's', 'm', 'l',

  • resize_to

    An optional hash ref containing width and height maximal dimensions of the image to clip to.

  • name_cb

    A callback to determine the fully qualified path of the file. Receives the following information:

    • xml_node

    • id

    • isbn

  • amazon_token

    An Amazon.com web services token. See XML::Amazon.

  • amazon_associate

    An optional Amazon.com associate ID. See XML::Amazon.

  • amazon_sak

    An optional Amazon.com Secret Access Key (sak). See XML::Amazon.

  • overwrite

    If true, instructs to overwrite the files in case they exist.

AUTHOR

Shlomi Fish, <shlomif at cpan.org>

BUGS

Please report any bugs or feature requests to bug-xml-grammar-productssyndication at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML::Grammar::ProductsSyndication. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

TODO

  • Automatically Download Preview Images from Amazon.com

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc XML::Grammar::ProductsSyndication

You can also look for information at:

ACKNOWLEDGEMENTS

* http://www.zvon.org/ for their excellent XSLT Tutorial.

* http://search.cpan.org/~pajas/ for squashing some XML::LibXML bugs I reported to him.

TODO

  • Trace the progress of the Amazon.com progress.

  • More XSLT customisation.

  • Generate a table-of-contents.

COPYRIGHT & LICENSE

Copyright 2006 Shlomi Fish, all rights reserved.

This program is released under the following license: MIT X11.