The constructor of a lexical handler is provided the content handler as an argument.
<..saxReader += lexical handler..>
Node lexAttr = node.getAttributes()
.getNamedItem( "lexical-handler" );
if( lexAttr != null ){
String lexName = lexAttr.getNodeValue();
argTypes = new Class[3];
argTypes[0] = Class.forName( className[0].trim() );
argTypes[1] = PrintWriter.class;
argTypes[2] = boolean.class;
parmValues = new Object[3];
parmValues[0] = ch;
parmValues[1] = Xtpipes.logWriter;
parmValues[2] = (Object) Xtpipes.trace;
errMsg = "Class.forName( " + lexName.trim() + ") " ;
cls = Class.forName( lexName.trim() );
errMsg = "get-constructor " +
lexName.trim() +
"( " + className[0].trim() + " ) " ;
c = cls.getConstructor( argTypes );
errMsg = "get-object " +
lexName.trim() + "( ... ) " ;
Object xh = (Object) c.newInstance( parmValues );
errMsg = "set lexical handler " + lexName.trim() + " ";
saxReader.setProperty(
"http://xml.org/sax/properties/lexical-handler",
(org.xml.sax.ext.LexicalHandler) xh
);
}
-_-_-