final String componentKey = componentEntry.getKey(); final Type component = componentEntry.getValue(); final String componentValue = HL7_ESCAPING.unescape(component.encode(), HL7_ENCODING); if (!StringUtils.isEmpty(componentValue)) { attributes.put(componentKey, componentValue); final String fieldValue = HL7_ESCAPING.unescape(field.encode(), HL7_ENCODING); if (!StringUtils.isEmpty(fieldValue)) { attributes.put(fieldKey, fieldValue);
/** * @param text string to be unescaped * @param encChars encoding characters to be used * @return the unescaped string */ public static String unescape(String text, EncodingCharacters encChars) { return DEFAULT.unescape(text, encChars); }
/** * @param text string to be unescaped * @param encChars encoding characters to be used * @return the unescaped string */ public static String unescape(String text, EncodingCharacters encChars) { return DEFAULT.unescape(text, encChars); }
/** * Fills a field with values from an unparsed string representing the field. * * @param destinationField * the field Type * @param data * the field string (including all components and subcomponents; * not including field delimiters) * @param encodingCharacters * the encoding characters used in the message */ @Override public void parse(Type destinationField, String data, EncodingCharacters encodingCharacters) throws HL7Exception { String[] components = split(data, String.valueOf(encodingCharacters.getComponentSeparator())); for (int i = 0; i < components.length; i++) { String[] subcomponents = split(components[i], String.valueOf(encodingCharacters.getSubcomponentSeparator())); for (int j = 0; j < subcomponents.length; j++) { String val = subcomponents[j]; if (val != null) { val = getParserConfiguration().getEscaping().unescape(val, encodingCharacters); } Terser.getPrimitive(destinationField, i + 1, j + 1).setValue(val); } } }
/** * Fills a field with values from an unparsed string representing the field. * * @param destinationField * the field Type * @param data * the field string (including all components and subcomponents; * not including field delimiters) * @param encodingCharacters * the encoding characters used in the message */ @Override public void parse(Type destinationField, String data, EncodingCharacters encodingCharacters) throws HL7Exception { String[] components = split(data, String.valueOf(encodingCharacters.getComponentSeparator())); for (int i = 0; i < components.length; i++) { String[] subcomponents = split(components[i], String.valueOf(encodingCharacters.getSubcomponentSeparator())); for (int j = 0; j < subcomponents.length; j++) { String val = subcomponents[j]; if (val != null) { val = getParserConfiguration().getEscaping().unescape(val, encodingCharacters); } Terser.getPrimitive(destinationField, i + 1, j + 1).setValue(val); } } }
fieldText = parserConfig.getEscaping().unescape(fieldText, encodingChars); result.append(fieldText); if (j < reps.length - 1)
fieldText = parserConfig.getEscaping().unescape(fieldText, encodingChars); result.append(fieldText); if (j < reps.length - 1)
.getEscaping().unescape(string, encodingCharacters); setValue(escaped);
.getEscaping().unescape(string, encodingCharacters); setValue(escaped);