View Javadoc

1   package com.wutka.dtd;
2   
3   import java.io.*;
4   import java.util.*;
5   
6   /*** Represents a mixed Element content (PCDATA + choice/sequence).
7    * Mixed Element can contain #PCDATA, or it can contain
8    * #PCDATA followed by a list of pipe-separated names.
9    *
10   * @author Mark Wutka
11   * @version $Revision: 1.16 $ $Date: 2002/07/19 01:20:11 $ by $Author: wutka $
12   */
13  public class DTDMixed extends DTDContainer
14  {
15      public DTDMixed()
16      {
17      }
18  
19  /*** Writes out a declaration for mixed content */
20      public void write(PrintWriter out)
21          throws IOException
22      {
23          out.print("(");
24  
25          Enumeration e = getItemsVec().elements();
26          boolean isFirst = true;
27  
28          while (e.hasMoreElements())
29          {
30              if (!isFirst) out.print(" | ");
31              isFirst = false;
32  
33              DTDItem item = (DTDItem) e.nextElement();
34              item.write(out);
35          }
36          out.print(")");
37          cardinal.write(out);
38      }
39  
40      public boolean equals(Object ob)
41      {
42          if (ob == this) return true;
43          if (!(ob instanceof DTDMixed)) return false;
44  
45          return super.equals(ob);
46      }
47  }