Professional InfoPath 2003 [Electronic resources]

Ian Williams, Pierre Greborio

نسخه متنی -صفحه : 166/ 67
نمايش فراداده

Main Schema

Changes to your main form schema will most likely be needed because of changes to a business process, and a resulting need to review the form data structure. However, modifications can also come from developments in industry standards you are conforming to or because your business partners are requesting new ways of working.

Of course, alterations to a form schema can cascade all the way through your application. But for the moment, let’s look at the implications of a main schema change in itself.

Suppose you have to make several changes to the data structure, adding new elements and attributes, and altering or even removing others. Apart from developing and testing the schema design with several new data instance examples, you will need to make changes to the form interface, and possibly to associated scripts, the help text, and so on.

Schema Identifiers

If you haven’t already done so, work out a simple version labeling method for your schemas that will identify the major implemented revisions, such as “schemaName_versionNumber_date”. Use this identifier in the filename, so that you can always see from the schema location attribute exactly which version InfoPath is using.

It is also a good idea to edit and test schemas in a separate folder and copy the tested version to the extract folder before building a new template version. This prevents the possibility of you inadvertently saving a schema file from InfoPath and overwriting your work.

Changing XSF References

InfoPath has stored a reference to the initial schema in the documentSchemas section of the XSF file. When you have copied your new schema file to the extract folder, open the form definition file and edit the location attribute of the documentSchema element to match your new version:

<xsf:documentSchemas>
   <xsf:documentSchema
      location="meta_11.xsd"
      rootSchema="yes"/>
</xsf:documentSchemas>

Then, edit the file element that refers to the same schema:

<xsf:files>
   <xsf:file name="meta_11.xsd">
   .
   .
   <xsf:/file>
</xsf:files>

If you try to open the manifest immediately, you may well get a schema validation error. Figure 9-2 shows the error dialog box. Clicking Show Details usually helps you identify the problem.

Figure 9-2: Schema error dialog box.

The most probable reason for an error at this time is that InfoPath has found incorrect or missing references to new or changed elements or attributes on the form. If you have added or modified any elements or attributes, you will also need to make appropriate changes to xmlToEdit elements in the XSF.

<xsf:xmlToEdit name="paymenta_12" item="/meta/payment/@amount">
   <xsf:editWith proofing="no" autoComplete="no" component="xField"/>
</xsf:xmlToEdit>
<xsf:xmlToEdit name="paymentc_13" item="/meta/payment/@currency">
   <xsf:editWith proofing="no" autoComplete="no" component="xField"/>
</xsf:xmlToEdit>