Exemple #1
0
  public boolean equals(Object ob) {
    if (ob == this) return true;
    if (!(ob instanceof DTDEntity)) return false;

    DTDEntity other = (DTDEntity) ob;

    if (name == null) {
      if (other.name != null) return false;
    } else {
      if (!name.equals(other.name)) return false;
    }

    if (isParsed != other.isParsed) return false;

    if (value == null) {
      if (other.value != null) return false;
    } else {
      if (!value.equals(other.value)) return false;
    }

    if (externalID == null) {
      if (other.externalID != null) return false;
    } else {
      if (!externalID.equals(other.externalID)) return false;
    }

    if (ndata == null) {
      if (other.ndata != null) return false;
    } else {
      if (!ndata.equals(other.ndata)) return false;
    }

    return true;
  }
Exemple #2
0
  /** Writes out an entity declaration for this entity */
  public void write(PrintWriter out) throws IOException {
    out.print("<!ENTITY ");
    if (isParsed) {
      out.print(" % ");
    }
    out.print(name);

    if (value != null) {
      char quoteChar = '"';
      if (value.indexOf(quoteChar) >= 0) quoteChar = '\'';
      out.print(quoteChar);
      out.print(value);
      out.print(quoteChar);
    } else {
      externalID.write(out);
      if (ndata != null) {
        out.print(" NDATA ");
        out.print(ndata);
      }
    }
    out.println(">");
  }