src/main/java/org/jboss/util/xml/catalog/helpers/PublicId.java
public static String encodeURN(String publicId) {
    String urn = PublicId.normalize(publicId);

    urn = PublicId.stringReplace(urn, "%", "%25");
    urn = PublicId.stringReplace(urn, ";", "%3B");
    urn = PublicId.stringReplace(urn, "'", "%27");
    urn = PublicId.stringReplace(urn, "?", "%3F");
    urn = PublicId.stringReplace(urn, "#", "%23");
    urn = PublicId.stringReplace(urn, "+", "%2B");
    urn = PublicId.stringReplace(urn, " ", "+");
    urn = PublicId.stringReplace(urn, "::", ";");
    urn = PublicId.stringReplace(urn, ":", "%3A");
    urn = PublicId.stringReplace(urn, "//", ":");
    urn = PublicId.stringReplace(urn, "/", "%2F");

    return "urn:publicid:" + urn;
  }
public static String encodeURN(String publicId) {
    String urn = PublicId.normalize(publicId);

    urn = PublicId.stringReplace(urn, "%", "%25");
    urn = PublicId.stringReplace(urn, ";", "%3B");
    urn = PublicId.stringReplace(urn, "'", "%27");
    urn = PublicId.stringReplace(urn, "?", "%3F");
    urn = PublicId.stringReplace(urn, "#", "%23");
    urn = PublicId.stringReplace(urn, "+", "%2B");
    urn = PublicId.stringReplace(urn, " ", "+");
    urn = PublicId.stringReplace(urn, "::", ";");
    urn = PublicId.stringReplace(urn, ":", "%3A");
    urn = PublicId.stringReplace(urn, "//", ":");
    urn = PublicId.stringReplace(urn, "/", "%2F");

    return "urn:publicid:" + urn;
  }
public static String encodeURN ( String publicId ) { String urn = PublicId . normalize ( publicId ) ; urn = PublicId . stringReplace ( urn , "%" , "%25" ) ; urn = PublicId . stringReplace ( urn , ";" , "%3B" ) ; urn = PublicId . stringReplace ( urn , "'" , "%27" ) ; urn = PublicId . stringReplace ( urn , "?" , "%3F" ) ; urn = PublicId . stringReplace ( urn , "#" , "%23" ) ; urn = PublicId . stringReplace ( urn , "+" , "%2B" ) ; urn = PublicId . stringReplace ( urn , " " , "+" ) ; urn = PublicId . stringReplace ( urn , "::" , ";" ) ; urn = PublicId . stringReplace ( urn , ":" , "%3A" ) ; urn = PublicId . stringReplace ( urn , "//" , ":" ) ; urn = PublicId . stringReplace ( urn , "/" , "%2F" ) ; return "urn:publicid:" + urn ; }
Encode a public identifier as a "publicid" URN.

<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.
Encode a public identifier as a publicid URN .