Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter ElevenSGML Functions (continued)

SGMLCreate Function

Overview

The SGMLCreate function creates an SGML parsing and support object and optionally sets the source data.

Syntax/Parameters

Syntax

handle = SGMLCreate ( );

handle = SGMLCreate ( handle hSource, [int dtd] );

handle = SGMLCreate ( string data, [dword mode], [int dtd] );

Parameters

hSource

An optional handle to the source data to parse. The handle can be to a Mapped Text Object, an Edit Object, a Pool Object or an edit window. Or,

data

An optional string specifying a filename, URI or a string containing SGML (HTML or XML) to load. If a filename or URI is specified, it cannot contain returns (0x0D) or open angle brackets (‘<’).

mode

An optional dword specifying the map mode to used if the data parameter specified a file or URI. The default value is MFC_ALLOW_TABS | MFC_SILENT which means the file is opened exclusive read write. See OpenMappedTextFile for additional information.

dtd

An optional int specifying a DTD code. The default is DTD_DEFAULT_HTML_50 or it is referenced from the source data. See SGMLSetHTMLDTD for a list of available DTDs.

Return Value

A handle to an SGML data object or NULL_HANDLE (0) on error. Use the GetLastError function to retrieve more information.

Remarks

To use the SGML object, the SGMLCreate function is called which returns an SGML Object handle. Data can be added during the create process or later using the SGMLSetFile or SGMLSetString functions. The handle is then used for all subsequent calls to SGML functions and certain related functions.

If the source is an Edit or Mapped Text Object, do not close those handles prior to closing the SGML Object handle. This can potentially lead to a unrecoverable error or crash. The same is true if an edit window is closed when using a window handle as the source.

If an edit window is specified as hSource, an internal Edit Object will automatically be created and any changes to the source file, such as with SGMLWriteTag. will be tracked with undo information.

If source data is not specified it can be added in a subsequent call to SGMLSetFile, SGMLSetString or SGMLSetHandle

When specifying the parameter data string, it is tested for returns and open tag character. Either will cause the data to be treated as a source string rather than a filename or URI.

When a Mapped Text, Edit Object or edit window is employed and the dtd parameter has not been specified, existing DTD data will automatically be read from that object. Therefore, if the file has a DTD specification of XHTML 1.0, the DTD will be picked up as XHTML 1.0. It is important to note that when reading XML, the case rules for element and attribute names are followed.

The object can also be used without source data for writing purposes. If the SGML Object is simply created without data, the default DTD is HTML 5.0.

Related Functions

Platform Support

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

Legato IDE, Legato Basic