XML::API::WIX2 - WIX source file generation through an object API
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:
<?xml version="1.0" encoding="UTF-8" ?> <Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi"> <Product Id="12345678-1234-1234-1234-123456789012" Language="1033" Manufacturer="Microsoft Corporation" Name="Test Package" Version="1.0.0.0"> <Package Comments="This is my first attempt at creating a Windows Installer database" Compressed="yes" Description="My first Windows Installer package" Id="12345678-1234-1234-1234-123456789012" InstallerVersion="200" Manufacturer="Microsoft Corporation" /> <Media Cabinet="product.cab" EmbedCab="yes" Id="1" /> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder" Name="PFiles"> <Directory Id="TESTFILEPRODUCTDIR" LongName="TestFolder" Name="TFolder"> <Component Guid="12345678-1234-1234-1234-123456789012" Id="License"> <File DiskId="1" Id="License" Name="License.rtf" Source="License.rtf" /> </Component> <!-- Guid="12345678-1234-1234-1234-123456789012" Id="License"--> </Directory> <!-- Id="TESTFILEPRODUCTDIR" LongName="TestFolder" Name="TFolder"--> </Directory> <!-- Id="ProgramFilesFolder" Name="PFiles"--> </Directory> <!-- Id="TARGETDIR" Name="SourceDir"--> <Feature Id="License" Level="1" Title="License files"> <ComponentRef Id="License" /> </Feature> <!-- Id="License" Level="1" Title="License files"--> <Property Id="WIXUI_INSTALLDIR" Value="TESTFILEPRODUCTDIR" /> <UIRef Id="WixUI_Mondo" /> </Product> <!-- Id="12345678-1234-1234-1234-123456789012" Language="1033" Manufacturer="Microsoft Corporation" Name="Test Package" Version="1.0.0.0"--> </Wix> <!-- xmlns="http://schemas.microsoft.com/wix/2003/01/wi"-->
XML::API::WIX2 is a perl object class for creating WIX version 2 source files. The methods of a XML::API::WIX2 object are derived directly from the wix.xsd specification.
At the time of writing the XML valiadation is not implemented in XML::API. So make sure you follow the Wix specifications or the source won't compile.
XML::API and XML::API::XHTML
R Bernard Davison <rbdavison@cpan.org>
Copyright (C) 2006 R Bernard Davison <rbdavison@cpan.org>
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.
To install XML::API::WIX2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::API::WIX2
CPAN shell
perl -MCPAN -e shell install XML::API::WIX2
For more information on module installation, please visit the detailed CPAN module installation guide.