Example usage for org.apache.commons.lang3 StringEscapeUtils escapeXml

List of usage examples for org.apache.commons.lang3 StringEscapeUtils escapeXml

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringEscapeUtils escapeXml.

Prototype

@Deprecated
public static final String escapeXml(final String input) 

Source Link

Document

Escapes the characters in a String using XML entities.

For example: "bread" & "butter" => "bread" & "butter" .

Usage

From source file:org.jboss.dashboard.ui.components.DashboardFilterHandler.java

public synchronized String serializeComponentData() throws Exception {
    // Serialize visible properties and options.
    StringWriter sw = new StringWriter();
    PrintWriter out = new PrintWriter(sw);
    int indent = 0;
    printIndent(out, indent);// ww  w . j  av  a2  s.c  om
    out.println("<dashboard_filter>");
    Iterator it = properties.iterator();
    while (it.hasNext()) {
        DashboardFilterProperty dashboardFilterProperty = (DashboardFilterProperty) it.next();
        printIndent(out, indent + 1);
        out.println("<property id=\"" + StringEscapeUtils.escapeXml(dashboardFilterProperty.getPropertyId())
                + "\" providerCode =\""
                + StringEscapeUtils.escapeXml(dashboardFilterProperty.getDataProviderCode()) + "\">");
        printIndent(out, indent + 2);
        out.println("<visible>" + dashboardFilterProperty.isVisible() + "</visible>");
        if (dashboardFilterProperty.getSectionId() != null) {
            printIndent(out, indent + 2);
            out.println("<section>" + dashboardFilterProperty.getSectionId() + "</section>");
        }
        printIndent(out, indent + 1);
        out.println("</property>");
    }

    // Serialize options.
    printIndent(out, indent + 1);
    out.println("<options>");
    printIndent(out, indent + 2);
    out.println("<shortViewMode>" + isShortMode + "</shortViewMode>");
    printIndent(out, indent + 2);
    out.println("<showLegend>" + showLegend + "</showLegend>");
    printIndent(out, indent + 2);
    out.println("<showRefreshButton>" + showRefreshButton + "</showRefreshButton>");
    printIndent(out, indent + 2);
    out.println("<showApplyhButton>" + showApplyButton + "</showApplyhButton>");
    printIndent(out, indent + 2);
    out.println("<showClearButton>" + showClearButton + "</showClearButton>");
    printIndent(out, indent + 2);
    out.println("<showPropertyNames>" + showPropertyNames + "</showPropertyNames>");
    printIndent(out, indent + 2);
    out.println("<showSubmitOnChange>" + showSubmitOnChange + "</showSubmitOnChange>");
    printIndent(out, indent + 1);
    out.println("<showAutoRefresh>" + showAutoRefresh + "</showAutoRefresh>");
    printIndent(out, indent + 1);
    out.println("</options>");
    printIndent(out, indent);

    out.println("</dashboard_filter>");
    serializedProperties = sw.toString();
    return sw.toString();
}

From source file:org.jboss.dashboard.ui.panel.help.PanelHelpManager.java

protected String escape(String s) {
    return StringEscapeUtils.escapeXml(s);
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.FieldStyleChangeInstruction.java

public FieldStyleChangeInstruction(NamespaceManager namespaceManager, Form form, String namespace, Field field,
        String styleValue) {//w w  w  .  j a  va 2s. c  o m
    String uid = namespaceManager.generateSquashedInputName(namespace, field);
    StringBuffer sb = new StringBuffer();
    sb.append("<setFieldStyle name=\"");
    sb.append(StringEscapeUtils.escapeXml(uid));
    sb.append("\" value=\"");
    sb.append(StringEscapeUtils.escapeXml(styleValue));
    sb.append("\"/>");
    XMLrepresentation = sb.toString();
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.LabelStyleChangeInstruction.java

public LabelStyleChangeInstruction(NamespaceManager namespaceManager, Form form, String namespace, Field field,
        String styleValue) {//from ww  w .  j  a v a 2 s  . c  o  m
    String uid = namespaceManager.generateSquashedInputName(namespace, field);
    StringBuffer sb = new StringBuffer();
    sb.append("<setLabelStyle name=\"");
    sb.append(StringEscapeUtils.escapeXml(uid));
    sb.append("\" value=\"");
    sb.append(StringEscapeUtils.escapeXml(styleValue));
    sb.append("\"/>");
    XMLrepresentation = sb.toString();
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.SetFieldValueInstruction.java

public SetFieldValueInstruction(Map paramsMap) {
    StringBuffer sb = new StringBuffer();
    for (Iterator it = paramsMap.keySet().iterator(); it.hasNext();) {
        String paramName = (String) it.next();
        Object paramValue = paramsMap.get(paramName);
        if (paramValue instanceof String[]) {
            sb.append("<setvalue name=\"");
            sb.append(StringEscapeUtils.escapeXml(paramName));
            sb.append("\" value=\"");
            if (((String[]) paramValue).length > 0) {
                String s = StringEscapeUtils.escapeXml(((String[]) paramValue)[0]);
                sb.append(StringUtils.replace(s, "\n", "&#10;"));
            }// w w w . j  a  v a  2  s  .c o  m
            sb.append("\"/>");
        } else {
            log.error("Unsupported param class " + paramValue.getClass().getName());
        }
    }
    XMLrepresentation = sb.toString();
}

From source file:org.jbpm.formModeler.core.processing.formProcessing.SetListValuesInstruction.java

public void updateListValues(List newValues) {
    StringBuffer sb = new StringBuffer();
    sb.append("<setListValues name=\"").append(StringEscapeUtils.escapeXml(fieldName)).append("\">");
    for (int i = 0; i < newValues.size(); i++) {
        Object[] objects = (Object[]) newValues.get(i);
        String id = String.valueOf(objects[0]);
        String value = String.valueOf(objects[1]);
        String selected = String.valueOf(objects[2]);
        sb.append("<option value=\"").append(StringEscapeUtils.escapeXml(id)).append("\" text=\"")
                .append(StringEscapeUtils.escapeXml(value)).append("\"");
        if (objects[2] != null) {
            sb.append(" selected=\"").append(selected).append("\"");
        }/*from ww  w .j av  a  2  s .c  o m*/
        sb.append("></option>");
    }
    sb.append("</setListValues>");
    XMLrepresentation = sb.toString();
}

From source file:org.jtwig.functions.builtin.StringFunctions.java

@JtwigFunction(name = "escape", aliases = { "e" })
public String escape(@Parameter String input, @Parameter String strategy) throws FunctionException {
    switch (EscapeStrategy.strategyByName(strategy.toLowerCase())) {
    case JAVASCRIPT:
        return StringEscapeUtils.escapeEcmaScript(input);
    case XML://from  w w w  .  j  av a  2  s.  co m
        return StringEscapeUtils.escapeXml(input);
    case HTML: // Default html
    default:
        return StringEscapeUtils.escapeHtml4(input);
    }
}

From source file:org.jtwig.util.TwigTransformUtils.java

public static String toTwig(Object object) {
    if (object instanceof Boolean)
        return ((boolean) object) ? "1" : "0";
    else if (object instanceof UnescaptedString) {
        return ((UnescaptedString) object).getContent();
    }/*ww w  .  j  av  a2  s  .  c  om*/

    return StringEscapeUtils.escapeXml(String.valueOf(object));
}

From source file:org.kie.workbench.common.stunner.bpmn.backend.legacy.Bpmn2JsonUnmarshaller.java

protected void applySubProcessProperties(SubProcess sp, Map<String, String> properties) {
    if (properties.get("name") != null) {
        sp.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n", " "));
        // add unescaped and untouched name value as extension element as well
        Utils.setMetaDataExtensionValue(sp, "elementname",
                wrapInCDATABlock(properties.get("name").replaceAll("\\\\n", "\n")));
    } else {/*  ww w .  jav  a2 s  . c o  m*/
        sp.setName("");
    }
    // process on-entry and on-exit actions as custom elements
    applyOnEntryActions(sp, properties);
    applyOnExitActions(sp, properties);

    // isAsync metadata
    if (properties.get("isasync") != null && properties.get("isasync").length() > 0
            && properties.get("isasync").equals("true")) {
        Utils.setMetaDataExtensionValue(sp, "customAsync", wrapInCDATABlock(properties.get("isasync")));
    }
    if (sp.getIoSpecification() == null) {
        InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification();
        sp.setIoSpecification(iospec);
    }
    parseAssignmentsInfo(properties);
    // data input set
    applyDataInputProperties(sp, properties, new HashMap<String, DataInput>());
    // data output set
    applyDataOutputProperties(sp, properties);
    // assignments
    if (properties.get("assignments") != null && properties.get("assignments").length() > 0
            && sp.getIoSpecification() != null) {
        String[] allAssignments = properties.get("assignments").split(",\\s*");
        for (String assignment : allAssignments) {
            if (assignment.contains("=")) {
                String[] assignmentParts = assignment.split("=\\s*");
                String fromPart = assignmentParts[0];
                if (fromPart.startsWith("[din]")) {
                    fromPart = fromPart.substring(5, fromPart.length());
                }
                DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation();
                if (sp.getIoSpecification() != null && sp.getIoSpecification().getDataOutputs() != null) {
                    List<DataInput> dataInputs = sp.getIoSpecification().getDataInputs();
                    for (DataInput di : dataInputs) {
                        if (di.getId().equals(sp.getId() + "_" + fromPart + "InputX")) {
                            dia.setTargetRef(di);
                            if (di.getName().equals("TaskName")) {
                                break;
                            }
                        }
                    }
                }
                Assignment a = Bpmn2Factory.eINSTANCE.createAssignment();
                FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
                if (assignmentParts.length > 1) {
                    String replacer = decodeAssociationValue(assignmentParts[1]);
                    fromExpression.setBody(wrapInCDATABlock(replacer));
                } else {
                    fromExpression.setBody("");
                }
                FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression();
                toExpression.setBody(dia.getTargetRef().getId());
                a.setFrom(fromExpression);
                a.setTo(toExpression);
                dia.getAssignment().add(a);
                sp.getDataInputAssociations().add(dia);
                //                } else if(assignment.contains("<->")) {
                //                    String[] assignmentParts = assignment.split( "<->\\s*" );
                //                    DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation();
                //                    DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation();
                //
                //                    ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement();
                //                    ie.setId(assignmentParts[0]);
                //                    dia.getSourceRef().add(ie);
                //                    doa.setTargetRef(ie);
                //
                //                    List<DataInput> dataInputs = sp.getIoSpecification().getDataInputs();
                //                    for(DataInput di : dataInputs) {
                //                        if(di.getId().equals(sp.getId() + "_" + assignmentParts[1] + "InputX")) {
                //                            dia.setTargetRef(di);
                //                            break;
                //                        }
                //                    }
                //                    List<DataOutput> dataOutputs = sp.getIoSpecification().getDataOutputs();
                //                    for(DataOutput dout : dataOutputs) {
                //                        if(dout.getId().equals(sp.getId() + "_" + assignmentParts[1] + "OutputX")) {
                //                            doa.getSourceRef().add(dout);
                //                            break;
                //                        }
                //                    }
                //
                //                    sp.getDataInputAssociations().add(dia);
                //                    sp.getDataOutputAssociations().add(doa);
            } else if (assignment.contains("->")) {
                String[] assignmentParts = assignment.split("->\\s*");
                String fromPart = assignmentParts[0];
                boolean isDataInput = false;
                boolean isDataOutput = false;
                if (fromPart.startsWith("[din]")) {
                    fromPart = fromPart.substring(5, fromPart.length());
                    isDataInput = true;
                }
                if (fromPart.startsWith("[dout]")) {
                    fromPart = fromPart.substring(6, fromPart.length());
                    isDataOutput = true;
                }
                List<DataOutput> dataOutputs = sp.getIoSpecification().getDataOutputs();
                if (isDataOutput) {
                    DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation();
                    for (DataOutput dout : dataOutputs) {
                        if (dout.getId().equals(sp.getId() + "_" + fromPart + "OutputX")) {
                            doa.getSourceRef().add(dout);
                            break;
                        }
                    }
                    ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement();
                    ie.setId(assignmentParts[1]);
                    doa.setTargetRef(ie);
                    sp.getDataOutputAssociations().add(doa);
                } else if (isDataInput) {
                    DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation();
                    // association from process var to dataInput var
                    ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement();
                    ie.setId(fromPart);
                    dia.getSourceRef().add(ie);
                    List<DataInput> dataInputs = sp.getIoSpecification().getDataInputs();
                    for (DataInput di : dataInputs) {
                        if (di.getId().equals(sp.getId() + "_" + assignmentParts[1] + "InputX")) {
                            dia.setTargetRef(di);
                            break;
                        }
                    }
                    sp.getDataInputAssociations().add(dia);
                }
            } else {
                // TODO throw exception here?
            }
        }
    }
    // multi instance loop characteristics
    if (properties.get("mitrigger") != null && properties.get("mitrigger").equals("true")) {

        final MultiInstanceLoopCharacteristics loopCharacteristics = Bpmn2Factory.eINSTANCE
                .createMultiInstanceLoopCharacteristics();

        //ensure data inputs/outputs
        if (sp.getIoSpecification() == null) {
            InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification();
            sp.setIoSpecification(iospec);
        } else {
            sp.getIoSpecification().getDataInputs().clear();
            sp.getIoSpecification().getDataOutputs().clear();
            sp.getDataInputAssociations().clear();
            sp.getDataOutputAssociations().clear();
        }

        // loop characteristics input
        final String inputCollectionStr = properties.get("multipleinstancecollectioninput");
        if (inputCollectionStr != null && !inputCollectionStr.isEmpty()) {
            //set the input collection
            InputSet inset = sp.getIoSpecification().getInputSets().get(0);
            DataInput multiInput = Bpmn2Factory.eINSTANCE.createDataInput();
            multiInput.setId(sp.getId() + "_" + "input");
            multiInput.setName(inputCollectionStr);
            sp.getIoSpecification().getDataInputs().add(multiInput);
            inset.getDataInputRefs().add(multiInput);
            DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation();
            ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement();
            ie.setId(inputCollectionStr);
            dia.getSourceRef().add(ie);
            dia.setTargetRef(multiInput);
            sp.getDataInputAssociations().add(dia);
            loopCharacteristics.setLoopDataInputRef(multiInput);
        }

        //set the input iteration variable
        final String miDataInputStr = properties.get("multipleinstancedatainput");
        if (miDataInputStr != null && !miDataInputStr.isEmpty()) {
            DataInput din = Bpmn2Factory.eINSTANCE.createDataInput();
            din.setId(miDataInputStr);
            ItemDefinition itemDef = Bpmn2Factory.eINSTANCE.createItemDefinition();
            itemDef.setId(sp.getId() + "_" + "multiInstanceInputItemType");
            din.setItemSubjectRef(itemDef);
            addSubprocessItemDefs(itemDef);
            loopCharacteristics.setInputDataItem(din);
        }

        // loop characteristics output
        final String outputCollectionStr = properties.get("multipleinstancecollectionoutput");
        if (outputCollectionStr != null && !outputCollectionStr.isEmpty()) {
            //set the output collection
            OutputSet outset = sp.getIoSpecification().getOutputSets().get(0);
            DataOutput multiOutput = Bpmn2Factory.eINSTANCE.createDataOutput();
            multiOutput.setId(sp.getId() + "_" + "output");
            multiOutput.setName(outputCollectionStr);
            sp.getIoSpecification().getDataOutputs().add(multiOutput);
            outset.getDataOutputRefs().add(multiOutput);
            DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation();
            ItemAwareElement ie2 = Bpmn2Factory.eINSTANCE.createItemAwareElement();
            ie2.setId(outputCollectionStr);
            doa.getSourceRef().add(multiOutput);
            doa.setTargetRef(ie2);
            sp.getDataOutputAssociations().add(doa);
            loopCharacteristics.setLoopDataOutputRef(multiOutput);
        }

        //set the output iteration variable
        final String miDataOutputStr = properties.get("multipleinstancedataoutput");
        if (miDataOutputStr != null && !miDataOutputStr.isEmpty()) {
            DataOutput don = Bpmn2Factory.eINSTANCE.createDataOutput();
            don.setId(miDataOutputStr);
            ItemDefinition itemDef2 = Bpmn2Factory.eINSTANCE.createItemDefinition();
            itemDef2.setId(sp.getId() + "_" + "multiInstanceOutputItemType");
            don.setItemSubjectRef(itemDef2);
            addSubprocessItemDefs(itemDef2);
            loopCharacteristics.setOutputDataItem(don);
        }

        // loop characteristics completion condition
        final String completionConditionStr = properties.get("multipleinstancecompletioncondition");
        if (completionConditionStr != null && !completionConditionStr.isEmpty()) {
            FormalExpression expr = Bpmn2Factory.eINSTANCE.createFormalExpression();
            expr.setBody(wrapInCDATABlock(completionConditionStr));
            loopCharacteristics.setCompletionCondition(expr);
        }

        sp.setLoopCharacteristics(loopCharacteristics);
    }
    // properties
    if (properties.get("vardefs") != null && properties.get("vardefs").length() > 0) {
        String[] vardefs = properties.get("vardefs").split(",\\s*");
        for (String vardef : vardefs) {
            Property prop = Bpmn2Factory.eINSTANCE.createProperty();
            ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition();
            // check if we define a structure ref in the definition
            if (vardef.contains(":")) {
                String[] vardefParts = vardef.split(":\\s*");
                prop.setId(vardefParts[0]);
                itemdef.setId("_" + prop.getId() + "Item");
                boolean haveKPI = false;
                String kpiValue = "";
                if (vardefParts.length == 3) {
                    itemdef.setStructureRef(vardefParts[1]);
                    if (vardefParts[2].equals("true")) {
                        haveKPI = true;
                        kpiValue = vardefParts[2];
                    }
                }
                if (vardefParts.length == 2) {
                    if (vardefParts[1].equals("true") || vardefParts[1].equals("false")) {
                        if (vardefParts[1].equals("true")) {
                            haveKPI = true;
                            kpiValue = vardefParts[1];
                        }
                    } else {
                        itemdef.setStructureRef(vardefParts[1]);
                    }
                }
                if (haveKPI) {
                    Utils.setMetaDataExtensionValue(prop, "customKPI", wrapInCDATABlock(kpiValue));
                }
            } else {
                prop.setId(vardef);
                itemdef.setId("_" + prop.getId() + "Item");
            }
            prop.setItemSubjectRef(itemdef);
            sp.getProperties().add(prop);
            addSubprocessItemDefs(itemdef);
        }
    }
    // event subprocess
    if (sp instanceof EventSubprocess) {
        sp.setTriggeredByEvent(true);
    }
    // simulation
    if (properties.get("distributiontype") != null && properties.get("distributiontype").length() > 0) {
        TimeParameters timeParams = BpsimFactory.eINSTANCE.createTimeParameters();
        Parameter processingTimeParam = BpsimFactory.eINSTANCE.createParameter();
        if (properties.get("distributiontype").equals("normal")) {
            NormalDistributionType normalDistributionType = BpsimFactory.eINSTANCE
                    .createNormalDistributionType();
            normalDistributionType.setStandardDeviation(Double.valueOf(properties.get("standarddeviation")));
            normalDistributionType.setMean(Double.valueOf(properties.get("mean")));
            processingTimeParam.getParameterValue().add(normalDistributionType);
        } else if (properties.get("distributiontype").equals("uniform")) {
            UniformDistributionType uniformDistributionType = BpsimFactory.eINSTANCE
                    .createUniformDistributionType();
            uniformDistributionType.setMax(Double.valueOf(properties.get("max")));
            uniformDistributionType.setMin(Double.valueOf(properties.get("min")));
            processingTimeParam.getParameterValue().add(uniformDistributionType);
            // random distribution not supported in bpsim 1.0
            //             } else if(properties.get("distributiontype").equals("random")) {
            //                  RandomDistributionType randomDistributionType = BpsimFactory.eINSTANCE.createRandomDistributionType();
            //                  randomDistributionType.setMax(Double.valueOf(properties.get("max")));
            //                  randomDistributionType.setMin(Double.valueOf(properties.get("min")));
            //                  processingTimeParam.getParameterValue().add(randomDistributionType);
        } else if (properties.get("distributiontype").equals("poisson")) {
            PoissonDistributionType poissonDistributionType = BpsimFactory.eINSTANCE
                    .createPoissonDistributionType();
            poissonDistributionType.setMean(Double.valueOf(properties.get("mean")));
            processingTimeParam.getParameterValue().add(poissonDistributionType);
        }
        // individual time unit not supported in bpsim 1.0
        //             if(properties.get("timeunit") != null) {
        //                  timeParams.setTimeUnit(TimeUnit.getByName(properties.get("timeunit")));
        //             }
        if (properties.get("waittime") != null) {
            Parameter waittimeParam = BpsimFactory.eINSTANCE.createParameter();
            FloatingParameterType waittimeParamValue = BpsimFactory.eINSTANCE.createFloatingParameterType();
            DecimalFormat twoDForm = new DecimalFormat("#.##");
            waittimeParamValue
                    .setValue(Double.valueOf(twoDForm.format(Double.valueOf(properties.get("waittime")))));
            waittimeParam.getParameterValue().add(waittimeParamValue);
            timeParams.setWaitTime(waittimeParam);
        }
        timeParams.setProcessingTime(processingTimeParam);
        if (_simulationElementParameters.containsKey(sp.getId())) {
            _simulationElementParameters.get(sp.getId()).add(timeParams);
        } else {
            List<EObject> values = new ArrayList<EObject>();
            values.add(timeParams);
            _simulationElementParameters.put(sp.getId(), values);
        }
    }
    CostParameters costParameters = BpsimFactory.eINSTANCE.createCostParameters();
    if (properties.get("unitcost") != null && properties.get("unitcost").length() > 0) {
        Parameter unitcostParam = BpsimFactory.eINSTANCE.createParameter();
        FloatingParameterType unitCostParameterValue = BpsimFactory.eINSTANCE.createFloatingParameterType();
        unitCostParameterValue.setValue(new Double(properties.get("unitcost")));
        unitcostParam.getParameterValue().add(unitCostParameterValue);
        costParameters.setUnitCost(unitcostParam);
    }
    // no individual currency unit supported in bpsim 1.0
    //        if(properties.get("currency") != null && properties.get("currency").length() > 0) {
    //            costParameters.setCurrencyUnit(properties.get("currency"));
    //        }
    if (_simulationElementParameters.containsKey(sp.getId())) {
        _simulationElementParameters.get(sp.getId()).add(costParameters);
    } else {
        List<EObject> values = new ArrayList<EObject>();
        values.add(costParameters);
        _simulationElementParameters.put(sp.getId(), values);
    }
}

From source file:org.kie.workbench.common.stunner.bpmn.backend.legacy.Bpmn2JsonUnmarshaller.java

protected void applyMessageProperties(Message msg, Map<String, String> properties) {
    if (properties.get("name") != null && properties.get("name").length() > 0) {
        msg.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n", " "));
        msg.setId(properties.get("name") + "Message");
        // add unescaped and untouched name value as extension element as well
        Utils.setMetaDataExtensionValue(msg, "elementname",
                wrapInCDATABlock(properties.get("name").replaceAll("\\\\n", "\n")));
    } else {/*from  www.ja va  2 s.com*/
        msg.setName("");
        msg.setId("Message");
    }
}