.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Template::Plugin::XML 3pm" .TH Template::Plugin::XML 3pm "2008-03-01" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" Template::Plugin::XML \- XML plugin for the Template Toolkit .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 6 \& [% USE XML; \& dom = XML.dom(\(aqfoo.xml\(aq); \& xpath = XML.xpath(\(aqbar.xml\(aq); \& simple = XML.simple(\(aqbaz.xml\(aq); \& rss = XML.simple(\(aqnews.rdf\(aq); \& %] .Ve .PP .Vb 5 \& [% USE XML(file=\(aqfoo.xml\(aq); \& dom = XML.dom \& xpath = XML.xpath \& # ...etc... \& %] .Ve .PP .Vb 6 \& [% USE XML(dir=\(aq/path/to/xml\(aq); \& file = XML.file(\(aqfoo.xml\(aq ); \& dom = file.dom \& xpath = file.xpath \& # ...etc... \& %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Template-XML distribution provides a number of Template Toolkit plugin modules for working with \s-1XML\s0. .PP The Template::Plugin::XML module is a front-end to the various other \&\s-1XML\s0 plugin modules. Through this you can access \s-1XML\s0 files and directories of \s-1XML\s0 files via the Template::Plugin::XML::File and Template::Plugin::XML::Directory modules (which subclass from the Template::Plugin::File and Template::Plugin::Directory modules respectively). You can then create a Document Object Model (\s-1DOM\s0) from an \s-1XML\s0 file (Template::Plugin::XML::DOM), examine it using XPath queries (Template::Plugin::XML::XPath), turn it into a Perl data structure (Template::Plugin::XML::Simple) or parse it as an \s-1RSS\s0 (\s-1RDF\s0 Site Summary) file. .PP The basic \s-1XML\s0 plugins were distributed as part of the Template Toolkit until version 2.15 released in May 2006. At this time they were extracted into this separate Template-XML distribution and an alpha version of this Template::Plugin::XML front-end module was added. .PP The Template::Plugin::XML module is still in development and not guaranteed to work correctly yet. However, all the other \s-1XML\s0 plugins are more-or-less exactly as they were in \s-1TT\s0 version 2.14 and should work as normal. .PP For general information on the Template Toolkit see the documentation for the Template module or . For information on using plugins, see Template::Plugins and \&\*(L"\s-1USE\s0\*(R" in Template::Manual::Directives. For further information on \s-1XML\s0, see . .SH "METHODS" .IX Header "METHODS" The \s-1XML\s0 plugin module provides a number of methods to create various other \s-1XML\s0 plugin objects. .Sh "file(name)" .IX Subsection "file(name)" Creates a Template::Plugin::XML::File object. This is a subclass of Template::Plugin::File. .Sh "dir(path)" .IX Subsection "dir(path)" Creates a Template::Plugin::XML::Directory object. This is a subclass of Template::Plugin::Directory. .Sh "\fIdom()\fP" .IX Subsection "dom()" Generate a Document Object Module from an \s-1XML\s0 file. This can be called against a directory, file or an \s-1XML\s0 plugin object, as long as the source \s-1XML\s0 filename is defined somewhere along the line. .PP .Vb 1 \& [% dom = XML.dom(filename) %] .Ve .PP .Vb 3 \& [% file = XML.file(filename); \& dom = file.dom \& %] .Ve .PP .Vb 3 \& [% dir = XML.dir(dirname); \& dom = dir.dom(filename) \& %] .Ve .Sh "\fIxpath()\fP" .IX Subsection "xpath()" Perform XPath queries on the file. Like the \fIdom()\fR method, \fIxpath()\fR can be called against a file, directory or an \s-1XML\s0 plugin object. .PP .Vb 1 \& [% xpath = XML.xpath(filename) %] .Ve .PP .Vb 3 \& [% file = XML.file(filename); \& xpath = file.xpath \& %] .Ve .PP .Vb 3 \& [% dir = XML.dir(dirname); \& xpath = dir.xpath(filename) \& %] .Ve .Sh "\fIsimple()\fP" .IX Subsection "simple()" \&\s-1TODO:\s0 As per \fIdom()\fR and \fIxpath()\fR but for XML::Simple .Sh "\fIrss()\fP" .IX Subsection "rss()" \&\s-1TODO:\s0 As per \fIdom()\fR, \fIxpath()\fR and \fIsimple()\fR but for \s-1XML::RSS\s0 .SH "XML PLUGINS" .IX Header "XML PLUGINS" These are the \s-1XML\s0 plugins provided in this distribution. .Sh "Template::Plugin::XML" .IX Subsection "Template::Plugin::XML" Front-end module to the \s-1XML\s0 plugin collection. .Sh "Template::Plugin::XML::File" .IX Subsection "Template::Plugin::XML::File" This plugin module is used to represent individual \s-1XML\s0 files. It is a subclass of the Template::Plugin::File module, providing the additional \fIdom()\fR, \fIxpath()\fR, \fIsimple()\fR and other methods relevant to \s-1XML\s0 files. .Sh "Template::Plugin::XML::Directory" .IX Subsection "Template::Plugin::XML::Directory" This plugin module is used to represent directories of \s-1XML\s0 files. It is a subclass of the Template::Plugin::Directory module and provides the same additional \s-1XML\s0 related methods as Template::Plugin::XML::File. .Sh "Template::Plugin::XML::DOM" .IX Subsection "Template::Plugin::XML::DOM" Plugin interface providing access to the \s-1XML::DOM\s0 module. .PP .Vb 3 \& [% USE XD = XML.Dom %] \& [% dom = XD.parse_file(\(aqexample.xml\(aq) %] \& [% pages = dom.getElementsByTagName(\(aqpage\(aq) %] .Ve .Sh "Template::Plugin::XML::RSS" .IX Subsection "Template::Plugin::XML::RSS" Plugin interface providing access to the \s-1XML::RSS\s0 module. .PP .Vb 4 \& [% USE news = XML.RSS(\(aqnews.rdf\(aq) \-%] \& [% FOREACH item IN news.items \-%] \& * [% item.title %] \& [% END %] .Ve .Sh "Template::Plugin::XML::Simple" .IX Subsection "Template::Plugin::XML::Simple" Plugin interface providing access to the XML::Simple module. .PP .Vb 1 \& [% USE xml = XML.Simple(\(aqexample.xml\(aq) %] .Ve .Sh "Template::Plugin::XML::XPath" .IX Subsection "Template::Plugin::XML::XPath" Plugin interface providing access to the XML::XPath module. .PP .Vb 3 \& [% USE xpath = XML.XPath(\(aqexample.xml\(aq); \& bar = xpath.find(\(aq/foo/bar\(aq); \& %] .Ve .SH "AUTHORS" .IX Header "AUTHORS" Andy Wardley wrote the Template Toolkit plugin modules, with assistance from Simon Matthews in the case of the \s-1XML::DOM\s0 plugin. Matt Sergeant wrote the XML::XPath module. Enno Derksen and Clark Cooper wrote the \s-1XML::DOM\s0 module. Jonathan Eisenzopf wrote the \&\s-1XML::RSS\s0 module. Grant McLean wrote the XML::Simple module. Clark Cooper and Larry Wall wrote the XML::Parser module. James Clark wrote the expat library. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 1996\-2007 Andy Wardley. All Rights Reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Template, Template::Plugins, Template::Plugin::XML::DOM, Template::Plugin::XML::RSS, Template::Plugin::XML::Simple, Template::Plugin::XML::XPath