Chapter 5: XML and FileMaker Pro Web Publishing

4.4 Document Type Definition for Database Design Reports

FileMaker Developer 5.5 has a new report capability. A special version of FileMaker Pro, the Developer application can create design reports of your open databases. There are two formats available for the report. The first report type creates another FileMaker Pro database with information about the fields, layouts, passwords, relationships, scripts, and value lists in your databases. You must have full password access to create the report. The information in the report is the same information that you can obtain by using the design functions in FileMaker Pro. Figure 4.1 shows a sample report created for two related databases. The files used for this example are found in the Time Billing directory in the Templates directory when you install any version of FileMaker Pro.

click to expand
Figure 4.1: Database Design Report overview

The Database Design Report (DDR) is most useful for related files. The links between the files are available in the report. Figure 4.2 has an example of the details for the relationship between the two files. The advantage of using the DDR over using the Design function values is this linking between related files and linking between fields, layouts, value lists, and scripts. You can document your complete database solution and see the relationship for all of the elements in the databases.

click to expand
Figure 4.2: Relationship details

To create a DDR, select File, Database Design Report. Figure 4.3 shows the dialog and the open files from the Time Billing templates. The two format options for the report are shown under Report Type. The second option is discussed more fully in this chapter because the report is produced as a well-formed XML document along with the XSL stylesheet to display the report.

click to expand
Figure 4.3: Create a Database Design Report

You can read more about the Database Design Report in the FileMaker Pro Developer Help topics "About Database Design Report", "Understanding the FileMaker Pro database report format", "Understanding the XML report format", and "Using Database Design Report".

4.41 Database Design Report with XML and XSL

When you select the XML report type, you are presented with a save dialog, as shown in Figure 4.4. You can name the report anything, but the following examples use the default name Database Report.xml. The Default.xsl stylesheet is included with FileMaker Developer. You can create your own stylesheets to display only selected information. Any XSL document can be selected from the stylesheet pop-up if it is placed in the DDR directory in the FileMaker Developer directory. XSL stylesheets will be discussed in Chapter 7.

click to expand
Figure 4.4: Save the Database Design Report

Several text files are created if you use the XML file report type. The first file is Database Report.xml and is the XML document containing the summary of the report items for all the databases in the report. Listing 4.12 shows the summary for the example files in the Time Billing templates folder. The information found in the Summary report is similar to the information in the database overview layout for the Database Design Report as seen in Figure 4.1. The second line in the report is a processing instruction to tell the browser to use the stylesheet DEFAULT.XSL to view the document.

Listing 4.12: Database Report.xml

start example
 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="DEFAULT.XSL"?> <Summary>       <XMLFileType>Summary</XMLFileType>       <CreationDate>2/16/2002</CreationDate>       <CreationTime>12:06:10 PM</CreationTime>       <File>             <Name>Time Billing Line Items.fp5</Name>             <XMLReportFile>Time Billing Line Items_fp5.xml</XMLReportFile>             <PasswordsCount>0</PasswordsCount>             <Table>                   <FieldsCount>16</FieldsCount>             </Table>             <LayoutsCount>5</LayoutsCount>             <RelationshipsCount>1</RelationshipsCount>             <ScriptsCount>9</ScriptsCount>             <ValueListsCount>0</ValueListsCount>       </File>       <File>             <Name>Time Billing.fp5</Name>             <XMLReportFile>Time Billing_fp5.xml</XMLReportFile>             <PasswordsCount>0</PasswordsCount>             <Table>                   <FieldsCount>28</FieldsCount>             </Table>             <LayoutsCount>8</LayoutsCount>             <RelationshipsCount>1</RelationshipsCount>             <ScriptsCount>29</ScriptsCount>             <ValueListsCount>1</ValueListsCount>       </File> </Summary>
end example

A single XML file is created for each open database in the report. The name of the file is the database name and the .xml extension. In the Time Billing example, these two files are Time Billing_fp5.xml and Time Billing Line Items_fp5.xml. The dots in the .fp5 extension on the databases have been changed to an underscore so that the text file has only one extension. The names of these files are used in the Database Report.xml in Listing 4.12, so do not change them after creating the reports.

The final file that is created is the Default.xsl document. The stylesheet document is a copy of the original found in the DDR folder. If you have created and selected a custom XSL stylesheet, a copy of it is placed in the same folder with the Database Report and XML file documents. The default XSL or your custom XSL must be in the same folder with the XML created to view the Database Design Report in the browser.

FileMaker Developer creates the XML and XSL documents and automatically opens a default browser to display the report. The Microsoft Internet Explorer 5 (or greater) web browsers for Windows and Macintosh are recommended for viewing these reports. The XSL in the Database Design Report may not conform to the latest W3C standards, but these differences will be discussed in Chapter 7. You can view the report at any time by opening the Database Report.xml document in your browser. The Default.xsl stylesheet will be used to format the report with hyperlinks between the design elements in the databases.

The XML and XSL documents contain the same links found in the Database Report created as a database. The XML and XSL documents are text and may be opened with any text editor, as well. The XML documents created by the Database Design Report may be used by other applications that can process the XML.

Waves In Motion, http://wmotion.com/analyzer.html, has a commercial product that uses the XML produced by FileMaker Developer. Analyzer enhances the Database Design Report by using the XML and adding references to common errors, broken relationships, broken value lists, and missing items in scripts. Analyzer does not have the ability to link external subscripts.

4.42 XML Output Grammar for Database Design Report

The document "FileMaker Inc. Database Design Report XML Output Grammar" is available at http://www.filemaker.com/downloads/pdf/ddr_grammar.pdf. A revised version is used here to create a DTD for the Database Design Report grammar. Listing 4.12, shows the XML produced for the Database Report. Listing 4.13 shows the XML tree for this report. A Document Type Definition will be created for this XML document in the next section.

Listing 4.13: Summary XML for the database report

start example
 <?xml version='1.0' ?> <?xml-stylesheet type="text/xsl" href="DEFAULT.XSL"?> <Summary>       <XMLFileType>             SUMMARY       </XMLFileType>       <CreationDate><!-- creation date of report --></CreationDate>       <CreationTime><!-- creation time of report --></CreationTime>       <File><!-- Repeats for each FILE in the report -->             <Name><!-- the name of the File --></Name>             <XMLReportFile><!-- XML detail report file name               --></XMLReportFile>             <Table>                   <FieldsCount><!-- number of fields --></FieldsCount>             </Table>             <LayoutsCount><!-- number of layouts --></LayoutsCount>             <RelationshipsCount><!-- number of relationships               --></RelationshipsCount>             <ScriptsCount><!-- number of scripts --></ScriptsCount>             <ValueListsCount><!-- number of valuelists               --></ValueListsCount>             <PasswordsCount><!-- number of Passwords --></PasswordsCount>       </File> </Summary>
end example

Disclaimer 

Please remember that this exercise is only used to demonstrate the relationship between an XML document and a "road map of elements and attributes", such as with DTDs, schemas, or grammars. The DTD we will create is not an actual valid document. FileMaker, Inc. has not published any DTD, schema, or grammar for the FileMaker Pro Database Design Report.

The summaries included below are also not actual documents. The structure is based on the document "FileMaker Inc. Database Design Report XML Output Grammar" available in the portable document format on the web site at http://www.filemaker.com/downloads/pdf/ddr_grammar.pdf.

The Summary file type report contains the name of the database files, the report name for the database details, the number of fields, the number of layouts, the number of relationships, the number of value lists, and the number of passwords in each database. Default.xsl uses this data to format the report with hyperlinks to the details. Listing 4.14 shows a sample of the XSL used to display the Database Report.xml. See sections 7.2 and 7.3 for more information about this type of stylesheet.

Listing 4.14: Summary.xsl

start example
 <?xml version='1.0' ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">    <xsl:template match="/">    <html>    <body>       <xsl:if match=".[/Summary/XMLFileType = 'Summary']">          <h2 align="center">FILEMAKER PRO DATABASE DESIGN REPORT</h2>          <h5 align="center">Creation Date and Time:             <xsl:value-of select="/Summary/CreationDate" />             at             <xsl:value-of select="/Summary/CreationTime" />          </h5>       <h2>Report Overview</h2>       <table cellpadding="3" border="2">          <tr>             <td width="150">                <b>Database</b>             </td>             <td align="center" width="100">                <b>Fields</b>             </td>             <td align="center" width="100">                <b>Layouts</b>             </td>             <td align="center" width="100">                <b>Relationships</b>             </td>             <td align="center" width="100">                <b>Scripts</b>             </td>             <td align="center" width="100">                <b>Value Lists</b>             </td>             <td align="center" width="100">                <b>Passwords</b>             </td>          </tr>          <xsl:for-each select="/Summary/File">             <tr>                <td>                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                      </xsl:attribute>                         <xsl:value-of select="Name" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #Fields                      </xsl:attribute>                      <xsl:value-of select="Table/FieldsCount" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #Layouts                      </xsl:attribute>                      <xsl:value-of select="LayoutsCount" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #Relationships                      </xsl:attribute>                      <xsl:value-of select="RelationshipsCount" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #Scripts                      </xsl:attribute>                      <xsl:value-of select="ScriptsCount" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #ValueLists                      </xsl:attribute>                      <xsl:value-of select="ValueListsCount" />                   </a>                </td>                <td align="center">                   <a>                      <xsl:attribute name="HREF">                         <xsl:value-of select="XMLReportFile" />                         #Passwords                      </xsl:attribute>                      <xsl:value-of select="PasswordsCount" />                   </a>                </td>             </tr>          </xsl:for-each>       </table>    </xsl:if>    </body>    </html>    </xsl:template> </xsl:stylesheet>
end example

The XSL processor looks for the elements in the XML document and inserts the values in an HTML page. Figure 4.5 shows the browser display for the report that uses the Summary.xsl in Listing 4.14 and the Database Report.xml in Listing 4.12.

click to expand
Figure 4.5: Document Type Definition for summary

Database Design Report in the Browser

Create the DTD with the declaration for the type of document and the root element Summary. The Summary element has four child elements, one each named XMLFileType, CreationDate, and CreationTime, and one or more File elements.

 <!DOCTYPE Database Report [       <!ELEMENT Summary (XMLFileType, CreationDate, CreationTime, File+)> 

The XMLFileType element is never empty and has the required value "SUMMARY" (uppercase). The W3C recommendations for Element Type Declarations, Section 3.2, "Extensible Markup Language (XML) 1.0 (Second Edition)", http://www.w3.org/TR/2000/REC-xml-20001006, does not provide for required element values. The DTD only shows that parsed character data is used in the contents for this element:

 <!ELEMENT XMLFileType (#PCDATA)> 

The remaining elements for the Database Report document are defined in Listing 4.15. The File element has two required child elements, Name and XMLReportFile. The other child elements for the File element are optional and will be created only if included in the report.

Listing 4.15: DTD for summary XML report

start example
 <!DOCTYPE Database Report [       <!ELEMENT Summary (XMLFileType, CreationDate, CreationTime, File+)>             <!ELEMENT XMLFileType (#PCDATA)>             <!ELEMENT CreationDate (#PCDATA)>             <!ELEMENT CreationTime (#PCDATA)>             <!ELEMENT File (Name, XMLReportFile, PasswordCount?,               Table?, LayoutsCount?, RelationshipsCount?, ScriptsCount?,               ValueListsCount?)>                   <!ELEMENT Name (#PCDATA)>                   <!ELEMENT XMLReportFile (#PCDATA)>                   <!ELEMENT PasswordCount (#PCDATA)>                   <!ELEMENT Table (FieldsCount)>                         <!ELEMENT FieldsCount (#PCDATA)>                   <!ELEMENT LayoutsCount (#PCDATA)>                   <!ELEMENT RelationshipsCount (#PCDATA)>                   <!ELEMENT ScriptsCount (#PCDATA)>                   <!ELEMENT ValueListsCount (#PCDATA)> ]>
end example

The Database Design Report dialog, shown in Figure 4.3, has check boxes for each item to include.

The Database Report does not require a DTD to be used by FileMaker. This exercise was included to demonstrate the construction of Document Type Definitions. The limitations of this type of "road map" were demonstrated in the definition for the XMLFileType element. If an element requires a default value, there is no way to include the value in the DTD. The World Wide Web Consortium has proposed using Schema (XSD) to correct this oversight. You can read more about the proposal at http://www.w3.org/XML/Schema.

4.43 Database Design Report File Grammar

When the XML Database Design Report is generated, a text file in XML format is created for each database. The information about the design of each database is written with the Report file type format. The Report file type uses the precise grammar found in the document "FileMaker Inc. Database Design Report XML Output Grammar", available at http://www.filemaker.com/downloads/pdf/ddr_grammar.pdf. A brief version of the Report file type is shown in Listing 4.16. The example shows only some of the main elements for the Report file type. The details will be further expanded later in this section. In the Report file type, the element XMLFileType has the required value "REPORT" (uppercase). This type of XML report has all of the field, relationship, value list, layout, script, and password information for the named database.

Listing 4.16: Report XML for the Database Design Report

start example
 <?xml version='1.0' ?> <?xml-stylesheet type="text/xsl" href="DEFAULT.XSL"?> <File>       <Name><!-- database name --></Name>       <XMLFileType>REPORT</XMLFileType>       <SummaryLink><!-- go back to summary overview --></SummaryLink>       <CreationDate><!-- creation date of report --></CreationDate>       <CreationTime><!-- creation time of report --></CreationTime>       <Table>             <Name><!-- same as database name for now --></Name>             <ID>1</ID>             <FieldCatalog>                   <Field><!-- REPEAT for *each* field --></Field>             </FieldCatalog>       </Table>       <RelationCatalog>             <Relation><!-- REPEAT for *each* relationship --></Relation>       </RelationCatalog>       <ValueListCatalog>             <ValueList><!-- REPEAT for *each* valuelist --></ValueList>       </ValueListCatalog>       <LayoutCatalog>             <Layout><!-- REPEAT for *each* layout --></Layout>       </LayoutCatalog>       <ScriptCatalog>             <Script><!-- REPEAT for *each* Script in the Database               --></Script>       </ScriptCatalog>       <PasswordCatalog>             <Password><!-- REPEAT for *each* password --></Password>       </PasswordCatalog> </File> 
end example

You can read the XML produced by the Database Design Report in a text editor. The text is in double-byte format, or UTF-16. Your text editor may not be able to display the text properly. The double-byte format is how many more characters, such as the o-slash, can be used in your FileMaker Pro databases. A very noticeable set of two characters at the beginning of the XML are ASCII 255 (HEX 0xFF) and ASCII 254 (HEX 0xFE). The two characters are the Byte Order Mark (BOM) and tell processors how the double-byte characters are ordered in the Unicode document. Your editor or browser may not be able to display the XML created by the FileMaker Pro Database Design Report. I have found the latest version of the Internet Explorer browser seems to work well on any platform.

4.44 Details of the XML Database Design Report

Field Details

The FieldCatalog element has one child element, Field, which is repeated in the report for every field in the database. The information provided for each field can be quite extensive. Listing 4.17 shows the child elements for the element Field: Name, ID, DataType, FieldType, AutoEnterOptions, ValidationOptions, StorageOptions, Calculation, and SummaryOptions. These values may be found in the Define Field dialog. The Database Design Report will contain only those values that apply to a particular type of field. Only summary fields will have a SummaryOptions element, for example, in the report.

Listing 4.17: FieldCatalog elements

start example
 <FieldCatalog>       <Field><!-- REPEAT for *each* field -->             <Name><!-- field name --></Name>             <ID><!-- field id (same as function) --></ID>             <DataType><!-- TEXT | NUMBER | DATE | TIME | BINARY_DATA               | FURIGANA --></DataType>             <FieldType><!-- EDITABLE | CALCULATED | SUMMARY --></FieldType>             <AutoEnterOptions>                   <EntryType><!-- CREATION_TIME | CREATION_DATE |                     MODIFICATION_DATE | MODIFICATION_TIME |                     CREATOR_NAME | MODIFIER_NAME | SERIAL_NUMBER |                     PREVIOUS_DATA | CONSTANT_DATA --></EntryType>                   <SerialNumber><!-- only if EntryType is SERIAL_NUMBER                     --></SerialNumber>                   <NextValue><!-- only if EntryType is SERIAL_NUMBER                     --></NextValue>                   <Increment><!-- only if EntryType is SERIAL_NUMBER                     --></Increment>                   <ConstantData><!-- only if EntryType is CONSTANT_DATA                     --></ConstantData>                   <Calculation>                         <AlwaysEvaluate><!-- TRUE | FALSE                           --></AlwaysEvaluate>                   <Description>                         <Chunk><!-- REPEAT for *each* chunk                           (any value) -->                               <Reference><!-- see _reference_                                 types --></Reference>                         </Chunk>                   </Description>             </Calculation>             <Lookup>                   <Reference><!-- see FIELD _reference_ types                     --></Reference>                   <NoMatchCopyOptions><!-- DO_NOT_COPY |                     COPY_NEXT_LOWER | COPY_NEXT_HIGHER |                     USE_CONSTANT --></NoMatchCopyOptions>                   <CopyConstantValue><!-- any Constant Value                     --></CopyConstantValue>                   <CopyEmptyContent><!-- TRUE | FALSE                     --></CopyEmptyContent>             </Lookup>             <AllowEditing><!-- TRUE | FALSE --></AllowEditing>       </AutoEnterOptions>       <ValidationOptions>             <StrictDataType><!-- NUMERIC | FOUR_DIGIT_YEAR |               TIME_OF_DAY --></StrictDataType>             <NotEmpty><!-- TRUE | FALSE --></NotEmpty>             <Unique><!-- TRUE | FALSE --></Unique>             <Existing><!-- TRUE | FALSE --></Existing>             <ValueList>                   <Reference><!-- see VALUELIST _reference_                     types --></Reference>             </ValueList>             <Range>                   <From><!-- any FROM Range Value --></From>                   <To><!-- any TO Range Value --></To>             </Range>             <Calculation>                   <AlwaysEvaluate><!-- TRUE | FALSE                     --></AlwaysEvaluate>                   <Description>                         <Chunk><!-- REPEAT for *each* chunk                           (any value) -->                               <Reference><!-- see _reference_                                  types --></Reference>                         </Chunk>                   </Description>                   </Calculation>                   <MaxDataLength><!-- any number 1-64,000                     --></MaxDataLength>                   <StrictValidation><!-- TRUE | FALSE                     --></StrictValidation>                   <ErrorMessage><!-- Display custom message if                     validation fails --></ErrorMessage>             </ValidationOptions>             <StorageOptions>                   <Repetitions><!-- any number 1 to 1000, 1 means                     not a repeating field --></Repetitions>                   <Global><!-- TRUE | FALSE --></Global>                   <Unstored><!-- TRUE | FALSE --></Unstored>                   <Indexed><!-- TRUE | FALSE --></Indexed>                   <AutoIndex><!-- TRUE | FALSE --></AutoIndex>                   <IndexLanguage><!-- Catalan | Danish | Dutch |                     English | Finnish | Finnish (vw) | German |                     German (ä=a) | Icelandic | Italian | Norwegian |                     Portuguese | Spanish | Spanish (New Style) |                     Swedish | Swedish (vw) | Czech/Slovak |                     Hungarian | Polish | Romanian | Croatian | Turkish                     | Russian | Ukrainian | Greek | ASCII                     --></IndexLanguage>             </StorageOptions>             <Calculation>                   <AlwaysEvaluate><!-- TRUE | FALSE                     --></AlwaysEvaluate>                   <Description>                         <Chunk><!-- REPEAT for *each* chunk                           (any value) -->                               <Reference><!-- see _reference_                                 types --></Reference>                         </Chunk>                   </Description>       </Calculation>       <SummaryOptions>             <Operation><!-- TOTAL | AVERAGE | COUNT | MINIMUM |               MAXIMUM | STANDARD_DEVIATION | FRACTION_TOTAL               --></Operation>             <Reference><!-- see FIELD _reference_ types               --></Reference>             <AdditionalOperation><!-- (Total of) RUNNING_TOTAL               | (Average of) WEIGHTED_AVERAGE | (Count of)               RUNNING_COUNT | (Standard deviation)               BY_POPULATION | (Fraction of total) SUB_TOTALED               --></AdditionalOperation>             <SortedBy><!-- Summary field, Fraction of total,               Subtotaled, When sorted by -->                   <Reference><!-- see FIELD _reference_ types                     --></Reference>             </SortedBy>             <WeightedBy><!-- Summary field, Average of,               Weighted average, Weighted by -->             <Reference><!-- see FIELD _reference_ types               --></Reference>             </WeightedBy>       </SummaryOptions> </Field> </FieldCatalog>
end example

Reference Elements

The Reference elements in Listing 4.17 are used whenever another type of FileMaker Pro object is used in the Field Definition. A reference to another field, value list, or relationship might be used to define a field. These references are listed in the report under the Reference element. The child elements for the Reference element vary, but they always have a Type element. The other elements are shown in Listing 4.18.

Listing 4.18: Field Reference elements

start example
 <Reference>       <Type>FIELD_REF</Type>       <Name><!-- field name --></Name>       <ID><!-- field ID --></ID>       <TableName><!-- table name that this field is in --></TableName>       <FileName><!-- name of the database --></FileName>       <RelationshipName><!-- if a related field is used         --></RelationshipName>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

The TableName element in the Field Reference element above is used because the FieldCatalog element is in a Table element in the File element, as seen in Listing 4.16. Both TableName and FileName are needed in this reference to point to the location of the field being referenced.

The other Reference elements for value lists, relationships, scripts, and layouts are given in the following listings. These have similar child elements:

Listing 4.19: Value List Reference elements

start example
 <Reference>       <Type>VALUELIST_REF</Type>       <Name><!-- value list name --></Name>       <ID><!-- value list ID --></ID>       <FileName><!-- name of the database --></FileName>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

Listing 4.20: Relationship Reference elements

start example
 <Reference>       <Type>RELATIONSHIP_REF</Type>       <Name><!-- relationship name --></Name>       <ID><!-- relationship ID --></ID>       <FileName><!-- name of the database --></FileName>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

Listing 4.21: Script Reference elements

start example
 <Reference>       <Type>SCRIPT_REF</Type>       <Name><!-- script name --></Name>       <ID><!-- script ID --></ID>       <FileName><!-- name of the database --></FileName>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

Listing 4.22: Layout Reference elements

start example
 <Reference>       <Type>LAYOUT_REF</Type>       <Name><!-- layout name --></Name>       <ID><!-- layout ID --></ID>       <FileName><!-- name of the database --></FileName>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

The file references and function references are in Listings 4.23 and 4.24.

Listing 4.23: File Reference elements

start example
 <Reference>       <Type>FILE_REF</Type>       <Name><!-- file name --></Name>       <Link><!-- reference used to make a hyperlink in the Report         --></Link> </Reference> 
end example

Listing 4.24: Function Reference elements

start example
 <Reference>       <Type>FUNCTION_REF</Type>       <Name><!-- function name --></Name> </Reference> 
end example

All of the Reference elements may be used in the FieldCatalog, RelationCatalog, ValueListCatalog, LayoutCatalog, and ScriptCatalog. The Reference elements are used to link the other main objects together for the Database Design Report.

Relationship Details

The RelationCatalog has one child element, Relation, which is repeated for every relationship in the database. The child elements for the Relation element are Name, ID, ParentField, ChildField, CascadeDelete, CascadeCreate, and Sorted.

Listing 4.25: RelationCatalog elements

start example
 <RelationCatalog>       <Relation><!-- REPEAT for *each* Relationship -->             <Name><!-- name of Relationship --></Name>             <ID></ID>             <ParentField>                   <Reference><!-- see FIELD _reference_types                     --></Reference>             </ParentField>             <ChildField>                   <Reference><!-- see FIELD _reference_types                     --></Reference>             </ChildField>             <CascadeDelete><!-- TRUE | FALSE --></CascadeDelete>             <CascadeCreate><!-- TRUE | FALSE --></CascadeCreate>             <Sorted><!-- TRUE | FALSE --></Sorted>       </Relation> </RelationCatalog> 
end example

The Relation element is repeated in the report for every relationship in the database. The values for these elements can be found in the Define Relationship dialog. The details for sorting the element are restricted to TRUE or FALSE. No other information about the sort for the relationship is provided in the Database Design Report.

Value List Details

The ValueListCatalog has one element, ValueList, if there are any value lists defined. The ValueList element is repeated in the report for every value list in the database. They are Name, ID, Source, CustomList, PrimaryField, SecondaryField, SortSecondaryField, and ValueList. There may be references to fields, files, and other value lists in the Database Design Report.

Listing 4.26: ValueListCatalog elements

start example
 <ValueListCatalog>       <ValueList><!-- REPEAT for *each* Value List -->             <Name><!-- name of Value List --></Name>             <ID></ID>             <Source><!-- CUSTOM | LOCAL_FIELD | RELATED_FIELD               | EXTERNAL_FIELD | EXTERNAL_VALUELIST --></Source>             <CustomList><!-- list of values if custom --></CustomList>             <PrimaryField><!-- if local, related or external fields -->                   <Reference><!-- see FIELD _reference_types                     --></Reference>             </PrimaryField>             <SecondaryField><!-- if second field used in value list -->             <Reference><!-- see FIELD _reference_types --></Reference>             </SecondaryField>             <SortSecondaryField><!-- if sorting by second               field in list: TRUE | FALSE --></SortSecondaryField>             <ValueList><!-- if external value list -->                   <Reference><!-- see VALUELIST_reference_ types                     --></Reference>             </ValueList>       </ValueList> </ValueListCatalog> 
end example

Layout Details

The LayoutCatalog element will contain every layout in the database when the report is created. The Layout element has an Object element, which lists details for the fields and buttons on the named layout. References are made to value lists, script steps, and scripts for the objects on the layout. Details about the layout, such as font, part color, or other layout elements, are not included in the report.

Listing 4.27: LayoutCatalog elements

start example
 <LayoutCatalog>       <Layout><!-- REPEAT for each layout -->             <Name><!-- name of layout --></Name>             <ID></ID>             <Object><!-- REPEAT for *each* object on this layout -->                   <Name />                   <Type><!-- FIELD | BUTTON | FIELD_AND_BUTTON --></Type>                   <FieldFormat><!-- TEXT_BOX | SCROLLABLE_TEXT_BOX |                     POPUP_LIST | POPUP_MENU | CHECK_BOXES |                     RADIO_BUTTONS --></FieldFormat>                   <ValueList><!-- if field on layout has value list -->                         <Reference><!-- see VALUELIST_reference_types                           --></Reference>                   </ValueList>                   <ValueListFormat><!-- POPUP_LIST | POPUP_MENU |                     CHECK_BOXES | RADIO_BUTTONS --></ValueListFormat>                   <Reference><!-- see FIELD _reference_types, if                     object is field --></Reference>                   <AllowEditing><!-- TRUE | FALSE --></AllowEditing>                   <Command><!-- any valid Script Step, if button                     --></Command>                   <Description>                         <Chunk><!-- REPEAT for *each* chunk (any value) -->                         <Reference><!-- see _reference_ types                           --></Reference>                         </Chunk>                   </Description>             </Object>       </Layout> </LayoutCatalog> 
end example

Some of the results from the Time Billing_fp5.xml report are shown in Listing 4.28. This example shows two objects on the Form layout. The first one is a field and the second object is a button.

Listing 4.28: Example report data

start example
 <Object>       <Name>Time Billing Line Items::Date</Name>       <Type>FIELD</Type>       <FieldFormat>TEXT_BOX</FieldFormat>       <Reference>             <Type>FIELD_REF</Type>             <Name>Date</Name>             <ID>67</ID>             <TableName>Time Billing Line Items.fp5</TableName>             <FileName>Time Billing Line Items.fp5</FileName>             <Link>Time Billing Line Items_fp5.xml</Link>             <RelationshipName>Time Billing Line               Items</RelationshipName>       </Reference> <AllowEditing>TRUE</AllowEditing> </Object> <Object>       <Name>List</Name>       <Type>BUTTON</Type> <Command>Perform Script</Command>       <Description>       <Chunk> [&quot;</Chunk>       <Chunk>             <Reference>                   <Type>SCRIPT_REF</Type>                   <Name>Go to List Layout</Name>                   <ID>34</ID>                   <FileName>Time Billing.fp5 </FileName>                   <Link>Time Billing_fp5.xml</Link>             </Reference>       </Chunk>       <Chunk>&quot;]</Chunk>       </Description> </Object> 
end example

Script Details

The schema for the ScriptCatalog element is simpler but may have many values. The Script element, child of the ScriptCatalog element, is repeated for every script in the database. The Step element is repeated for every step in the Script element. The details in this portion of the Database Design Report are similar to the information found in the Define Scripts dialogs. The ScriptCatalog elements are shown in the following listing:

Listing 4.29: ScriptCatalog elements

start example
 <ScriptCatalog>       <Script><!-- REPEAT for *each* Script in the Database -->             <Name><!-- name of Script --></Name>             <ID></ID>             <Step><!-- REPEAT for *each* Step in this Script -->                   <Command><!-- any valid Script Step --></Command>                   <Description>                         <Chunk><!-- REPEAT for *each* chunk (any value) -->                               <Reference><!-- see _reference_ types                                 --></Reference>                         </Chunk>                   </Description>             </Step>       </Script> </ScriptCatalog> 
end example

Listing 4.30 shows one script from the Time Billing.xml report. The Chunk element is used to contain script step content that does not change. The Chunk element can also be the parent element for the Reference element, which would contain variable content, such as a field reference. The quote, less than, greater than, and ampersand symbols are automatically converted to the entity equivalents. Read more about the conversion in Chapter 3, section 3.5, "Entities in the DTD".

Listing 4.30: Sample script data

start example
 <Script>       <Name>Open Script</Name>       <ID>1</ID>       <Step>       <Command>Allow User Abort</Command>             <Description>                   <Chunk> [Off]</Chunk>             </Description>       </Step>       <Step>       <Command>Set Field</Command>             <Description>             <Chunk> [&quot;</Chunk>             <Chunk>                   <Reference>                         <Type>FIELD_REF</Type>                         <Name>Today&apos;s Date</Name>                         <ID>3</ID>                         <TableName>Time Billing.fp5</TableName>                         <FileName>Time Billing.fp5</FileName>                   </Reference>             </Chunk>             <Chunk>&quot;, &quot;</Chunk>             <Chunk>                   <Reference>                         <Type>FUNCTION_REF</Type>                         <Name>Status</Name>                   </Reference>             </Chunk>             <Chunk>( CurrentDate)</Chunk>             <Chunk>&quot;]</Chunk>             </Description>             </Step>             <Step>             <Command>Go to Record/Request/Page</Command>                   <Description>                   <Chunk> [Last]</Chunk>                   </Description>             </Step>             <Step>             <Command>Perform Script</Command>                   <Description>                   <Chunk> [Sub-scripts, &quot;</Chunk>                   <Chunk>                         <Reference>                               <Type>SCRIPT_REF</Type>                               <Name>Clear Sort Indicator</Name>                               <ID>32</ID>                               <FileName>Time Billing.fp5</FileName>                               <Link>Time Billing_fp5.xml</Link>                         </Reference>                   </Chunk>                   <Chunk>&quot;]</Chunk>                   </Description>             </Step>       </Script> 
end example

The script in Listing 4.30 is the same as the following:

Listing 4.31: Script steps for open script

start example
 Allow User Abort [Off] Set Field ["Today's Date", "Status(CurrentDate)" ] Go to Record/Request/Page [Last] Perform Script[Sub-scripts, "Clear Sort Indicator"] 
end example

The last script step in Listing 4.31 refers to a subscript. In the XML report, the Reference element provides enough details to allow a link to be made to the subscript in the same file. The XSL stylesheet uses this information to create a hyperlink. If the reference is to an external sub-script, the link is made only to the external file, not directly to the subscript or its name. An example of the external sub-script reference is shown below:

Listing 4.32: External sub-script reference

start example
 <Step>       <Command>Perform Script</Command>       <Description>             <Chunk> [Sub-scripts, External: &quot;</Chunk>             <Chunk>             <Reference>                   <Type>TABLE_REF</Type>                   <Name>Time Billing Line Items.fp5</Name>                   <Link>Time Billing Line Items_fp5.xml </Link>             </Reference>       </Chunk>       <Chunk>&quot;]</Chunk>       </Description> </Step> 
end example

Password Details

The password information is also in the Database Design Report. This information can only be obtained if the databases are opened with a top-level or master access. None of the design items, such as fields and scripts, can be obtained without this top-level access. You can limit what items are in the report. See Figure 4.3, the dialog for creating the Database Design Report. Should you wish to create the report and not include the passwords, deselect this item in the dialog before creating the report.

Listing 4.33: PasswordCatalog elements

start example
 <PasswordCatalog>       <Password><!-- REPEAT for *each* password -->             <Name><!-- name of password --></Name>             <Privileges>                   <MasterAccess><!-- TRUE | FALSE --></MasterAccess>                   <BrowseRecords>                         <!-- TRUE | FALSE -->                   <Description>                         <Chunk><!-- REPEAT for *each* chunk (any value) -->                               <Reference><!-- see _reference_ types                                 --></Reference>                         </Chunk>                   </Description>                   </BrowseRecords>                   <EditRecords>                         <!-- TRUE | FALSE -->                   <Description>                         <Chunk><!-- REPEAT for *each* chunk (any value) -->                               <Reference><!-- see _reference_ types                                 --></Reference>                         </Chunk>                   </Description>                   </EditRecords>                   <DeleteRecords>                         <!-- TRUE | FALSE -->                   <Description>                         <Chunk><!-- REPEAT for *each* chunk (any value) -->                               <Reference><!-- see _reference_ types                                 --></Reference>                         </Chunk>                   </Description>                   </DeleteRecords>                   <CreateRecords><!-- TRUE | FALSE --></CreateRecords>                   <PrintRecords><!-- TRUE | FALSE --></PrintRecords>                   <ExportRecords><!-- TRUE | FALSE --></ExportRecords>                   <DesignLayouts><!-- TRUE | FALSE --></DesignLayouts>                   <EditScripts><!-- TRUE | FALSE --></EditScripts>                   <DefineValueLists><!-- TRUE | FALSE                     --></DefineValueLists>                   <ChangePassword><!-- TRUE | FALSE --></ChangePassword>                   <Override><!-- (data entry warnings) TRUE | FALSE                     --></Override>                   <IdleDisconnect><!-- TRUE | FALSE --></IdleDisconnect>                   <Menu><!-- NORMAL | EDITING_ONLY | NONE --></Menu>             </Privileges>       </Password> </PasswordCatalog> 
end example

Listing 4.33 shows the child elements for the PasswordCatalog element. Only one child element, Password, is repeated in the report for every password in the database. The elements for the Password element are similar to the information found in the Define Passwords dialog. The settings in the Define Passwords dialog are used in the Database Design Report. The information found in the Access Privileges dialog is not used in the Database Design Report. The Access Privileges dialog in FileMaker Pro defines the group-level access to layouts and fields.

4.45 FileMaker Pro Document Definitions

The FMPXMLLAYOUT, FMPXMLRESULT, and FMPDSORESULT schema/grammar formats follow the recommendations of the World Wide Web Consortium for writing Document Type Definitions (DTD). The schema/grammar format for the Database Design Report XML output is closer to the style of the more detailed schema documents. All of these types of formats can be used to define particular types of documents. The DTD and schema formats are used to keep a document type standard.

Chapters 3 and 4 have examined the standards for DTDs and FileMaker Pro XML. The next chapter begins to explain how to use the XML in web publishing. A sample was provided in Listing 4.16 to display the Database Design Report in a browser. The stylesheet uses XSL (XML Stylesheet Language) to transform the XML in the report into HTML. Chapter 6 will cover HTML and how it is used to display text in a web browser. Chapter 7 will discuss XSL and how it can be used to transform your FileMaker Pro XML into other kinds of documents.



Filemaker Pro 6 Developer's Guide to XML(s)XSL
FileMaker Pro 6 Developers Guide to XML/XSL (Wordware Library for FileMaker)
ISBN: 155622043X
EAN: 2147483647
Year: 2003
Pages: 100
Authors: Beverly Voth

Similar book on Amazon

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