# ---------------------------------------------------------------------- # Copyright (C) 2006 R Bernard Davison # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # ---------------------------------------------------------------------- # Derivative of XML::API::XHTML for WIX version 2 # ---------------------------------------------------------------------- package XML::API::WIX2; use strict; use warnings; use 5.006; use base qw(XML::API); our $VERSION = 0.02; my $m_wix_dir = "C:/Program Files/Windows Installer XML v2/doc"; my $xsd = "$m_wix_dir/wix.xsd"; sub _doctype { return qq{}; } sub _xsd { return $xsd; } sub _root_element { return 'Wix'; } sub _root_attrs { return {xmlns => 'http://schemas.microsoft.com/wix/2003/01/wi'}; } 1; __END__ =head1 NAME XML::API::WIX2 - WIX source file generation through an object API =head1 SYNOPSIS As a simple example the following perl code: use XML::API; my $m_wxs = new XML::API('doctype' => 'WIX2', 'encoding' => 'UTF-8'); $m_wxs->Product_open({ Id => '12345678-1234-1234-1234-123456789012', Name => 'Test Package', Language => '1033', Version => '1.0.0.0', Manufacturer => 'Microsoft Corporation', }); $m_wxs->Package({ Id => '12345678-1234-1234-1234-123456789012', Description => 'My first Windows Installer package', Comments => 'This is my first attempt at creating a Windows Installer database', Manufacturer => 'Microsoft Corporation', InstallerVersion => '200', Compressed => 'yes', }); $m_wxs->Media({ Id =>'1', Cabinet => 'product.cab', EmbedCab => 'yes'}); $m_wxs->Directory_open({ Id => 'TARGETDIR', Name => 'SourceDir'}); $m_wxs->Directory_open({ Id => "ProgramFilesFolder", Name => "PFiles"}); $m_wxs->Directory_open({ Id => "TESTFILEPRODUCTDIR", Name => "TFolder", LongName => "TestFolder"}); $m_wxs->Component_open({ Id => 'License', Guid => '12345678-1234-1234-1234-123456789012'}); $m_wxs->File({ Id => "License", Name => "License.rtf", DiskId => "1", Source => "License.rtf"}); $m_wxs->Component_close(); $m_wxs->Directory_close(); $m_wxs->Directory_close(); $m_wxs->Directory_close(); $m_wxs->Feature_open({ Id => 'License', Title => 'License files', Level => '1'}); $m_wxs->ComponentRef({ Id => 'License' }); $m_wxs->Feature_close(); $m_wxs->Property({Id => "WIXUI_INSTALLDIR", Value => "TESTFILEPRODUCTDIR"}); $m_wxs->UIRef({Id => "WixUI_Mondo"}); $m_wxs->Product_close(); $m_wxs->_print; will produce the following nicely rendered output: =head1 DESCRIPTION B is a perl object class for creating WIX version 2 source files. The methods of a B object are derived directly from the wix.xsd specification. B. So make sure you follow the Wix specifications or the source won't compile. =head1 SEE ALSO XML::API and XML::API::XHTML =head1 AUTHOR R Bernard Davison Erbdavison@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2006 R Bernard Davison Erbdavison@cpan.orgE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. =cut