Template::Plugin::XML::DOM - simple Template Toolkit plugin interfacing to the XML::DOM module
[% 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
This plugin requires that the XML::Parser and XML::DOM modules be installed. These are available from CPAN:
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.
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') %]
This plugin module was written by Andy Wardley <cre.canon.co.uk>.
The XML::DOM module is by Enno Derksen <email@example.com> and Clark Cooper <firstname.lastname@example.org>. It extends the the XML::Parser module, also by Clark Cooper which itself is built on James Clark's expat library.
$Revision: 1.1 $
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.