Skip to main content

skip to main content

developerWorks  >  XML  >

Compiling the proxy

Using a Doclet to compile the proxy ContentHandler

developerWorks

Return to article.


Listing 4: Excerpts from writeHCTables()
writer.println("// Do NOT edit. This file was generated automatically.");
writer.println();
if(handler.getPackageName() != null)
{
   writer.print("package ");
   writer.print(handler.getPackageName());
   writer.println(';');
   writer.println();
}
writer.println("import java.util.Map;");
writer.println("import java.util.HashMap;");
writer.println("import org.ananas.hc.QName;");
writer.println("import org.ananas.hc.HCTables;");
writer.println("import org.xml.sax.Attributes;");
writer.println("import org.ananas.hc.HCHandler;");
writer.println("import org.xml.sax.SAXException;");
writer.println("import org.ananas.hc.HCException;");
writer.println();
writer.println("/**");
writer.println(" * HC unlocks the fun in SAX parsing.<br>");
writer.println(" * A project developed for the 'Working XML' column at developerWorks.");
writer.println(" * @see <a href='http://www.ibm.com/developerWorks'>developerWorks: a worldwide resource for developers</a>");
writer.println(" * @see <a href='http://www.ananas.org'>HC and other projects at ananas.org</a>");
writer.println(" * @see <a href='http://www.marchal.com'>XML books, articles by Benoît Marchal</a>");
writer.println(" */");
writer.println();
writer.print("public final class ");
writer.print(handler.getClassName());
writer.println(HCTables.CLASS_SUFFIX);
writer.println("   implements HCTables");
// ...and much more!
// complete code available online

Return to article.