1   /*
2    * Copyright (C) The DNA Group. All rights reserved.
3    *
4    * This software is published under the terms of the DNA
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.dna.impl;
9   
10  import java.lang.reflect.Method;
11  import org.xml.sax.Attributes;
12  import org.xml.sax.ContentHandler;
13  
14  class SAXMethods
15  {
16      static final Method START_DOCUMENT;
17      static final Method END_DOCUMENT;
18      static final Method START_ELEMENT;
19      static final Method END_ELEMENT;
20      static final Method CHARACTERS;
21  
22      static
23      {
24          try
25          {
26              START_DOCUMENT =
27                  ContentHandler.class.getMethod( "startDocument", new Class[ 0 ] );
28              END_DOCUMENT =
29                  ContentHandler.class.getMethod( "endDocument", new Class[ 0 ] );
30              START_ELEMENT =
31                  ContentHandler.class.getMethod( "startElement",
32                                                  new Class[]{String.class, String.class, String.class, Attributes.class} );
33              END_ELEMENT =
34                  ContentHandler.class.getMethod( "endElement",
35                                                  new Class[]{String.class, String.class, String.class} );
36              CHARACTERS =
37                  ContentHandler.class.getMethod( "characters",
38                                                  new Class[]{char[].class, Integer.TYPE, Integer.TYPE} );
39          }
40          catch( Exception e )
41          {
42              e.printStackTrace();
43              throw new IllegalStateException( "Problem getting sax methods: " + e );
44          }
45      }
46  }