/**
   * SAX XMLReader API.
   *
   * <p>Note that the JAXP 1.1ea2 parser crashes with an InternalError if it encounters a system
   * identifier that appears to be a relative URI that begins with a slash. For example, the
   * declaration:
   *
   * <pre>
   * &lt;!DOCTYPE book SYSTEM "/path/to/dtd/on/my/system/docbookx.dtd">
   * </pre>
   *
   * <p>would cause such an error. As a convenience, this method catches that error and prints an
   * explanation. (Unfortunately, it's not possible to identify the particular system identifier
   * that causes the problem.)
   *
   * <p>The underlying error is forwarded after printing the explanatory message. The message is
   * only every printed once and if <code>suppressExplanation</code> is set to <code>false</code>
   * before parsing, it will never be printed.
   */
  public void parse(InputSource input) throws IOException, SAXException {
    allowXMLCatalogPI = true;

    setupBaseURI(input.getSystemId());

    try {
      super.parse(input);
    } catch (InternalError ie) {
      explain(input.getSystemId());
      throw ie;
    }
  }
  /**
   * SAX XMLReader API.
   *
   * @see #parse(InputSource)
   */
  public void parse(String systemId) throws IOException, SAXException {
    allowXMLCatalogPI = true;

    setupBaseURI(systemId);

    try {
      super.parse(systemId);
    } catch (InternalError ie) {
      explain(systemId);
      throw ie;
    }
  }
 /**
  * Parse a document.
  *
  * @param systemId The system identifier as a fully-qualified URI.
  * @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
  * @exception java.io.IOException An IO exception from the parser, possibly from a byte stream or
  *     character stream supplied by the application.
  * @see org.xml.sax.XMLReader#parse(java.lang.String)
  */
 public void parse(String systemId) throws SAXException, IOException {
   parse(new InputSource(systemId));
 }
Beispiel #4
0
 // XMLFilterImpl methods
 // -------------------------------------------------------------------------
 public void parse(InputSource source) throws IOException, SAXException {
   installLexicalHandler();
   super.parse(source);
 }