How to create a custom parser

This chapter describes how to create a custom parser. With a parser class you can use the parse feature.

Requirements

You need a Java Development Kit (http://java.sun.com) and basic knowledge of the Java programming language (http://java.sun.com/tutorial/).

The program file

Create a public class in a file with the class name as filename. Example: class declaration starts with public class MyParser, filename is MyParser.java.

The class has a public no-argument constructor. In our example that would be declared public MyParser().

It has one public method for each entry. The method name format is parseEntryX, where X is the number of the entry. The argument is the source String to parse from (entered into the import dialog). It shall return the content of the entry. If the content of the entry shall not be changed at all, it may return null. Then the old content is preserved.
Neither the constructor nor any method must ever throw an Exception. The String argument passed to the method by this program will never be null.
Example:

public String parseEntry1(String source) {
    // return current date
     return new java.text.SimpleDateFormat("dd.MM.yyyy").
         format(new java.util.Date()));
}

Make your parser accessible for the program

Compile your parser source file.
Put the resulting class file to the directory where the executable jar file of html-form is.
In your project file add an entry parser=MyParser, where MyParser is the name of your class (without the file extension ".class").
(Re-)load your project file.