I’m building my own JET Parser and one of the things I am trying to do as per the JET specifications is to allow changing of the start and end tags from the default <%
and %>
. Right now I have a parser handler modeled after javax.xml.parsers.SAXParser
and org.xml.sax.ext.DefaultHandler2
.
The handler can take handle a directive that will change the parser configuration.
So I am thinking of the following options:
- have a
setParser(Parser)
method that gets called by the handler and have that as part of the interface. The method is called by the Parser when starting the parse process. - have a
directive(..., Parser )
method that gets called by the handler and have that as part of the interface. This limits the parser updates to directives only. - store the startTag and endTag in the handler and have the get methods.
- have a new configuration class that gets passed around using the set or directive method.
My current thinking is to have a directive(..., ParserConfiguration )
method that gets called by the handler and have that as part of the interface. This limits the parser updates to directives only and only let it deal with configuration.
Is the approach I have chosen is a good option for an API, or is there a better alternative that I didn’t think of yet?
0