Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/thermidor/xml/DTD.java


1   package com.thermidor.xml;
2   /*@LEGAL@*/
3   /**
4      The DTD class is a utility data struct that is used to maintain a 
5      relationship between a DTDs public identifier and a java resource 
6      identifier. To facilitate the loading and caching of DTD data from the
7      classpath.
8      @author Edward Turnock
9      @author Richard Rutter
10   */
11  public class DTD {
12      /**
13         The publicId attribute maintains the unique public identifier for the 
14         DTD in question.
15       */
16      private String publicId;
17      /**
18         The system id of the DTD class generally contains a java resource
19         identifier, allowing the DTD to be loaded from the classpath of the
20         distribution.
21       */
22      private String systemId;
23      
24      /** The DocType Name */
25      private String docType;
26      /**
27         Construct a default instance of the DTD class.
28       */
29      public DTD() {}
30  
31      /**
32         Construct a new instance of the DTD class with the specified PUBLIC id 
33         and resource identifier.
34         @param publicId the PUBLIC identifier of a DTD
35         @param systemId the java classloader resource identifier that will be 
36         used to load the DTD that corresponds to the public identifier.
37       */
38      public DTD( String publicId, String systemId) {
39          this.publicId = publicId;
40          this.systemId = systemId;
41      }
42  
43      /**
44         Construct a new instance of the DTD class with the specified PUBLIC id 
45         and resource identifier.
46         @param publicId the PUBLIC identifier of a DTD
47         @param systemId the java classloader resource identifier that will be 
48         used to load the DTD that corresponds to the public identifier.
49         @param docType the docType name
50       */
51      public DTD( String publicId, String systemId, String docType ) {
52          this.publicId = publicId;
53          this.systemId = systemId;
54          this.docType  = docType;
55      }
56  
57      /**
58         Retreive the public identtifier part of the DTD
59         @return the PUBLIC identifier
60       */
61      public String getPublicId() {
62          return publicId;
63      }
64  
65      /**
66         Retrieve the java resource identifier that will  be used to load the
67         DTD from the classpath.
68         @return the resource identifier.
69       */
70      public String getSystemId() {
71          return systemId;
72      }
73  
74      /**
75       * Returns a String representation of the dtd.
76       * @return the doctype string of an XML docuemtn that corresponds to this
77       * DTD
78       */
79      public String toString() {
80          StringBuffer sb = new StringBuffer();
81          sb.append( "<!DOCTYPE " + docType + " PUBLIC '" );
82          sb.append( publicId );
83          sb.append( "\' \'" );
84          sb.append( systemId );
85          sb.append( '\'' );
86          sb.append( '>' );
87          return sb.toString();
88      }
89  }