View Javadoc

1   package com.wutka.dtd;
2   
3   import java.io.*;
4   
5   /*** Represents a processing instruction in the DTD
6    *
7    * @author Mark Wutka
8    * @version $Revision: 1.16 $ $Date: 2002/07/19 01:20:11 $ by $Author: wutka $
9    */
10  public class DTDProcessingInstruction implements DTDOutput
11  {
12  /*** The processing instruction text */
13      public String text;
14  
15      public DTDProcessingInstruction()
16      {
17      }
18  
19      public DTDProcessingInstruction(String theText)
20      {
21          text = theText;
22      }
23      
24      public String toString()
25      {
26  	    return text;
27      }
28  
29      public void write(PrintWriter out)
30          throws IOException
31      {
32          out.print("<?");
33          out.print(text);
34          out.println("?>");
35      }
36  
37      public boolean equals(Object ob)
38      {
39          if (ob == this) return true;
40          if (!(ob instanceof DTDProcessingInstruction)) return false;
41  
42          DTDProcessingInstruction other = (DTDProcessingInstruction) ob;
43  
44          if (text == null)
45          {
46              if (other.text != null) return false;
47          }
48          else
49          {
50              if (!text.equals(other.text)) return false;
51          }
52  
53          return true;
54      }
55  
56  /*** Sets the instruction text */
57      public void setText(String theText)
58      {
59          text = theText;
60      }
61  
62  /*** Retrieves the instruction text */
63      public String getText()
64      {
65          return text;
66      }
67  }