Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ElevenSGML Functions (continued)

SGMLPutParameter Function

Overview

The SGMLPutParameter function sets a parameter into the element class of an SGML object by name or token unless the parameter is “mixed” or “default”. If mixed, the function is ignored and the any existing value in the element class is unaltered. If default, the existing parameter and value are deleted. The data can be a raw string or a pvalue.

Syntax/Parameters

Syntax

int = SGMLPutParameter ( handle hSGML, TOKEN token | string property,
                                   string data | PVALUE data );

Parameters

hSGML

A handle to an SGML object.

token

An optional TOKEN (dword) as a token value for an attribute or CSS property. The token must be defined in the DTD. Or,

property

An optional string specifying a text version of the attribute or CSS property. The property is tested as an attribute and then as a CSS property name. If not found in the DTD, an error is returned. Either the token or property parameter must be provided.

data

A string or PVALUE (dword) containing the data to be set, The suitability of the data is not tested and if improperly formatted may result in errors being written. It is the responsibility of the programmer to insure proper values are written. pvalue content is not checked and if invalid may result in an error during tag write process.

Return Value

An int as the parameter position or 0, or a formatted error code.

If the property name cannot be translated, the value 0x1002 will be ORed bitwise with the error code.

Remarks

Unlike the SGMLSetParameter function, the SGMLPutParameter has logic to process mixed and default conditions.The function does not test the DTD for applicability of the attribute/property for the element.

For standard W3C defined attributes and properties, SDK defined token values can be referenced with the following standard prefixes:

HA_ — HTML attribute. for example, HA_ALIGN or HA_SIZE for “ALIGN=” or “SIZE=”

CP_ — CSS property, for example, CP_TEXT_ALIGN or CP_MARGIN_TOP for “text-align” or “margin-top”

Note that any where a dash ‘-’ is used in a name, it is replaced with an underbar ‘_’. See Appendix A — Legato SDK Standard Definitions. for a complete list of definitions.

For CSS properties, certain parameters may be combined as shorthand during the write process. For example, font-family and font-size might be combined. It is advisable not to write shorthand properties directly.

When writing a numeric value, it will be interpreted as a pvalue. Therefore, placing the number 2 in the field is the equivalent of added PT_INT | 2, the result will be .02 since the values are measured in 100ths.

The overall element data heap size limits the size of strings to no more that 4,096 total characters.

The parameter slot used may be a deleted position, overwrite an existing name or be appended to the end of the parameters.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic