353 * a DTD with that name doesn't exist, one is created
354 * and returned. Any uppercase characters in the name
355 * are converted to lowercase.
356 *
357 * @param name the name of the DTD
358 * @return the DTD which corresponds to <code>name</code>
359 * @throws IOException if an I/O error occurs
360 */
361 public static DTD getDTD(String name) throws IOException {
362 name = name.toLowerCase();
363 DTD dtd = getDtdHash().get(name);
364 if (dtd == null)
365 dtd = new DTD(name);
366
367 return dtd;
368 }
369
370 private static Hashtable<String, DTD> getDtdHash() {
371 AppContext appContext = AppContext.getAppContext();
372
373 Hashtable<String, DTD> result = (Hashtable<String, DTD>) appContext.get(DTD_HASH_KEY);
374
375 if (result == null) {
376 result = new Hashtable<String, DTD>();
377
378 appContext.put(DTD_HASH_KEY, result);
379 }
380
381 return result;
382 }
383
384 /**
385 * Recreates a DTD from an archived format.
386 * @param in the <code>DataInputStream</code> to read from
387 * @throws IOException if an I/O error occurs
388 */
389 public void read(DataInputStream in) throws IOException {
390 if (in.readInt() != FILE_VERSION) {
391 }
392
|
353 * a DTD with that name doesn't exist, one is created
354 * and returned. Any uppercase characters in the name
355 * are converted to lowercase.
356 *
357 * @param name the name of the DTD
358 * @return the DTD which corresponds to <code>name</code>
359 * @throws IOException if an I/O error occurs
360 */
361 public static DTD getDTD(String name) throws IOException {
362 name = name.toLowerCase();
363 DTD dtd = getDtdHash().get(name);
364 if (dtd == null)
365 dtd = new DTD(name);
366
367 return dtd;
368 }
369
370 private static Hashtable<String, DTD> getDtdHash() {
371 AppContext appContext = AppContext.getAppContext();
372
373 @SuppressWarnings("unchecked")
374 Hashtable<String, DTD> result = (Hashtable<String, DTD>) appContext.get(DTD_HASH_KEY);
375
376 if (result == null) {
377 result = new Hashtable<String, DTD>();
378
379 appContext.put(DTD_HASH_KEY, result);
380 }
381
382 return result;
383 }
384
385 /**
386 * Recreates a DTD from an archived format.
387 * @param in the <code>DataInputStream</code> to read from
388 * @throws IOException if an I/O error occurs
389 */
390 public void read(DataInputStream in) throws IOException {
391 if (in.readInt() != FILE_VERSION) {
392 }
393
|