src/main/java/org/jboss/util/xml/catalog/helpers/PublicId.java
public static String normalize(String publicId) {
    String normal = publicId.replace('\t', ' ');
    normal = normal.replace('\r', ' ');
    normal = normal.replace('\n', ' ');
    normal = normal.trim();

    int pos;

    while ((pos = normal.indexOf("  ")) >= 0) {
      normal = normal.substring(0, pos) + normal.substring(pos+1);
    }

    return normal;
  }
public static String normalize(String publicId) {
    String normal = publicId.replace('\t', ' ');
    normal = normal.replace('\r', ' ');
    normal = normal.replace('\n', ' ');
    normal = normal.trim();

    int pos;

    while ((pos = normal.indexOf("  ")) >= 0) {
      normal = normal.substring(0, pos) + normal.substring(pos+1);
    }

    return normal;
  }
Normalize a public identifier.

<p>Public identifiers must be normalized according to the following
rules before comparisons between them can be made:</p>

<ul>
<li>Whitespace characters are normalized to spaces (e.g., line feeds,
tabs, etc. become spaces).</li>
<li>Leading and trailing whitespace is removed.</li>
<li>Multiple internal whitespaces are normalized to a single
space.</li>
</ul>

<p>This method is declared static so that other classes
can use it directly.</p>

@param publicId The unnormalized public identifier.

@return The normalized identifier.