3.5 Entities in the DTD

3.4 A DTD for FileMaker Pro Themes

New in FileMaker Pro 5, 5.5, and 6 is an easier way to create layouts for data entry and reports. Choosing a standard style for all the layouts and reports in a set of databases can provide a sense of consistency throughout the set. The New Layout/Report assistant uses the default files included when you install FileMaker Pro. These theme files are XML formatted and may be viewed or changed with a text editor program. You can change the values of the attributes in any theme document and create new themes. Any theme that you create and rename can be added to the Themes folder, and it will appear in the dialog list when you create a new layout. A sample of the New Layout/Report dialog is shown in Figure 3.1.

click to expand
Figure 3.1: Create a New Layout dialog

click to expand
Figure 3.2: Themes from the Themes folder

Be very careful to include the .fth extension to the filename for any themes you create or they may not be available for use by the New Layout/Report assistant in FileMaker Pro.

If you make any errors when you change the text in a theme, the dialog may show unpredictable results even for good theme files.

3.41 Every Layout Must Have at Least One Part

There are utilities available to assist you in creating custom themes. Theme Creator, for one, is available for download at http://www.themecreator.com/. You can import existing themes, edit them, and save them with new names. All the error checking is done for you in creating a well-formed XML theme file. This free FileMaker Pro solution contains over 11,000 colors, including many popular Pantone colors. You can add your own custom colors and create custom color palettes.

Layouts in FileMaker Pro can have default values based on a chosen theme or you can set values for a single object on the layout. Using Command+click in Macintosh or Control+click in Windows on any object on the layout will set the attributes of that type of object as a default. The default theme attributes will be used the next time you create a new object of the same type. FileMaker Pro uses these defaults and the XML theme files to create the layout elements for part background color, field and text colors, borders, and fonts.

Only new layouts can be created with the New Layout/Report assistant. You cannot change an existing layout with any of the default or custom themes. You could also use these XML theme files as stylesheet information if you want to web publish your data.

3.42 Creating a New Layout

Choose View, Layout Mode and then Layouts, New Layout/Report. There are six layout types. Standard form is used for general data entry and reports. Columnar list/report is where summaries are generally located. Table View is a quick listing of columns of fields. Labels can be selected from a list of standard sizes or customized for repeating items on one page. Envelope reports are a standard envelope size for placing the address and return address on an envelope. The last layout type is blank and provides a layout with only a header, body, and footer. You can revise any layout after it is created, including those using themes.

If you select Standard form layout type and click the Next button, you will be asked to choose the fields you want on your layout. The next dialog will ask you to select a theme. Any valid theme file will appear in this list. Some themes appear to be similar. Lavender is listed as a Lavender Screen theme and a Lavender Print theme. Click on them one at a time and look at them in the preview. You should notice the header, body, and footer colors change. The text styles may also change. These object styles are all stored in the XML document for that theme. Lavender has one theme file, "Lavender.fth", but has two themes, "Lavender Screen" and "Lavender Print."

Theme files contain definitions for these layout objects:

  1. Theme name (there can be more than one theme in a theme file)

  2. Title Header

  3. Header

  4. Leading Grand Summary

  5. Leading Subsummary parts (you can define up to ten per theme)

  6. Body

  7. Trailing Subsummary parts (you can define up to ten per theme)

  8. Trailing Grand Summary

  9. Footer

  10. Title Footer

  11. Field baselines, borders, background fill, and font characteristics

  12. Layout Text borders, background fill, and font characteristics

  13. Field Label borders, background fill, and font characteristics

We will use the Lavender theme information to create a Document Type Definition for theme files. Only the New Layout/Report assistant uses these theme files, and they do not need to be validated with a DTD. Exercise 3.2 will help you understand Document Type Definitions. The theme files will be used in Chapter 4 to explain how to parse (read XML) into FileMaker Pro. You can use these theme files as stylesheets for your web published databases, so understanding the structure will be helpful.

Standard themes included with FileMaker Pro 5:

  • Blue_gold.fth

  • Brick.fth

  • Citrus.fth

  • Fern_green.fth

  • Lavender.fth

  • Ocean_blue.fth

  • Softgray.fth

  • Teal.fth Wheat.fth

In addition to the themes listed above, there are new themes included with FileMaker Pro 5.5 and 6:

  • Aqua.fth

  • Hc_Black.fth

  • Hc_pumpkin.fth

  • Hc_White.fth

  • Windows_standard.fth

All these theme files may have multiple themes, and each theme will be listed in the New Layout/Report assistant. Any themes you create will also be listed if they are well-formed XML files and conform to the standards for FileMaker Pro theme files.

Create a Document Type Definition (DTD) for Themes

Look at the theme called "Lavendar.fth" located in the Themes folder of the FileMaker Pro folder. Make a copy of this file and open it with a text editor such as Notepad on Windows or SimpleText on Macintosh. You may find the text all running together with no apparent line breaks. You can change the end-of-line character(s) in your text editor to make this more legible. If you change the extension from ".fth", which means FileMaker themes, to ".xml", you can view the file in Microsoft Internet Explorer 5 for Macintosh or Windows. The Internet Explorer browser creates a document tree for displaying the XML. The indented style of the tree will make it easier to see the elements and subelements.

Immediately, you see that the first line declares this document to be a well-formed XML document. <?xml version="1.0" standalone="yes" ?> is the prolog for the theme document. All the elements are paired markup or empty markup with attributes. The theme document contains no content in the elements, only elements, attributes, and comments. The first element (root element) is also the Document Type. We will use a theme file to create a DTD for FileMaker Pro themes. While it is not necessary to have a valid theme document, the following exercise will help you see how DTDs are created.

Exercise 3.2: Create a Document Type Definition for FileMaker Pro Theme Files

  1. Create the DTD with the root element as the document type and first element.

     <!DOCTYPE FMTHEMES [      <!ELEMENT FMTHEMES ()> <!-- continue adding elements and attributes --> ]>
  2. Look at the document and see that the only child element of FMTHEMES is FMTHEME, so we will list this in the definition. The element FMTHEME must occur at least once and can be repeated, so we add the "+" symbol to indicate one or more occurrences.

     <!DOCTYPE FMTHEMES [      <!ELEMENT FMTHEMES (FMTHEME)+> <!-- continue adding elements and attributes --> ]> 
  3. The first two children elements of FMTHEME are THEMENAME and VERSION. One of each of these elements occurs in the document.

     <!DOCTYPE FMTHEMES [      <!ELEMENT FMTHEMES (FMTHEME)+>      <!ELEMENT FMTHEME (THEMENAME, VERSION)> <!-- continue adding elements and attributes --> ]> 
  4. As you study the XML tree, you may see other elements that seem to repeat. The children of the layout parts are very much the same. To summarize these, the following example will help us continue to build the DTD. The parts have not been all listed but condensed to "_____PART." The summary below shows the similar elements that are children of each of the parts. The unique child element PARTNUMBER only occurs in the subsummary parts.

     <FMTHEMES>      <FMTHEME>      <THEMENAME VALUE="" HINT=""/>      <VERSION VALUE="ver. 1.0" />      <THEMEDEFAULT VALUE="" />      <____PART>           <PARTNUMBER VALUE="" />           <FILL COLOR="" PATTERN="" />           <TEXT>                <CHARSTYLE FONT="" SIZE="" STYLE="" COLOR="" />                <EFFECT VALUE="" />                <FILL COLOR="" PATTERN="" />                <PEN COLOR="" PATTERN="" SIZE="" />           </TEXT>           <TEXTLABEL>                <CHARSTYLE FONT="" SIZE="" STYLE="" COLOR="" />                <EFFECT VALUE="" />                <FILL COLOR="" PATTERN="" />                <PEN COLOR="" PATTERN="" SIZE="" />           </TEXTLABEL>           <FIELD>                <BASELINE>                     <PEN COLOR="" PATTERN="" SIZE="" />                     <ONOFF VALUE="" /> <!-- "ON" or "OFF" -->                </BASELINE>                <BORDER>                     <PEN COLOR="" PATTERN="" SIZE="" />                     <SIDES VALUE="" />                </BORDER>                     <CHARSTYLE FONT="" SIZE="" STYLE="" COLOR="" />                     <EFFECT VALUE="" />                     <FILL COLOR="" PATTERN="" />                </FIELD>           </____PART>      </FMTHEME> </FMTHEMES> 

  5. If you collapse the tree by clicking on the "-" in front of a line in the browser, you will see the other children of FMTHEME. These are all the layout parts used to create a report. There can be multiple leading or trailing subsummary parts. The element PARTNUMBER is used to designate which subsummary is used. The value of this part number is 0-9.

    click to expand
    Figure 3.3: Theme file viewed as XML tree

  6. We can add the part elements to our definition for the FMTHEME element. These are optional for each theme and there may be multiple subsummaries. We use the "?" around the parts element list and "" by the subsummary parts. Remember that the layout parts are optional, but there must be at least one part in every layout. There is another child element of FMTHEME not shown in the Lavender.fth theme. That element is optional but may be used. The THEMEDEFAULT element supplies any elements that may be missing or invalid in a theme file. When you set the font or the border color of items, for example, in layout mode they become the default for the next object of the same type you add to the layout. These defaults are used if the value of THEMEDEFAULT is "current"; otherwise "standard" is used and takes the values that would be set the first time FileMaker Pro creates a new database.

     <!DOCTYPE FMTHEMES [ <!ELEMENT FMTHEMES (FMTHEME)+> <!ELEMENT FMTHEME (THEMENAME, VERSION, THEMEDEFAULT,   (TITLEHEADERPART, HEADERPART, LEADGRANDSUMPART,   LEADSUBSUMPART*, BODYPART, TRAILSUBSUMPART*,   TRAILGRANDSUMPART, FOOTERPART, TITLEFOOTPART)?) > <!-- continue adding elements and attributes --> ]>
  7. We need to define each of the part's children of FMTHEME. If the element has no further children, it receives the content specification for that element. For all the elements of the document, any element without a start and end element is EMPTY.

    At this time, we can also begin to add the attributes for the first three children. Attributes may be added anywhere in the document, but it is easier to understand if they can be defined just after the elements to which they belong. Note that the !ATTLIST uses the element name as its type, and the next item is the name of the attribute. Any other specifications for the attribute follow the name of that attribute.

     <!DOCTYPE FMTHEMES [      <!ELEMENT FMTHEMES (FMTHEME)+>      <!ELEMENT FMTHEME (THEMENAME, VERSION, THEMEDEFAULT,        (TITLEHEADERPART, HEADERPART, LEADGRANDSUMPART,        LEADSUBSUMPART*, BODYPART, TRAILSUBSUMPART*,        TRAILGRANDSUMPART, FOOTERPART, TITLEFOOTPART)?) >      <!ELEMENT THEMENAME EMPTY>           <!ATTLIST THEMENAME                VALUE CDATA #REQUIRED                HINT (WIN | MAC)>      <!ELEMENT VERSION EMPTY>           <!ATTLIST VERSION                VALUE CDATA "ver. 1.0">      <!ELEMENT THEMEDEFAULT EMPTY>           <!ATTLIST THEMEDEFAULT           VALUE #IMPLIED (current | standard)> <!-- continue adding elements and attributes --> ]>

    THEMENAME is an empty element, as it has no children or content. The attribute VALUE is CDATA (character data) and is required. THEMENAME also has the attribute HINT, which is optional but tells which platform version of FileMaker Pro the theme was created on. The platform listing is valuable if you want to preserve characters that otherwise change, for example, option+o for the character o-slash ().

    VERSION is also empty and has one attribute. The attribute has the same name as in the THEMENAME element, but we define it to be of VERSION type. VALUE here is CDATA and contains the default string "ver. 1.0". THEMEDEFAULT is empty with the attribute VALUE. Since there are only two choices for this value, we list them with the "" between them to mean we can use either. "" is the symbol for "or."

  8. Define each of the layout part elements and any optional children of each. The PARTNUMBER element is added to the subsummary parts. Since the parts can contain the same children elements, we group them together and then define the children.

     <!ELEMENT TITLEHEADERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT HEADERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT LEADGRANDSUMPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT LEADSUBSUMPART (FILL, TEXT, TEXTLABEL, FIELD, PARTNUMBER)?> <!ELEMENT BODYPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT TRAILSUBSUMPART (FILL, TEXT, TEXTLABEL, FIELD, PARTNUMBER)?> <!ELEMENT TRAILGRANDSUMPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT FOOTERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT TITLEFOOTPART (FILL, TEXT, TEXTLABEL, FIELD)?>

  9. Continue to define the detail elements of the layout parts, any of their children, and attributes. FILL is the background color and pattern chosen for a part when it is selected in layout mode. FILL is also used inside the text, field label, and field definitions.

     <!ELEMENT FILL EMPTY>      <!ATTLIST FILL           COLOR CDATA #IMPLIED           PATTERN CDATA #IMPLIED> <!-- colors are the HEX values for red, green and blue, #RRGGBB --> <!-- patterns are: (1-64 | none = 1| solid = 2 | ltgray = 8 |   gray = 7 | dkgray = 6) --> <!-- for example: "<FILL COLOR='#FF00FF' PATTERN='SOLID' />" --> <!ELEMENT PARTNUMBER EMPTY>      <!ATTLIST PARTNUMBER           VALUE CDATA #IMPLIED> <!-- (this can be a single digit, 0-9) --> <!-- for example: "<PARTNUMBER VALUE='3' />" -->

  10. Comments can be added to your DTD for clarity or to further define the attributes. If these values are not explicitly listed with the attribute, any value can be used. For example, instead of CDATA in the VALUE attribute for the element PARTNUMBER, you could be specific. One of these values must be used and "0" is the default, as seen in this example:

     <!ATTLIST PARTNUMBER VALUE (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9) "0">
  11. TEXT is any text on the layout that is not field or field labels. TEXTLABEL is the label created by FileMaker Pro when you place a field on the layout and is the field name. FIELD is the field attributes and has two additional children that TEXT and TEXTLABLE do not have, BASELINE and BORDER.

     <!ELEMENT TEXT (CHARSTYLE, EFFECT, FILL, PEN)?> <!ELEMENT TEXTLABEL (CHARSTYLE, EFFECT, FILL, PEN)?> <!ELEMENT CHARSTYLE EMPTY>      <!ATTLIST CHARSTYLE           FONT CDATA #IMPLIED           SIZE CDATA #IMPLIED           STYLE CDATA #IMPLIED "plain"           COLOR CDATA #IMPLIED> <!-- font name(s) in Title Case and comma separated list --> <!-- point size for the font --> <!-- style can be plain or multiples of any of the other options   (depending on platform 'rules') --> <!-- plain OR ( bold & italic & (strikeout or strikethru) & (underline   or wordunderline or dblunderline) & (smallcaps or uppercase or   lowercase or titlecase or subscript or superscript) & (condense or   extend)), all optional with "plain" as the default --> <!-- for example: "<CHARSTYLE FONT='Helvetica, Arial, Sans Serif'   SIZE='12' STYLE='bold, italic' COLOR='#FF0000' />" --> <!ELEMENT EFFECT EMPTY>      <!ATTLIST EFFECT           VALUE #IMPLIED (emboss | engrave | dropshadow | none)             "none"> <!-- since there are only a few values, we list them and include the   default --> <!-- for example: "<EFFECT VALUE='EMBOSS' />" --> <!ELEMENT PEN EMPTY>      <!ATTLIST PEN           COLOR CDATA #IMPLIED           PATTERN CDATA #IMPLIED           SIZE CDATA #IMPLIED> <!-- this is the same attribute name as font, but is the line size   (0 = none, -1 = hairline, otherwise 1-12) --> <!-- for example: "<PEN COLOR='#000033' PATTERN='NONE' SIZE='-1'   />" -->

  12. FIELD is the final element listed and shows only the two unique children, BASELINE and BORDER, as the other element definitions are already in the document.

     <!ELEMENT FIELD (CHARSTYLE, EFFECT, FILL, PEN, BASELINE, BORDER)?>      <!-- the first four elements have been previously defined -->      <!ELEMENT BASELINE (PEN, ONOFF)?>           <!-- PEN has been defined as an element -->           <!ELEMENT ONOFF>                <!ATTLIST ONOFF                     VALUE #IMPLIED (on | off) "off">                     <!-- by default the baseline is off -->      <!-- for example: "<BASELINE>                          <PEN VALUE='2' />                          <ONOFF VALUE='ON' />                     </BASELINE>" -->      <!ELEMENT BORDER (PEN, SIDES)?>           <!ELEMENT SIDES>                <!ATTLIST SIDES                     VALUE CDATA #IMPLIED>                <!-- (sides can be top, bottom, left, right or any                  combination of these, space separated) -->           <!-- for example: "<BORDER                               <PEN VALUE='1' />                               <SIDES VALUE='TOP LEFT' />                </BORDER>" -->

    The FileMaker Pro Developer's Guide says that "on/off" is for field borders on p. 5-8 and for field baselines on p. 5-6. PEN SIZE="0" determines if the border on a field is off. There is no other way to show the field baseline; p. 5-6 is correct.

  13. Put this all together as a basic DTD. If you want to be more precise, go back and change those attributes with just CDATA. Note that this DTD only has elements, attribute lists, and comments. There is no parsed character data, so you do not see #PCDATA.

     <!DOCTYPE FMTHEMES [      <!ELEMENT FMTHEMES (FMTHEME)+>      <!ELEMENT FMTHEME (THEMENAME, VERSION, THEMEDEFAULT,        (TITLEHEADERPART, HEADERPART, LEADGRANDSUMPART,        LEADSUBSUMPART*, BODYPART, TRAILSUBSUMPART*,        TRAILGRANDSUMPART, FOOTERPART, TITLEFOOTPART)?) >      <!ELEMENT THEMENAME EMPTY>           <!ATTLIST THEMENAME VALUE CDATA #REQUIRED> <!ELEMENT VERSION EMPTY>      <!ATTLIST VERSION           VALUE CDATA #IMPLIED "ver. 1.0"> <!ELEMENT THEMEDEFAULT EMPTY> <!ATTLIST THEMEDEFAULT           VALUE #IMPLIED (current | standard)> <!ELEMENT TITLEHEADERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT HEADERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT LEADGRANDSUMPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT LEADSUBSUMPART (FILL, TEXT, TEXTLABEL, FIELD,   PARTNUMBER)?> <!ELEMENT BODYPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT TRAILSUBSUMPART (FILL, TEXT, TEXTLABEL, FIELD,   PARTNUMBER)?> <!ELEMENT TRAILGRANDSUMPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT FOOTERPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT TITLEFOOTPART (FILL, TEXT, TEXTLABEL, FIELD)?> <!ELEMENT FILL EMPTY>      <!ATTLIST FILL           COLOR CDATA #IMPLIED           PATTERN CDATA #IMPLIED> <!ELEMENT PARTNUMBER EMPTY>      <!ATTLIST PARTNUMBER           VALUE CDATA #IMPLIED> <!ELEMENT TEXT (CHARSTYLE, EFFECT, FILL, PEN)?> <!ELEMENT TEXTLABEL (CHARSTYLE, EFFECT, FILL, PEN)?> <!ELEMENT CHARSTYLE EMPTY>      <!ATTLIST CHARSTYLE           FONT CDATA #IMPLIED           SIZE CDATA #IMPLIED           STYLE CDATA #IMPLIED "plain"           COLOR CDATA #IMPLIED> <!ELEMENT EFFECT EMPTY>      <!ATTLIST EFFECT           VALUE #IMPLIED (emboss | engrave | dropshadow |             none) "none">      <!ELEMENT PEN EMPTY>           <!ATTLIST PEN                COLOR CDATA #IMPLIED                PATTERN CDATA #IMPLIED                SIZE CDATA #IMPLIED> <!ELEMENT FIELD (CHARSTYLE, EFFECT, FILL, PEN, BASELINE,   BORDER)?> <!ELEMENT BASELINE (PEN, ONOFF)?>      <!ELEMENT ONOFF>           <!ATTLIST ONOFF                VALUE #IMPLIED (on | off) "off"> <!ELEMENT BORDER (PEN, SIDES)?>      <!ELEMENT SIDES>           <!ATTLIST SIDES                VALUE CDATA #IMPLIED> ]>

As an extra challenge, create a Document Type Definition for the FileMaker Pro labels. You will discover that these are also XML files and used by the New Layout/Report assistant. The document LabelsUS.flb is found in the Labels folder of the FileMaker Pro folder. (Your label file may have a different name or you may have more than one file, depending upon installation.)



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