To process any data in an OmniMark program, you must create an input scope with that data attached and then either scan or parse that data. You can create a current input scope using the statement using input as and naming a source:
process using input as file "daffy.txt" submit #current-input |
The built-in variable #current-input stands for the source in the current input scope. Thus submit #current-input initiates scanning of the current input scope. You can shortcut the process by naming the source directly in the submit statement.
process submit file "daffy.txt" |
In the preceding example, the submit statement both creates the current input scope and initiates scanning. The #current-input built-in variable is useful, however, when you want to continue scanning the current input scope in another scanning action. In the following example, a do scan statement in the find rule picks up the scanning of the current input scope at the current point, pulls out some data, and then allows the original scanning process to resume:
process submit file "sample.htm" find ul "<table>" do scan #current-input match any++ => table-body ul "</table>" output table-body done |
You also establish a current input scope when you use the do xml-parse statement. The scan parameter establishes the source:
do xml-parse document scan file "ducks.xml" output "%c" done |