.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .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" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Template::Plugin::XML 3pm" .TH Template::Plugin::XML 3pm "2022-07-04" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .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); \& %] \& \& [% USE XML(file=\*(Aqfoo.xml\*(Aq); \& dom = XML.dom \& xpath = XML.xpath \& # ...etc... \& %] \& \& [% 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\*(R"\s0 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. .SS "file(name)" .IX Subsection "file(name)" Creates a Template::Plugin::XML::File object. This is a subclass of Template::Plugin::File. .SS "dir(path)" .IX Subsection "dir(path)" Creates a Template::Plugin::XML::Directory object. This is a subclass of Template::Plugin::Directory. .SS "\fBdom()\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) %] \& \& [% file = XML.file(filename); \& dom = file.dom \& %] \& \& [% dir = XML.dir(dirname); \& dom = dir.dom(filename) \& %] .Ve .SS "\fBxpath()\fP" .IX Subsection "xpath()" Perform XPath queries on the file. Like the \fBdom()\fR method, \fBxpath()\fR can be called against a file, directory or an \s-1XML\s0 plugin object. .PP .Vb 1 \& [% xpath = XML.xpath(filename) %] \& \& [% file = XML.file(filename); \& xpath = file.xpath \& %] \& \& [% dir = XML.dir(dirname); \& xpath = dir.xpath(filename) \& %] .Ve .SS "\fBsimple()\fP" .IX Subsection "simple()" \&\s-1TODO:\s0 As per \fBdom()\fR and \fBxpath()\fR but for XML::Simple .SS "\fBrss()\fP" .IX Subsection "rss()" \&\s-1TODO:\s0 As per \fBdom()\fR, \fBxpath()\fR and \fBsimple()\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. .SS "Template::Plugin::XML" .IX Subsection "Template::Plugin::XML" Front-end module to the \s-1XML\s0 plugin collection. .SS "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 \fBdom()\fR, \fBxpath()\fR, \fBsimple()\fR and other methods relevant to \s-1XML\s0 files. .SS "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. .SS "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 .SS "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 .SS "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 .SS "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