Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter ElevenSGML Functions (continued)

SGMLGetParameter Function

Overview

The SGMLGetParameter function returns a parameter as a string value. The attribute or CSS property can be specified as a string or as a token.

Syntax/Parameters

Syntax

string = SGMLGetParameter ( handle hSGML, TOKEN token | string property );

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.

Return Value

A string containing the value for the specified attribute/property or an empty string on error. Because a value can legitimately be empty, the GetLastError or IsError function must be used to determine if an error occurs.

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

Remarks

An element must be selected in the SGML Object to have any parameters loaded or modified using the SGMLNextElement, SGMLPreviousElement or SGMLSetParameter functions. SGMLNextItem will either load an element with parameters or clear the parameters depending on whether a tag was parsed.

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 for defined values, 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, note that shorthand values are always converted to their constituent components, for example, “margin: 0pt” will have four properties for top, right, bottom and left.

When using a string as a property name, adding a ‘+’ prefix will force the value to be a CSS property and to ignore the HTML attribute names.

If the internal value is a pvalue, it will automatically be converted to a string. Errors are converted to error strings. When retrieved the string will be contained in double quotes. Retrieving the pvalue will also return error details.

Use caution when setting a pvalue type (or any numeric) variable from this function since Legato will automatically cast and convert the string to an integer which will not be in the correct format. The SGMLGetParameterValue function should be used to retrieve numeric values.

For HTML, all inline CSS styles parameters are automatically loaded and processed. The ‘STYLE’ attribute is not available for direct reading.

Related Functions

Platform Support

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

Legato IDE, Legato Basic