Content models for XFDL options

The content of an option can take one of two formats: simple character data or a subtree of XML elements. In the latter case, the element children are typically referenced as a zero-based array. The XFDL-specific options that have simple content versus array content are defined by the parameter entity references %simpleOption; and %arrayOption; under:

[16]      <!ENTITY % simpleOptions "(acclabel | activated | active | bgcolor | 
          border | data | dirtyflag | filename | filesize | focused | focuseditem | 
          fontcolor | formid | fullname | image | imagemode | justify | 
          keypress | label | labelbgcolor | labelborder | labelfontcolor | 
          linespacing | mimedata | mimetype | mouseover | next | orientation | 
          padding |pageid | previous | printbgcolor | printfontcolor | printing | 
          printlabelbgcolor | printlabelfontcolor | printvisible | readonly | 
          rowpadding | rtf | saveformat |scrollhoriz | scrollvert | signature | 
          signatureimage | signer | signformat | texttype | thickness | 
          transmitformat | triggeritem |type | ufv_settings | url | value | 
          version | visible | writeonly | xformsenabled)">
[17]      <!ELEMENT %simpleOptions; (#PCDATA)>
[18]      <!ENTITY % arrayOptions "(borderinfo |colorinfo | coordinates | datagroup | 
          delay | display | enclosuresettings | excludedmetadata |  fontinfo | format |
          gradient | itemlocation | labelfontinfo | layoutflow | layoutinfo | 
          printsettings | requirements | signdatagroups | signdetails | signitemrefs | 
          signitems | signnamespaces | signoptionrefs | signoptions | signpagerefs | 
          size | transmitdatagroups | transmitgroups | transmititemrefs | 
          transmititems | transmitnamespaces | transmitoptionrefs |
          transmitoptions | transmitpagerefs | ufv_settings)">

While the simple options are clearly shown to contain character data, the further details of their content models are not shown. For example, all color options support specification of an RGB triplet using either #RRGGBB in hexadecimal or rrr,ggg,bbb in decimal as well as any color name given in Color table.

The array options defined previously also each contain sub-elements that could contain either simple character data or further element depth. The following are the content models of the various array options, where all undefined elements resolve to simple character content (PCDATA):

[19]      <!ELEMENT borderinfo (style, color)>
[20]      <!ELEMENT colorinfo (window,windowtext,borderlight,bordershadow,
          buttonface,buttontext)>
[21]      <!ELEMEMT coordinates (x,y)>
[22]      <!ELEMENT datagroup (datagroupref+)>
[23]      <!ELEMENT delay (type,interval)>
[24]      <!ELEMENT dialog (active, copies, orientation, printpages)>
[25]      <!ELEMENT excludedmetadata (servernotarizations)>
[26]      <!ELEMENT fontinfo (fontname, size, effect+)>
[27]      <!ELEMENT format (datatype (date, day_of_month, day_of_week, 
          date_time, currency, float, integer, month, string, time, void, 
          year)*, presentation (calendar, casetype, currencylocale, 
          decimalseparator,fractiondigits, groupingseparator, keepformatindata, 
          negativeindicator, pad, padcharacter, pattern, patternrefs, round, 
          separator, showcurrency, significantdigits, style)*, constraints 
          casesensitive, checks, decimalseparators, groupingseparators, length, 
          mandatory, message, patterns, range, separators, template, yearwindow)*)>
[28]      <!ELEMENT gradient (type, color, rate)>
[29]      <!ELEMENT itemlocation (x | y | width | height | offsetx | offsety | 
          above | after | before | under | within | alignb2b | alignb2c | alignb2t | 
          alignc2b | alignc2l | alignc2r | alignc2t | alignhorizbetween | 
          alignhorizc2c | alignl2c | alignl2l | alignl2r | alignr2c | alignr2l | 
          alignr2r | alignt2b | alignt2c | alignt2t | alignvertbetween | 
          alignvertc2c | alignb2b | expandb2c | expandb2t | expandl2c | 
          expandl2l | expandl2r | expandr2c | expandr2l | expandr2r | expandt2b | 
          expandt2c | expandt2t)+>| expandheight| expandwidth
[30]      <!ELEMENT labelfontinfo (fontname, size, effect+)>
[31]      <!ELEMENT layoutinfo (pagehashes (pagehash (pageref, hash))+)>
[32]      <!ELEMENT pages (filter, pageref+)>
[33]      <!ELEMENT printpages (active, choice)>
[34]      <!ELEMENT printsettings (pages, dialog, border, pagelayout, 
          radiosaschecks, radioswithoutvalues, scrollbarsonfields, 
          singlelinefieldsaslines)>
[35]      <!ELEMENT requirements (requirement*, detected)>
[36]      <!ELEMENT servernotarizations (ae+)>
[37]      <!ELEMENT (signdatagroups | transmitdatagroups) (filter, datagroupref+)>
[38]      <!ELEMENT signdetails ((dialogcolumns (property+))?, (filteridentity 
          (filter (tag, value))+)?)>
[39]      <!ELEMENT (signitemrefs | transmititemrefs) >
[40]      <!ELEMENT (signitems | transmititems) >
[41]      <!ELEMENT (signnamespaces | transmitnamespaces) >
[42]      <!ELEMENT (signoptionrefs | transmitoptionrefs) >
[43]      <!ELEMENT (signoptions | transmitoptions) >
[44]      <!ELEMENT (signpagerefs | transmitpagerefs) >
[45]      <!ELEMENT size (width, height)>
[46]      <!ELEMENT xformsmodels (xforms:model+)>

For any character data option or array element in XFDL, an encoding attribute can be specified for the content. As shown under, the content model of simple options is character data. The values “xml” (for plain text), “base64” and “base64-gzip” can be used in the encoding attribute. The default is 'xml' except for the mimedata option, which as “base64-gzip” as the default. A content encoding of base64 is useful if the content being encoded is already in a compressed format, such as PNG or JPEG. If the encoding is not “xml” then an XFDL-compliant processor applies the requisite decoders before interpreting the content in the application context, and it applies the appropriate encoders during serialization. The XFDL encoding attribute can also be used on custom options and array elements, but it would have to be namespace qualified since custom options are in a non-XFDL namespace.

Any character data option or array element can be qualified with the transient attribute. The valid values are on and off, with a default of off for options and array elements in XFDL items not containing XForms user interface elements and on in XFDL items that do contain XForms user interface controls. When an option or array element is transient, its content can be changed during run time, but the original content obtained when the form was read will be restored upon serialization. In an XFDL item whose <value> option is controlled by an XForms user interface binding, the instance data holds the current value bound to the control, so there is no need for the presentation layer node to be changed. Transience allows options and array elements to be changed during runtime of the form without breaking a digital signature over the option.

The content of any character data option or array element can also be qualified by a compute attribute, which defines an expression used to obtain and update the content based on content elsewhere in the form. Typically, computations over data are performed in an XForms model using the <xforms:bind> element and its calculate attribute or other model item properties such as constraint, readonly, relevant, and required. However, calculations of presentation layer properties are performed with XFDL computes, and where they are dependent on instance data, they reference the transient <value> option of a user interface item bound to that data. The details of XFDL computes appear in XFDL compute system, the basic idea can be gleaned from the following example, which shows label that turns red when the value is negative:

   <label sid="IncomeTax">
      <xforms:output ref="incomeTax/Total"/>
      <fontcolor compute="value >= '0' ? 'black' : 'red'"/>
   </label>

At the start-up, the fontcolor option has empty content. When the XForms user interface binding creates the <value> option and places the purchase order total value into it, then the compute in the fontcolor is automatically evaluated, with a result of either red or black. When the form is serialized, e.g saved to disk, submitted or signed, the fontcolor content rendered into the serialization is empty because all options in an XForms controlled XFDL item are transient. Thus, XFDL computes can run even if the label item is signed because the countenance of the label can only be changed if the data changes, which can only occur if the data is not signed.