Beispiel #1
0
 public void parse(InputSource paramInputSource, HandlerBase paramHandlerBase)
     throws SAXException, IOException {
   if (paramInputSource == null) {
     throw new IllegalArgumentException("InputSource cannot be null");
   }
   Parser localParser = getParser();
   if (paramHandlerBase != null) {
     localParser.setDocumentHandler(paramHandlerBase);
     localParser.setEntityResolver(paramHandlerBase);
     localParser.setErrorHandler(paramHandlerBase);
     localParser.setDTDHandler(paramHandlerBase);
   }
   localParser.parse(paramInputSource);
 }
Beispiel #2
0
  /**
   * Parse the content given {@link org.xml.sax.InputSource} as XML using the specified {@link
   * org.xml.sax.HandlerBase}. <i> Use of the DefaultHandler version of this method is recommended
   * as the HandlerBase class has been deprecated in SAX 2.0</i>
   *
   * @param is The InputSource containing the content to be parsed.
   * @param hb The SAX HandlerBase to use.
   * @throws IllegalArgumentException If the <code>InputSource</code> object is <code>null</code>.
   * @throws IOException If any IO errors occur.
   * @throws SAXException If any SAX errors occur during processing.
   * @see org.xml.sax.DocumentHandler
   */
  public void parse(InputSource is, HandlerBase hb) throws SAXException, IOException {
    if (is == null) {
      throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
      parser.setDocumentHandler(hb);
      parser.setEntityResolver(hb);
      parser.setErrorHandler(hb);
      parser.setDTDHandler(hb);
    }
    parser.parse(is);
  }
Beispiel #3
0
 public void setDTDHandler(DTDHandler handler) {
   _parser.setDTDHandler(handler);
 }