-
-
19 Sep 2006 11:00:10 UTC
- Distribution: Any-Renderer
- Module version: 1.008
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (846 / 383 / 0)
- Kwalitee
Bus factor: 0- 89.85% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (23.44KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- File::Find
- File::Spec
- Log::Trace
- Test::Assertions
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Any::Renderer::XML - render a data structure as element-only XML
SYNOPSIS
use Any::Renderer; my %xml_options = (); my %options = ( 'XmlOptions' => \%xml_options ); my $format = "XML"; my $r = new Any::Renderer ( $format, \%options ); my $data_structure = [...]; # arbitrary structure code my $string = $r->render ( $data_structure );
You can get a list of all formats that this module handles using the following syntax:
my $list_ref = Any::Renderer::XML::available_formats ();
Also, determine whether or not a format requires a template with requires_template:
my $bool = Any::Renderer::XML::requires_template ( $format );
DESCRIPTION
Any::Renderer::XML renders any Perl data structure passed to it as element-only XML. For example:
perl -MAny::Renderer -e "print Any::Renderer->new('XML')->render({a => 1, b => [2,3]})"
results in:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <output> <a>1</a> <b>2</b> <b>3</b> </output>
The rendering process comes with all the caveats cited in the XML::Simple documentation. For example if your data structure contains binary data or ASCII control characters, then the XML document that is generated may not be well-formed.
FORMATS
- XML
METHODS
- $r = new Any::Renderer::XML($format,\%options)
-
$format
must beXML
. See "OPTIONS" for a description of available options. - $scalar = $r->render($data_structure)
-
The main method.
- $bool = Any::Renderer::XML::requires_template($format)
-
False in this case.
- $list_ref = Any::Renderer::XML::available_formats()
-
Just the one -
XML
.
OPTIONS
- XmlOptions
-
A hash reference of options that can be passed to XML::Simple::XMLout, see XML::Simple for a detailed description of all of the available options.
- VariableName
-
Set the XML root element name. You can also achieve this by setting the
RootName
orrootname
options passed to XML::Simple in theXML
options hash. This is a shortcut to make this renderer behave like some of the other renderer backends. - Encoding
-
Character set of the generated XML document. Defaults to ISO-8859-1.
SEE ALSO
VERSION
$Revision: 1.8 $ on $Date: 2006/08/22 20:14:09 $ by $Author: johna $
AUTHOR
Matt Wilson <cpan _at_ bbc _dot_ co _dot_ uk>
COPYRIGHT
(c) BBC 2006. This program is free software; you can redistribute it and/or modify it under the GNU GPL.
See the file COPYING in this distribution, or http://www.gnu.org/licenses/gpl.txt
Module Install Instructions
To install Any::Renderer, copy and paste the appropriate command in to your terminal.
cpanm Any::Renderer
perl -MCPAN -e shell install Any::Renderer
For more information on module installation, please visit the detailed CPAN module installation guide.