HyperWorks Desktop

Create Parsers

Create Parsers

Previous topic Next topic No expanding text in this topic  

Create Parsers

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

The parsers folder should contain a pkgIndex.tcl with the package name and the list of .tcl files used to extract the metadata from the content. It should also contain a Tcl Script, which parses the content to extract the metadata. 

create_parsers

A typical parser does the following:

Checks if the parsing is possible by verifying the file extension. Or, if the file is a ASCII solver deck, parses the related solver cards.
Parses the file and extracts the metadata.
Adds the extracted metadata to the content.

A typical parser is shown below.

typical_parser

Name

Description

Package name (1)

Should be the same in pkgIndex.tcl.

Procedure name (2)

Used to check if the file can be parsed. This procedure should be ::namespace::imp_canParse.

The core application expects a return from the procedure with this name. A return value of 0 means the file cannot be parsed. The file will be treated as a generic file and listed the same in the Organize browser. A return value of 1 means that the file can be parsed.

Procedure name (3)

Used to parse the metadata and pass the extracted metadata to core. The name of this procedure should be ::namespace::imp_parse. A return value of 0 should be set to indicate the successful parsing.

 

See Also:

API