NAME
Template::Plugin::XML::DOM - simple Template Toolkit plugin interfacing to the XML::DOM module
SYNOPSIS
[% USE doc = XML.DOM('/path/to/file.xml') %]
# print all HREF attributes of all CODEBASE elements
[% FOREACH node = doc.getElementsByTagName('CODEBASE') %]
* [% s.getAttribute('href') %] # or just '[% s.href %]'
[% END %]
# see XML::DOM docs for other methods provided by this object
PRE-REQUISITES
This plugin requires that the XML::Parser and XML::DOM modules be installed. These are available from CPAN:
http://www.cpan.org/modules/by-module/XML
DESCRIPTION
This is a very simple Template Toolkit Plugin interface to the XML::DOM module. The plugin loads the XML::DOM module, instantiates a parser and parser the file passed by name as a parameter. An XML::DOM::Node object is returned through which the XML document can be traverse. See XML::DOM for full details.
[% USE dom = XML.DOM('myxmlfile') %]
The constructor will also accept configuration options destined for the XML::Parser.
[% USE dom = XML.DOM('myxmlfile',
ProtocolEncoding => 'ISO-8859-1') %]
This plugin also provides an AUTOLOAD method for XML::DOM::Node which calls getAttribute() for any undefined methods. Thus, you can use the short form of
[% node.attribute %]
in place of
[% node.getAttribute('attribute') %]
AUTHOR
This plugin module was written by Andy Wardley <cre.canon.co.uk>.
The XML::DOM module is by Enno Derksen <enno@att.com> and Clark Cooper <coopercl@sch.ge.com>. It extends the the XML::Parser module, also by Clark Cooper which itself is built on James Clark's expat library.
REVISION
$Revision: 2.1 $
COPYRIGHT
Copyright (C) 2000 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.