5.5 Manifest Files


Once the code is complete, all of the components must be prepared and made ready for delivery. The manifest file is an XML instance that identifies each of the components associated with the Smart Document expansion pack. It is the equivalent of a packing list, identifying each of the components necessary to make the Smart Document solution run and where they can be found. It is attached to a Word document or template through the Templates and Add-Ins menu or through a processing instruction incorporated into the document instance itself:

<?mso-solutionextension URI="namespace" manifestPath="path">

If any components cannot be located, an error message will be returned to the end user. One of the novel uses of the manifest file is to track versions. The most common Smart Document deployment scenario involves placing the files on a server where each end user will access them. Once the update frequency value has been reached, the application will check for a more recent version on the server (as indicated by the version number in the manifest file). While a schema for the manifest file has been published and can be found in the Microsoft Office 2003 Smart Document SDK, it does not appear that it is actually used for validation, as the samples provided in the SDK do not conform to it.

There are several key components to a manifest file, as follows:


manifest

The manifest element has two different content models, depending whether it is the root element or a child of manifestCollection. When listed as part of a collection, it is nothing other than a pointer to the individual manifest files, containing the URI and path for each. When used as the root element, it contains the version, updateFrequency, uri, manifestURL, and solution elements.


version

The version element (major.minor) contains the release number for the expansion pack and is used to determine whether or not a more recent expansion pack is available (see updateFrequency, below).


updateFrequency

The update frequency is expressed in minutes. Once this amount of time has elapsed, the user will be prompted to check for an updated expansion pack. The version number of the expansion pack located on the server is then compared with that on the user's system. If the version number on the server is higher, the new expansion pack will be downloaded.


solution

Each solution element within a manifest file describes either one solution type (smart document, schema, transform, or other) or one targetApplication type (Word or Excel). There can be multiple solution elements within a single manifest. The solutionID element is required and contains the GUID associated with the .dll. An alias is also required, and associates a user-friendly name with the solution. The file element is described below.


file

A file element should be included for each individual file that is associated with the solution. This includes help files, document fragments, images, templates, and any other collections that are part of the overall Smart Document solution.

For a managed solution, a unique Solution ID must be generated. A utility to generate unique identifiers, guidgen.exe, shown in action in Figure 5-17, is included with Visual Studio .NET and can be found at C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\guidgen.exe. When the expansion pack is attached, the .dll is entered into the registry with the specified key.

Figure 5-17. Create GUID user interface
figs/oxml_0517.gif


It should be noted that while the manifest file does have an associated schema, Microsoft Office 2003 will not necessarily generate an error if the instance is not valid. This can be tested by validating any of the manifest.xml files distributed with the Smart Document SDK in Microsoft Office Word 2003.


Here is a sample manifest.xml file:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <manifest xmlns="http://schemas.microsoft.com/office/xmlexpansionpacks/2003">   <version>1.0</version>   <updateFrequency>20160</updateFrequency>   <uri>http://www.office-xml.com/ns/sdarticle</uri>   <solution>     <solutionID>{1E15F399-9BFF-4ac9-A68A-737788C1B462}</solutionID>     <type>smartDocument</type>     <alias lc>Essentials Article Solution</alias>     <documentSpecific>false</documentSpecific>     <targetApplication>Word.Application.11</targetApplication>     <file>       <runFromServer/>       <type>solutionActionHandler</type>       <managed/>       <version>1.0</version>       <filePath>SDEssentials.dll</filePath>       <CLSNAME>SDEssentials.ArticleSmartDocument</CLSNAME>     </file>     <file>       <runFromServer/>       <type>other</type>       <version>1.0</version>       <filePath>help/article.htm</filePath>     </file>     <file>       <runFromServer/>       <type>other</type>       <version>1.0</version>       <filePath>help/para.htm</filePath>     </file>     <file>       <runFromServer/>       <type>other</type>       <version>1.0</version>       <filePath>help/code.htm</filePath>     </file>     <file>       <runFromServer/>        <type>other</type>       <version>1.0</version>       <filePath>images/cover.jpg</filePath>     </file>   </solution>   <solution>     <solutionID>schema</solutionID>     <type>schema</type>     <alias lc>SDArticle</alias>     <file>       <type>schema</type>       <version>1.0</version>       <filePath>SDArticle.xsd</filePath>     </file>   </solution> </manifest>



Office 2003 XML
Office 2003 XML
ISBN: 0596005385
EAN: 2147483647
Year: 2003
Pages: 135

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net