/** * creates a ctype value for the given {@link Code} object and the given {@link TAG}. * * @param code the code object * @param tag the xliff TAG * @return a ctype value for the given {@link Code} object and the given {@link TAG}. */ private String createCtype(Code code, TAG tag) { String result = ""; String codeType = code.getType(); if (!isValidCtype(tag, codeType)) { result = EXTENDED_CODE_TYPE_PREFIX; } if (codeType == null || codeType.isEmpty()) { result += "empty"; } else { // escape xml result += Util.escapeToXML(codeType, 1, false, null); // replace blanks in ctype values to underscores result = result.replaceAll(" ", "_"); } return result; }