edu.ucsb.nceas.metacat

## Class DBEntityResolver

- java.lang.Object
- - edu.ucsb.nceas.metacat.DBEntityResolver

- All Implemented Interfaces:
    org.xml.sax.EntityResolver

      public class DBEntityResolver
      extends java.lang.Object
      implements org.xml.sax.EntityResolver

  A database aware Class implementing EntityResolver interface for the SAX parser to call when processing the XML stream and intercepting any external entities (including the external DTD subset and external parameter entities, if any) before including them.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DBEntityResolver(DBConnection conn)` Construct an instance of the DBEntityResolver class
    `DBEntityResolver(DBConnection conn, org.xml.sax.helpers.DefaultHandler handler, java.io.Reader dtd)` Construct an instance of the DBEntityResolver class

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.io.InputStream` | `checkURLConnection(java.lang.String systemId)` Check URL Connection for @systemId, and return an InputStream that can be used to read from the systemId URL.
    `org.xml.sax.InputSource` | `resolveEntity(java.lang.String publicId, java.lang.String systemId)` The Parser call this method before opening any external entity except the top-level document entity (including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element)

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DBEntityResolver

          public DBEntityResolver(DBConnection conn)

      Construct an instance of the DBEntityResolver class
      Parameters:
        `conn` - the JDBC connection to which information is written

    - #### DBEntityResolver

          public DBEntityResolver(DBConnection conn,
                                  org.xml.sax.helpers.DefaultHandler handler,
                                  java.io.Reader dtd)

      Construct an instance of the DBEntityResolver class
      Parameters:
        `conn` - the JDBC connection to which information is written
        `handler` - the SAX handler to determine parsing context
        `dtd` - Reader of new dtd to be uploaded on server's file system

  - ### Method Detail

    - #### resolveEntity

          public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                                       java.lang.String systemId)
                                                throws org.xml.sax.SAXException

      The Parser call this method before opening any external entity except the top-level document entity (including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element)
      Specified by:
        `resolveEntity` in interface `org.xml.sax.EntityResolver`
      Throws:
        `org.xml.sax.SAXException`

    - #### checkURLConnection

          public static java.io.InputStream checkURLConnection(java.lang.String systemId)
                                                        throws org.xml.sax.SAXException

      Check URL Connection for @systemId, and return an InputStream that can be used to read from the systemId URL. The parser ends up using this via the InputSource to read the DTD.
      Parameters:
        `systemId` - a URI (in practice URL) to be checked and opened
      Throws:
        `org.xml.sax.SAXException`

Copyright © 2023 Regents of the University of California. All Rights Reserved.