Project

General

Profile

« Previous | Next » 

Revision 92

Added by bojilova over 24 years ago

made changes about document doctypes

View differences:

src/edu/ucsb/nceas/metacat/DBSAXHandler.java
33 33
{
34 34

  
35 35
   static int elementNo = 0;
36
   private String docname;
36
   static String docname;
37 37
   private String doctype;
38 38
   private String systemid;
39 39
   private boolean 	debug 	= false;
......
76 76
    // here is a bug: dtd.getPublicId() and dtd.getSustemId() return null.
77 77
    docname = dtd.getName();
78 78
    doctype = dtd.getPublicId();
79
    //if (doctype == null) {
80
      //doctype = docname;
81
    //}
82 79
    systemid = dtd.getSystemId();
83 80
    System.out.println("DOCNAME: " + docname);
84 81
    System.out.println("DOCTYPE: " + doctype);
......
92 89
   public void endDoctype() throws SAXException
93 90
   {
94 91
    System.out.println("end of DOCTYPE");
95
    if (doctype == null)
92
    if (doctype == null) {
96 93
        doctype = DBEntityResolver.doctype;
94
        //if (doctype == null) 
95
        //    doctype = docname;
96
    }
97 97
   }
98 98

  
99 99
   /** SAX Handler that is called at the start of each XML element */
......
117 117
      expName = name.getExpandedName();
118 118
      
119 119
      elementNo++;
120
      if ((elementNo == 1) && (doctype == null))
121
        throw new SAXException("No DOCTYPE declaration or PUBLIC ID provided");
120
      if (docname == null)
121
        throw new SAXException("No DOCTYPE declaration provided");
122 122
      // Get a reference to the parent element for the id
123 123
      long parent_id;
124 124
      int nodeIndex;
......
190 190
   {
191 191
    if (elementNo > 0) {
192 192
      DBSAXElement currentElement = (DBSAXElement)elementStack.peek();
193
      currentElement.writeCommentToDB(data);
193
      int nodeIndex = currentElement.incChildNum();
194
      currentElement.writeCommentToDB(data, nodeIndex);
194 195
    }
195 196
   }
197
   public void processingInstruction(String target, String data) throws SAXException
198
   {
199
    if (elementNo == 0)
200
        System.out.println("target:" + target + "\ndata:" + data);
201
    else if (elementNo > 0)
202
        System.out.println("targetHere:" + target + "\ndata:" + data);
203
   }
196 204

  
197 205
   /** SAX Handler that is called at the end of each XML element */
198 206
   public void endElement(NSName name) throws SAXException 
src/edu/ucsb/nceas/metacat/DBEntityResolver.java
1 1
/**
2
 *        Name: DBSAXHandler.java
2
 *        Name: DBEntityResolver.java
3 3
 *     Purpose: A Class that implements org.xml.sax.EntityResolver interface
4 4
 *              for resolving external entities
5 5
 *   Copyright: 2000 Regents of the University of California and the
......
28 28
{
29 29

  
30 30
   static String doctype = null;
31
   static Connection conn = null;
31
   private Connection conn = null;
32 32
   private int pIdCounter = 0;
33 33
   private long currentElementNo;
34 34

  
......
51 51
   {
52 52
     String dbSystemId;
53 53
     
54
     currentElementNo = DBSAXHandler.elementNo;
55
     
54 56
     if (publicId != null) {
55 57
        pIdCounter += 1;
56
        currentElementNo = DBSAXHandler.elementNo;
57 58
        System.out.println("from DBEntityResolver: current element is " + DBSAXHandler.elementNo);
58 59
        System.out.println("from DBEntityResolver: " + pIdCounter + " " + publicId);
59 60
        // look at the db XML Catalog and get dbSystemId by this publicId
......
63 64
            if (dbSystemId == "")
64 65
                // register publicId in db and use the provided systemId
65 66
                if (systemId != "") {
66
                    System.out.println("from DBEntityResolver: " + systemId);
67 67
                    new URL(systemId);
68
                    registerDTDPublicID (conn, publicId, systemId);
68
                    registerDTDPublicID (conn, doctype, publicId, systemId);
69 69
                    return null;
70 70
                }
71 71
            new URL(dbSystemId);
72
            System.out.println("from DBEntityResolver: db System ID: " + dbSystemId);
73 72
            return new InputSource(dbSystemId);
74 73
        } 
75
        else {
74
        /*else {
76 75
            // look at the db XML Catalog and get dbSystemId by this publicId for a given doctype
77 76
            dbSystemId = getEntitySystemID (conn, doctype, publicId);
78 77
            if (dbSystemId == "")
79 78
                // register publicId in db for a given doctype and use the provided systemId
80 79
                if (systemId != "") {
81
                    System.out.println("from DBEntityResolver: " + systemId);
82 80
                    new URL(systemId);
83 81
                    registerEntityPublicID (conn, doctype, publicId, systemId);
84 82
                    return null;
85 83
                }
86 84
            new URL(dbSystemId);
87
            System.out.println("from DBEntityResolver: db System ID: " + dbSystemId);
88 85
            return new InputSource(dbSystemId);
89
        }  
86
        }*/  
90 87
     }
88
     // publicId is null => doctype is null => doctype = docname
91 89
     if ( systemId != null) {
92
        System.out.println("from DBEntityResolver: " + systemId);
90
        if (currentElementNo == 0) {
91
            doctype = DBSAXHandler.docname;
92
            registerDTDPublicID (conn, doctype, "", systemId);
93
        }
93 94
        new URL(systemId);
94 95
     }
95 96
    
......
105 106
        Statement stmt;
106 107
        try {
107 108
          stmt = conn.createStatement();
108
          stmt.execute("SELECT system_id FROM xml_catalog_entities a, xml_catalog b " + 
109
                       "WHERE a.entity_type = 'DTD' AND a.source_doctype = b.doctype AND b.doctype = '" + publicId + "'");
109
          stmt.execute("SELECT system_id FROM xml_catalog " + 
110
                       "WHERE entity_type = 'DTD' AND source_doctype = '" + publicId + "'");
110 111
          try {
111 112
            ResultSet rs = stmt.getResultSet();
112 113
            try {
......
127 128
          stmt.close();
128 129
        } catch (SQLException e) {
129 130
          System.out.println("DBEntityResolver.getDTDSystemID() - Error getting id: " + e.getMessage());
131
          System.exit(1);
130 132
        }
131 133

  
132 134
        // return the selected System ID
......
134 136
   }
135 137

  
136 138
   /** Register Public ID in db XML Catalog */
137
   private void registerDTDPublicID (Connection conn, String publicId, String systemId)
139
   private void registerDTDPublicID (Connection conn, String doctype, String publicId, String systemId)
138 140
   {
139 141
        try {
140 142
          conn.setAutoCommit(false);
141 143
          PreparedStatement pstmt;
142 144
          pstmt = conn.prepareStatement(
143
                "INSERT INTO xml_catalog (doctype) VALUES (?)");
145
                "INSERT INTO xml_catalog (entity_id, entity_type, source_doctype, public_id, system_id) " +
146
                "VALUES (null, 'DTD', ?, ?, ?)");
144 147
          // Bind the values to the query
145
          pstmt.setString(1, publicId);
148
          pstmt.setString(1, doctype);
149
          pstmt.setString(2, publicId);
150
          pstmt.setString(3, systemId);
146 151
          // Do the insertion
147 152
          pstmt.execute();
148 153
          pstmt.close();
149
          pstmt = conn.prepareStatement(
150
                "INSERT INTO xml_catalog_entities (entity_id, entity_type, source_doctype, system_id) " +
151
                "VALUES (null, 'DTD', ?, ?)");
152
          // Bind the values to the query
153
          pstmt.setString(1, publicId);
154
          pstmt.setString(2, systemId);
155
          // Do the insertion
156
          pstmt.execute();
157
          pstmt.close();
158 154
          conn.commit();
159 155
          conn.setAutoCommit(true);
160 156
        } catch (SQLException e) {
......
170 166
        Statement stmt;
171 167
        try {
172 168
          stmt = conn.createStatement();
173
          stmt.execute("SELECT system_id FROM xml_catalog_entities " + 
169
          stmt.execute("SELECT system_id FROM xml_catalog " + 
174 170
                       "WHERE entity_type = 'ENTITY' AND source_doctype = '" + doctype + "' AND public_id = '" + publicId + "'");
175 171
          try {
176 172
            ResultSet rs = stmt.getResultSet();
......
205 201
          conn.setAutoCommit(false);
206 202
          PreparedStatement pstmt;
207 203
          pstmt = conn.prepareStatement(
208
                "INSERT INTO xml_catalog_entities (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
204
                "INSERT INTO xml_catalog (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
209 205
                "VALUES (null, null, 'ENTITY', ?, ?, ?)");
210 206
          // Bind the values to the query
211 207
          pstmt.setString(1, doctype);
src/edu/ucsb/nceas/metacat/DBSAXNode.java
74 74
    }
75 75

  
76 76
    /** creates SQL code and inserts comment into DB connection */
77
    void writeCommentToDB(String data) {
77
    void writeCommentToDB(String data, int nodeIndex) {
78 78
        try {
79 79
          PreparedStatement pstmt;
80 80
          pstmt = conn.prepareStatement(
81 81
                "INSERT INTO xml_nodes (nodeid, nodetype, " +
82
                "nodename, parentnodeid, nodedata) VALUES (null, ?, null, ?, ?)");
82
                "nodename, parentnodeid, nodedata, nodeindex) VALUES (null, ?, null, ?, ?, ?)");
83 83

  
84 84
          // Bind the values to the query
85 85
          pstmt.setString(1, "COMMENT");
86 86
          pstmt.setLong(2, getElementID());
87 87
          pstmt.setString(3, data);
88
          pstmt.setInt(4, nodeIndex);
88 89
          // Do the insertion
89 90
          pstmt.execute();
90 91
          pstmt.close();
src/edu/ucsb/nceas/metacat/DBSAXElement.java
74 74
    }
75 75

  
76 76
    /** creates SQL code and inserts comment into DB connection */
77
    void writeCommentToDB(String data) {
77
    void writeCommentToDB(String data, int nodeIndex) {
78 78
        try {
79 79
          PreparedStatement pstmt;
80 80
          pstmt = conn.prepareStatement(
81 81
                "INSERT INTO xml_nodes (nodeid, nodetype, " +
82
                "nodename, parentnodeid, nodedata) VALUES (null, ?, null, ?, ?)");
82
                "nodename, parentnodeid, nodedata, nodeindex) VALUES (null, ?, null, ?, ?, ?)");
83 83

  
84 84
          // Bind the values to the query
85 85
          pstmt.setString(1, "COMMENT");
86 86
          pstmt.setLong(2, getElementID());
87 87
          pstmt.setString(3, data);
88
          pstmt.setInt(4, nodeIndex);
88 89
          // Do the insertion
89 90
          pstmt.execute();
90 91
          pstmt.close();
src/edu/ucsb/nceas/metacat/DBDTDHandler.java
41 41
            throws SAXException
42 42
   {
43 43
    System.out.println("from DBDTDHandler.notationDecl");
44
    System.out.println(name);
45
    System.out.println(publicId);
46
    System.out.println(systemId);
44
    System.out.print(name);
45
    System.out.print(publicId);
46
    System.out.print(systemId);
47 47
    return;
48 48
   }
49 49
   
50
   /** All are reported after startDocument and before startElement event*/
50
   /** All are reported after startDocument and before first startElement event*/
51 51
   public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
52 52
            throws SAXException
53 53
   {
......
56 56
    System.out.print(publicId);
57 57
    System.out.print(systemId);
58 58
    System.out.println(notationName);
59
    Connection conn = DBEntityResolver.conn;
60 59
    String doctype = DBEntityResolver.doctype;
61
    if ( getEntitySystemID(conn, doctype, publicId) == "" ) 
62
        registerEntityPublicID(conn, doctype, publicId, systemId);
60
    //if ( getEntitySystemID(conn, doctype, publicId) == "" ) 
61
    //    registerEntityPublicID(conn, doctype, publicId, systemId);
63 62
    return;
64 63
   }
65 64

  
......
71 70
        Statement stmt;
72 71
        try {
73 72
          stmt = conn.createStatement();
74
          stmt.execute("SELECT system_id FROM xml_catalog_entities " + 
73
          stmt.execute("SELECT system_id FROM xml_catalog " + 
75 74
                       "WHERE entity_type = 'ENTITY' AND source_doctype = '" + doctype + "' AND public_id = '" + publicId + "'");
76 75
          try {
77 76
            ResultSet rs = stmt.getResultSet();
......
81 80
                try {
82 81
                  system_id = rs.getString(1);
83 82
                } catch (SQLException e) {
84
                  System.out.println("DBEntityResolver.getEntitySystemID() - Error with getString: " + e.getMessage());
83
                  System.out.println("DBDTDHandler.getEntitySystemID() - Error with getString: " + e.getMessage());
85 84
                }
86 85
              }
87 86
            } catch (SQLException e) {
88
              System.out.println("DBEntityResolver.getEntitySystemID() - Error with next: " + e.getMessage());
87
              System.out.println("DBDTDHandler.getEntitySystemID() - Error with next: " + e.getMessage());
89 88
            }
90 89
          } catch (SQLException e) {
91
            System.out.println("DBEntityResolver.getEntitySystemID() - Error with getrset: " + e.getMessage());
90
            System.out.println("DBDTDHandler.getEntitySystemID() - Error with getrset: " + e.getMessage());
92 91
          }
93 92
          stmt.close();
94 93
        } catch (SQLException e) {
95
          System.out.println("DBEntityResolver.getEntitySystemID() - Error getting id: " + e.getMessage());
94
          System.out.println("DBDTDHandler.getEntitySystemID() - Error getting id: " + e.getMessage());
96 95
        }
97 96

  
98 97
        // return the selected System ID
......
106 105
          conn.setAutoCommit(false);
107 106
          PreparedStatement pstmt;
108 107
          pstmt = conn.prepareStatement(
109
                "INSERT INTO xml_catalog_entities (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
108
                "INSERT INTO xml_catalog (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
110 109
                "VALUES (null, null, 'ENTITY', ?, ?, ?)");
111 110
          // Bind the values to the query
112 111
          pstmt.setString(1, doctype);
DBSAXElement.java
74 74
    }
75 75

  
76 76
    /** creates SQL code and inserts comment into DB connection */
77
    void writeCommentToDB(String data) {
77
    void writeCommentToDB(String data, int nodeIndex) {
78 78
        try {
79 79
          PreparedStatement pstmt;
80 80
          pstmt = conn.prepareStatement(
81 81
                "INSERT INTO xml_nodes (nodeid, nodetype, " +
82
                "nodename, parentnodeid, nodedata) VALUES (null, ?, null, ?, ?)");
82
                "nodename, parentnodeid, nodedata, nodeindex) VALUES (null, ?, null, ?, ?, ?)");
83 83

  
84 84
          // Bind the values to the query
85 85
          pstmt.setString(1, "COMMENT");
86 86
          pstmt.setLong(2, getElementID());
87 87
          pstmt.setString(3, data);
88
          pstmt.setInt(4, nodeIndex);
88 89
          // Do the insertion
89 90
          pstmt.execute();
90 91
          pstmt.close();
DBSAXHandler.java
33 33
{
34 34

  
35 35
   static int elementNo = 0;
36
   private String docname;
36
   static String docname;
37 37
   private String doctype;
38 38
   private String systemid;
39 39
   private boolean 	debug 	= false;
......
76 76
    // here is a bug: dtd.getPublicId() and dtd.getSustemId() return null.
77 77
    docname = dtd.getName();
78 78
    doctype = dtd.getPublicId();
79
    //if (doctype == null) {
80
      //doctype = docname;
81
    //}
82 79
    systemid = dtd.getSystemId();
83 80
    System.out.println("DOCNAME: " + docname);
84 81
    System.out.println("DOCTYPE: " + doctype);
......
92 89
   public void endDoctype() throws SAXException
93 90
   {
94 91
    System.out.println("end of DOCTYPE");
95
    if (doctype == null)
92
    if (doctype == null) {
96 93
        doctype = DBEntityResolver.doctype;
94
        //if (doctype == null) 
95
        //    doctype = docname;
96
    }
97 97
   }
98 98

  
99 99
   /** SAX Handler that is called at the start of each XML element */
......
117 117
      expName = name.getExpandedName();
118 118
      
119 119
      elementNo++;
120
      if ((elementNo == 1) && (doctype == null))
121
        throw new SAXException("No DOCTYPE declaration or PUBLIC ID provided");
120
      if (docname == null)
121
        throw new SAXException("No DOCTYPE declaration provided");
122 122
      // Get a reference to the parent element for the id
123 123
      long parent_id;
124 124
      int nodeIndex;
......
190 190
   {
191 191
    if (elementNo > 0) {
192 192
      DBSAXElement currentElement = (DBSAXElement)elementStack.peek();
193
      currentElement.writeCommentToDB(data);
193
      int nodeIndex = currentElement.incChildNum();
194
      currentElement.writeCommentToDB(data, nodeIndex);
194 195
    }
195 196
   }
197
   public void processingInstruction(String target, String data) throws SAXException
198
   {
199
    if (elementNo == 0)
200
        System.out.println("target:" + target + "\ndata:" + data);
201
    else if (elementNo > 0)
202
        System.out.println("targetHere:" + target + "\ndata:" + data);
203
   }
196 204

  
197 205
   /** SAX Handler that is called at the end of each XML element */
198 206
   public void endElement(NSName name) throws SAXException 
DBEntityResolver.java
1 1
/**
2
 *        Name: DBSAXHandler.java
2
 *        Name: DBEntityResolver.java
3 3
 *     Purpose: A Class that implements org.xml.sax.EntityResolver interface
4 4
 *              for resolving external entities
5 5
 *   Copyright: 2000 Regents of the University of California and the
......
28 28
{
29 29

  
30 30
   static String doctype = null;
31
   static Connection conn = null;
31
   private Connection conn = null;
32 32
   private int pIdCounter = 0;
33 33
   private long currentElementNo;
34 34

  
......
51 51
   {
52 52
     String dbSystemId;
53 53
     
54
     currentElementNo = DBSAXHandler.elementNo;
55
     
54 56
     if (publicId != null) {
55 57
        pIdCounter += 1;
56
        currentElementNo = DBSAXHandler.elementNo;
57 58
        System.out.println("from DBEntityResolver: current element is " + DBSAXHandler.elementNo);
58 59
        System.out.println("from DBEntityResolver: " + pIdCounter + " " + publicId);
59 60
        // look at the db XML Catalog and get dbSystemId by this publicId
......
63 64
            if (dbSystemId == "")
64 65
                // register publicId in db and use the provided systemId
65 66
                if (systemId != "") {
66
                    System.out.println("from DBEntityResolver: " + systemId);
67 67
                    new URL(systemId);
68
                    registerDTDPublicID (conn, publicId, systemId);
68
                    registerDTDPublicID (conn, doctype, publicId, systemId);
69 69
                    return null;
70 70
                }
71 71
            new URL(dbSystemId);
72
            System.out.println("from DBEntityResolver: db System ID: " + dbSystemId);
73 72
            return new InputSource(dbSystemId);
74 73
        } 
75
        else {
74
        /*else {
76 75
            // look at the db XML Catalog and get dbSystemId by this publicId for a given doctype
77 76
            dbSystemId = getEntitySystemID (conn, doctype, publicId);
78 77
            if (dbSystemId == "")
79 78
                // register publicId in db for a given doctype and use the provided systemId
80 79
                if (systemId != "") {
81
                    System.out.println("from DBEntityResolver: " + systemId);
82 80
                    new URL(systemId);
83 81
                    registerEntityPublicID (conn, doctype, publicId, systemId);
84 82
                    return null;
85 83
                }
86 84
            new URL(dbSystemId);
87
            System.out.println("from DBEntityResolver: db System ID: " + dbSystemId);
88 85
            return new InputSource(dbSystemId);
89
        }  
86
        }*/  
90 87
     }
88
     // publicId is null => doctype is null => doctype = docname
91 89
     if ( systemId != null) {
92
        System.out.println("from DBEntityResolver: " + systemId);
90
        if (currentElementNo == 0) {
91
            doctype = DBSAXHandler.docname;
92
            registerDTDPublicID (conn, doctype, "", systemId);
93
        }
93 94
        new URL(systemId);
94 95
     }
95 96
    
......
105 106
        Statement stmt;
106 107
        try {
107 108
          stmt = conn.createStatement();
108
          stmt.execute("SELECT system_id FROM xml_catalog_entities a, xml_catalog b " + 
109
                       "WHERE a.entity_type = 'DTD' AND a.source_doctype = b.doctype AND b.doctype = '" + publicId + "'");
109
          stmt.execute("SELECT system_id FROM xml_catalog " + 
110
                       "WHERE entity_type = 'DTD' AND source_doctype = '" + publicId + "'");
110 111
          try {
111 112
            ResultSet rs = stmt.getResultSet();
112 113
            try {
......
127 128
          stmt.close();
128 129
        } catch (SQLException e) {
129 130
          System.out.println("DBEntityResolver.getDTDSystemID() - Error getting id: " + e.getMessage());
131
          System.exit(1);
130 132
        }
131 133

  
132 134
        // return the selected System ID
......
134 136
   }
135 137

  
136 138
   /** Register Public ID in db XML Catalog */
137
   private void registerDTDPublicID (Connection conn, String publicId, String systemId)
139
   private void registerDTDPublicID (Connection conn, String doctype, String publicId, String systemId)
138 140
   {
139 141
        try {
140 142
          conn.setAutoCommit(false);
141 143
          PreparedStatement pstmt;
142 144
          pstmt = conn.prepareStatement(
143
                "INSERT INTO xml_catalog (doctype) VALUES (?)");
145
                "INSERT INTO xml_catalog (entity_id, entity_type, source_doctype, public_id, system_id) " +
146
                "VALUES (null, 'DTD', ?, ?, ?)");
144 147
          // Bind the values to the query
145
          pstmt.setString(1, publicId);
148
          pstmt.setString(1, doctype);
149
          pstmt.setString(2, publicId);
150
          pstmt.setString(3, systemId);
146 151
          // Do the insertion
147 152
          pstmt.execute();
148 153
          pstmt.close();
149
          pstmt = conn.prepareStatement(
150
                "INSERT INTO xml_catalog_entities (entity_id, entity_type, source_doctype, system_id) " +
151
                "VALUES (null, 'DTD', ?, ?)");
152
          // Bind the values to the query
153
          pstmt.setString(1, publicId);
154
          pstmt.setString(2, systemId);
155
          // Do the insertion
156
          pstmt.execute();
157
          pstmt.close();
158 154
          conn.commit();
159 155
          conn.setAutoCommit(true);
160 156
        } catch (SQLException e) {
......
170 166
        Statement stmt;
171 167
        try {
172 168
          stmt = conn.createStatement();
173
          stmt.execute("SELECT system_id FROM xml_catalog_entities " + 
169
          stmt.execute("SELECT system_id FROM xml_catalog " + 
174 170
                       "WHERE entity_type = 'ENTITY' AND source_doctype = '" + doctype + "' AND public_id = '" + publicId + "'");
175 171
          try {
176 172
            ResultSet rs = stmt.getResultSet();
......
205 201
          conn.setAutoCommit(false);
206 202
          PreparedStatement pstmt;
207 203
          pstmt = conn.prepareStatement(
208
                "INSERT INTO xml_catalog_entities (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
204
                "INSERT INTO xml_catalog (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
209 205
                "VALUES (null, null, 'ENTITY', ?, ?, ?)");
210 206
          // Bind the values to the query
211 207
          pstmt.setString(1, doctype);
DBDTDHandler.java
41 41
            throws SAXException
42 42
   {
43 43
    System.out.println("from DBDTDHandler.notationDecl");
44
    System.out.println(name);
45
    System.out.println(publicId);
46
    System.out.println(systemId);
44
    System.out.print(name);
45
    System.out.print(publicId);
46
    System.out.print(systemId);
47 47
    return;
48 48
   }
49 49
   
50
   /** All are reported after startDocument and before startElement event*/
50
   /** All are reported after startDocument and before first startElement event*/
51 51
   public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
52 52
            throws SAXException
53 53
   {
......
56 56
    System.out.print(publicId);
57 57
    System.out.print(systemId);
58 58
    System.out.println(notationName);
59
    Connection conn = DBEntityResolver.conn;
60 59
    String doctype = DBEntityResolver.doctype;
61
    if ( getEntitySystemID(conn, doctype, publicId) == "" ) 
62
        registerEntityPublicID(conn, doctype, publicId, systemId);
60
    //if ( getEntitySystemID(conn, doctype, publicId) == "" ) 
61
    //    registerEntityPublicID(conn, doctype, publicId, systemId);
63 62
    return;
64 63
   }
65 64

  
......
71 70
        Statement stmt;
72 71
        try {
73 72
          stmt = conn.createStatement();
74
          stmt.execute("SELECT system_id FROM xml_catalog_entities " + 
73
          stmt.execute("SELECT system_id FROM xml_catalog " + 
75 74
                       "WHERE entity_type = 'ENTITY' AND source_doctype = '" + doctype + "' AND public_id = '" + publicId + "'");
76 75
          try {
77 76
            ResultSet rs = stmt.getResultSet();
......
81 80
                try {
82 81
                  system_id = rs.getString(1);
83 82
                } catch (SQLException e) {
84
                  System.out.println("DBEntityResolver.getEntitySystemID() - Error with getString: " + e.getMessage());
83
                  System.out.println("DBDTDHandler.getEntitySystemID() - Error with getString: " + e.getMessage());
85 84
                }
86 85
              }
87 86
            } catch (SQLException e) {
88
              System.out.println("DBEntityResolver.getEntitySystemID() - Error with next: " + e.getMessage());
87
              System.out.println("DBDTDHandler.getEntitySystemID() - Error with next: " + e.getMessage());
89 88
            }
90 89
          } catch (SQLException e) {
91
            System.out.println("DBEntityResolver.getEntitySystemID() - Error with getrset: " + e.getMessage());
90
            System.out.println("DBDTDHandler.getEntitySystemID() - Error with getrset: " + e.getMessage());
92 91
          }
93 92
          stmt.close();
94 93
        } catch (SQLException e) {
95
          System.out.println("DBEntityResolver.getEntitySystemID() - Error getting id: " + e.getMessage());
94
          System.out.println("DBDTDHandler.getEntitySystemID() - Error getting id: " + e.getMessage());
96 95
        }
97 96

  
98 97
        // return the selected System ID
......
106 105
          conn.setAutoCommit(false);
107 106
          PreparedStatement pstmt;
108 107
          pstmt = conn.prepareStatement(
109
                "INSERT INTO xml_catalog_entities (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
108
                "INSERT INTO xml_catalog (entity_id, entity_name, entity_type, source_doctype, public_id, system_id) " +
110 109
                "VALUES (null, null, 'ENTITY', ?, ?, ?)");
111 110
          // Bind the values to the query
112 111
          pstmt.setString(1, doctype);

Also available in: Unified diff