Example usage for javax.xml.stream XMLStreamWriter writeCharacters

List of usage examples for javax.xml.stream XMLStreamWriter writeCharacters

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamWriter writeCharacters.

Prototype

public void writeCharacters(String text) throws XMLStreamException;

Source Link

Document

Write text to the output

Usage

From source file:org.activiti.designer.export.bpmn20.export.MultiInstanceExport.java

public static void createMultiInstance(Object object, XMLStreamWriter xtw) throws Exception {
    Activity activity = (Activity) object;
    if (activity.getLoopCharacteristics() == null)
        return;//w  ww . j a v  a2s. co m

    MultiInstanceLoopCharacteristics multiInstanceDef = (MultiInstanceLoopCharacteristics) activity
            .getLoopCharacteristics();

    if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())
            || StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())
            || StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) {

        // start multiInstance element
        xtw.writeStartElement("multiInstanceLoopCharacteristics");
        xtw.writeAttribute("isSequential", "" + multiInstanceDef.isSequential());
        if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())) {
            xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "collection",
                    multiInstanceDef.getInputDataItem());
        }
        if (StringUtils.isNotEmpty(multiInstanceDef.getElementVariable())) {
            xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "elementVariable",
                    multiInstanceDef.getElementVariable());
        }

        if (StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())) {
            xtw.writeStartElement("loopCardinality");
            xtw.writeCharacters(multiInstanceDef.getLoopCardinality());
            xtw.writeEndElement();
        }

        if (StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) {
            xtw.writeStartElement("completionCondition");
            xtw.writeCharacters(multiInstanceDef.getCompletionCondition());
            xtw.writeEndElement();
        }

        // end multiInstance element
        xtw.writeEndElement();
    }
}

From source file:org.activiti.designer.export.bpmn20.export.ServiceTaskExport.java

public static void createServiceTask(Object object, XMLStreamWriter xtw) throws Exception {
    ServiceTask serviceTask = (ServiceTask) object;
    // start ServiceTask element
    xtw.writeStartElement("serviceTask");
    xtw.writeAttribute("id", serviceTask.getId());
    if (StringUtils.isNotEmpty(serviceTask.getName())) {
        xtw.writeAttribute("name", serviceTask.getName());
    }/*ww w  .j  a  v  a  2 s.c  o m*/
    DefaultFlowExport.createDefaultFlow(serviceTask, xtw);
    AsyncActivityExport.createAsyncAttribute(serviceTask, xtw);
    ImplementationValueExport.writeImplementationValue(xtw, EXECUTION_LISTENER,
            serviceTask.getImplementationType(), serviceTask.getImplementation(), true);

    if (StringUtils.isNotEmpty(serviceTask.getResultVariableName())) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "resultVariableName",
                serviceTask.getResultVariableName());
    }

    boolean executionListenersAvailable = false;
    if (serviceTask.getExecutionListeners() != null && serviceTask.getExecutionListeners().size() > 0) {
        executionListenersAvailable = true;
    }

    boolean fieldExtensionsAvailable = false;
    if (serviceTask.getFieldExtensions() != null && serviceTask.getFieldExtensions().size() > 0) {

        for (FieldExtension fieldExtension : serviceTask.getFieldExtensions()) {
            if (fieldExtension.getFieldName() != null && fieldExtension.getFieldName().length() > 0
                    && fieldExtension.getExpression() != null && fieldExtension.getExpression().length() > 0) {

                fieldExtensionsAvailable = true;
                break;
            }
        }
    }

    if (executionListenersAvailable == true || fieldExtensionsAvailable == true) {
        xtw.writeStartElement("extensionElements");
    }

    ExecutionListenerExport.createExecutionListenerXML(serviceTask.getExecutionListeners(), false, xtw);

    FieldExtensionsExport.writeFieldExtensions(xtw, serviceTask.getFieldExtensions(), false);

    if (executionListenersAvailable == true || fieldExtensionsAvailable == true) {
        xtw.writeEndElement();
    }

    if (serviceTask.getCustomProperties() != null && serviceTask.getCustomProperties().size() > 0) {
        boolean firstCustomProperty = true;
        for (CustomProperty customProperty : serviceTask.getCustomProperties()) {
            if (ExtensionConstants.PROPERTY_ID_CUSTOM_SERVICE_TASK.equals(customProperty.getName())) {
                continue;
            }
            if (customProperty.getSimpleValue() == null || customProperty.getSimpleValue().length() == 0) {
                continue;
            }
            if (firstCustomProperty == true) {
                xtw.writeStartElement("extensionElements");
                firstCustomProperty = false;
            }
            xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "field", ACTIVITI_EXTENSIONS_NAMESPACE);
            xtw.writeAttribute("name", customProperty.getName());
            xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "string", ACTIVITI_EXTENSIONS_NAMESPACE);
            xtw.writeCharacters(customProperty.getSimpleValue());
            xtw.writeEndElement();
            xtw.writeEndElement();
        }
        if (firstCustomProperty == false) {
            xtw.writeEndElement();
        }
    }

    MultiInstanceExport.createMultiInstance(object, xtw);

    // end ServiceTask element
    xtw.writeEndElement();
}

From source file:org.activiti.designer.export.bpmn20.export.UserTaskExport.java

public static void createUserTask(Object object, XMLStreamWriter xtw) throws Exception {
    UserTask userTask = (UserTask) object;

    // start UserTask element
    xtw.writeStartElement("userTask");
    xtw.writeAttribute("id", userTask.getId());
    if (userTask.getName() != null) {
        xtw.writeAttribute("name", userTask.getName());
    }/*  www.  j a v  a 2s.  c  o m*/

    if (userTask.getDueDate() != null) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "dueDate",
                userTask.getDueDate().toString());
    }

    DefaultFlowExport.createDefaultFlow(userTask, xtw);
    AsyncActivityExport.createAsyncAttribute(userTask, xtw);

    if (userTask.getAssignee() != null && userTask.getAssignee().length() > 0) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "assignee",
                userTask.getAssignee());
    }

    if (userTask.getCandidateUsers().size() > 0) {
        Iterator<String> candidateUserIterator = userTask.getCandidateUsers().iterator();
        String candidateUsers = candidateUserIterator.next();
        while (candidateUserIterator.hasNext()) {
            candidateUsers += ", " + candidateUserIterator.next();
        }
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "candidateUsers",
                candidateUsers);
    }

    if (userTask.getCandidateGroups().size() > 0) {
        Iterator<String> candidateGroupIterator = userTask.getCandidateGroups().iterator();
        String candidateGroups = candidateGroupIterator.next();
        while (candidateGroupIterator.hasNext()) {
            candidateGroups += ", " + candidateGroupIterator.next();
        }
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "candidateGroups",
                candidateGroups);
    }

    if (StringUtils.isNotEmpty(userTask.getFormKey())) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "formKey",
                userTask.getFormKey());
    }

    if (StringUtils.isNotEmpty(userTask.getPriority())) {
        xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "priority",
                userTask.getPriority());
    }

    if (StringUtils.isNotEmpty(userTask.getDocumentation())) {
        xtw.writeStartElement("documentation");
        xtw.writeCharacters(userTask.getDocumentation());
        // end documentation element
        xtw.writeEndElement();
    }

    boolean extensionsElement = true;
    if (userTask.getFormProperties().size() > 0) {
        extensionsElement = false;
        xtw.writeStartElement("extensionElements");
    }

    FormPropertiesExport.createFormPropertiesXML(userTask.getFormProperties(), xtw);
    TaskListenerExport.createTaskListenerXML(userTask.getTaskListeners(), extensionsElement, xtw);

    if (extensionsElement == false) {
        xtw.writeEndElement();
    }

    MultiInstanceExport.createMultiInstance(object, xtw);

    // end UserTask element
    xtw.writeEndElement();
}

From source file:org.activiti.designer.export.srcm.export.MailTaskExport.java

private static void writeAlfrescoScriptMailTask(AlfrescoMailTask mailTask, XMLStreamWriter xtw)
        throws Exception {

    // start AlfrescoMailTask element
    xtw.writeStartElement("serviceTask");
    xtw.writeAttribute("id", mailTask.getId());
    if (mailTask.getName() != null) {
        xtw.writeAttribute("name", mailTask.getName());
    }//w  w  w.java  2s  . co m
    xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "class",
            "org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate");
    DefaultFlowExport.createDefaultFlow(mailTask, xtw);
    AsyncActivityExport.createDefaultFlow(mailTask, xtw);

    xtw.writeStartElement("extensionElements");

    ExtensionListenerExport.createExtensionListenerXML(mailTask.getActivitiListeners(), false,
            EXECUTION_LISTENER, xtw);

    xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "field", ACTIVITI_EXTENSIONS_NAMESPACE);
    xtw.writeAttribute("name", "script");
    xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, "string", ACTIVITI_EXTENSIONS_NAMESPACE);
    xtw.writeCharacters(createMailScript(mailTask));
    xtw.writeEndElement();
    xtw.writeEndElement();

    xtw.writeEndElement();

    MultiInstanceExport.createMultiInstance(mailTask, xtw);

    // end AlfrescoMailTask element
    xtw.writeEndElement();

    if (mailTask.getBoundaryEventRefs().size() > 0) {
        for (BoundaryEvent event : mailTask.getBoundaryEventRefs()) {
            BoundaryEventExport.createBoundaryEvent(event, xtw);
        }
    }
}

From source file:org.activiti.designer.export.srcm.export.MultiInstanceExport.java

public static void createMultiInstance(EObject object, XMLStreamWriter xtw) throws Exception {
    Activity activity = (Activity) object;
    if (activity.getLoopCharacteristics() == null)
        return;//from  w  w w .  java2  s.  c  o m

    MultiInstanceLoopCharacteristics multiInstanceDef = (MultiInstanceLoopCharacteristics) activity
            .getLoopCharacteristics();

    if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())
            || StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())
            || StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) {

        // start multiInstance element
        xtw.writeStartElement("multiInstanceLoopCharacteristics");
        xtw.writeAttribute("isSequential", "" + multiInstanceDef.isIsSequential());
        if (multiInstanceDef.getInputDataItem() != null && multiInstanceDef.getInputDataItem().contains("${")) {
            xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "collection",
                    multiInstanceDef.getInputDataItem());
            if (multiInstanceDef.getElementVariable() != null
                    && multiInstanceDef.getElementVariable().length() > 0) {
                xtw.writeAttribute(ACTIVITI_EXTENSIONS_PREFIX, ACTIVITI_EXTENSIONS_NAMESPACE, "elementVariable",
                        multiInstanceDef.getElementVariable());
            }
        }
        if (StringUtils.isNotEmpty(multiInstanceDef.getLoopCardinality())) {
            xtw.writeStartElement("loopCardinality");
            xtw.writeCharacters(multiInstanceDef.getLoopCardinality());
            xtw.writeEndElement();
        }

        if (StringUtils.isNotEmpty(multiInstanceDef.getInputDataItem())
                && multiInstanceDef.getInputDataItem().contains("${") == false) {

            xtw.writeStartElement("loopDataInputRef");
            xtw.writeCharacters(multiInstanceDef.getInputDataItem());
            xtw.writeEndElement();

            if (StringUtils.isNotEmpty(multiInstanceDef.getElementVariable())) {
                xtw.writeStartElement("inputDataItem");
                xtw.writeAttribute("name", multiInstanceDef.getElementVariable());
                xtw.writeEndElement();
            }
        }

        if (StringUtils.isNotEmpty(multiInstanceDef.getCompletionCondition())) {
            xtw.writeStartElement("completionCondition");
            xtw.writeCharacters(multiInstanceDef.getCompletionCondition());
            xtw.writeEndElement();
        }

        // end multiInstance element
        xtw.writeEndElement();
    }
}

From source file:org.activiti.dmn.converter.util.DmnXMLUtil.java

public static void writeElementDescription(DmnElement dmnElement, XMLStreamWriter xtw) throws Exception {
    if (StringUtils.isNotEmpty(dmnElement.getDescription())
            && !"null".equalsIgnoreCase(dmnElement.getDescription())) {
        xtw.writeStartElement(ELEMENT_DESCRIPTION);
        xtw.writeCharacters(dmnElement.getDescription());
        xtw.writeEndElement();/*from   w  w  w  .  j a v  a2  s.co m*/
    }
}

From source file:org.activiti.dmn.converter.util.DmnXMLUtil.java

protected static void writeExtensionElement(DmnExtensionElement extensionElement,
        Map<String, String> namespaceMap, XMLStreamWriter xtw) throws Exception {
    if (StringUtils.isNotEmpty(extensionElement.getName())) {
        Map<String, String> localNamespaceMap = new HashMap<String, String>();
        if (StringUtils.isNotEmpty(extensionElement.getNamespace())) {
            if (StringUtils.isNotEmpty(extensionElement.getNamespacePrefix())) {
                xtw.writeStartElement(extensionElement.getNamespacePrefix(), extensionElement.getName(),
                        extensionElement.getNamespace());

                if (namespaceMap.containsKey(extensionElement.getNamespacePrefix()) == false
                        || namespaceMap.get(extensionElement.getNamespacePrefix())
                                .equals(extensionElement.getNamespace()) == false) {

                    xtw.writeNamespace(extensionElement.getNamespacePrefix(), extensionElement.getNamespace());
                    namespaceMap.put(extensionElement.getNamespacePrefix(), extensionElement.getNamespace());
                    localNamespaceMap.put(extensionElement.getNamespacePrefix(),
                            extensionElement.getNamespace());
                }//  www  .  j a va 2s .  c  o  m
            } else {
                xtw.writeStartElement(extensionElement.getNamespace(), extensionElement.getName());
            }
        } else {
            xtw.writeStartElement(extensionElement.getName());
        }

        for (List<DmnExtensionAttribute> attributes : extensionElement.getAttributes().values()) {
            for (DmnExtensionAttribute attribute : attributes) {
                if (StringUtils.isNotEmpty(attribute.getName()) && attribute.getValue() != null) {
                    if (StringUtils.isNotEmpty(attribute.getNamespace())) {
                        if (StringUtils.isNotEmpty(attribute.getNamespacePrefix())) {

                            if (namespaceMap.containsKey(attribute.getNamespacePrefix()) == false
                                    || namespaceMap.get(attribute.getNamespacePrefix())
                                            .equals(attribute.getNamespace()) == false) {

                                xtw.writeNamespace(attribute.getNamespacePrefix(), attribute.getNamespace());
                                namespaceMap.put(attribute.getNamespacePrefix(), attribute.getNamespace());
                            }

                            xtw.writeAttribute(attribute.getNamespacePrefix(), attribute.getNamespace(),
                                    attribute.getName(), attribute.getValue());
                        } else {
                            xtw.writeAttribute(attribute.getNamespace(), attribute.getName(),
                                    attribute.getValue());
                        }
                    } else {
                        xtw.writeAttribute(attribute.getName(), attribute.getValue());
                    }
                }
            }
        }

        if (extensionElement.getElementText() != null) {
            xtw.writeCharacters(extensionElement.getElementText());
        } else {
            for (List<DmnExtensionElement> childElements : extensionElement.getChildElements().values()) {
                for (DmnExtensionElement childElement : childElements) {
                    writeExtensionElement(childElement, namespaceMap, xtw);
                }
            }
        }

        for (String prefix : localNamespaceMap.keySet()) {
            namespaceMap.remove(prefix);
        }

        xtw.writeEndElement();
    }
}

From source file:org.activiti.dmn.xml.converter.DmnXMLConverter.java

public byte[] convertToXML(DmnDefinition model, String encoding) {
    try {/*  w w w.  ja  v  a  2s .co  m*/

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

        XMLOutputFactory xof = XMLOutputFactory.newInstance();
        OutputStreamWriter out = new OutputStreamWriter(outputStream, encoding);

        XMLStreamWriter writer = xof.createXMLStreamWriter(out);
        XMLStreamWriter xtw = new IndentingXMLStreamWriter(writer);

        xtw.writeStartElement(ELEMENT_DEFINITIONS);
        xtw.writeDefaultNamespace(DMN_NAMESPACE);
        xtw.writeAttribute(ATTRIBUTE_ID, model.getId());
        if (StringUtils.isNotEmpty(model.getName())) {
            xtw.writeAttribute(ATTRIBUTE_NAME, model.getName());
        }
        xtw.writeAttribute(ATTRIBUTE_NAMESPACE, MODEL_NAMESPACE);

        DmnXMLUtil.writeElementDescription(model, xtw);
        DmnXMLUtil.writeExtensionElements(model, xtw);

        for (ItemDefinition itemDefinition : model.getItemDefinitions()) {
            xtw.writeStartElement(ELEMENT_ITEM_DEFINITION);
            xtw.writeAttribute(ATTRIBUTE_ID, itemDefinition.getId());
            if (StringUtils.isNotEmpty(itemDefinition.getName())) {
                xtw.writeAttribute(ATTRIBUTE_NAME, itemDefinition.getName());
            }

            DmnXMLUtil.writeElementDescription(itemDefinition, xtw);
            DmnXMLUtil.writeExtensionElements(itemDefinition, xtw);

            xtw.writeStartElement(ELEMENT_TYPE_DEFINITION);
            xtw.writeCharacters(itemDefinition.getTypeDefinition());
            xtw.writeEndElement();

            xtw.writeEndElement();
        }

        for (Decision decision : model.getDrgElements()) {
            xtw.writeStartElement(ELEMENT_DECISION);
            xtw.writeAttribute(ATTRIBUTE_ID, decision.getId());
            if (StringUtils.isNotEmpty(decision.getName())) {
                xtw.writeAttribute(ATTRIBUTE_NAME, decision.getName());
            }

            DmnXMLUtil.writeElementDescription(decision, xtw);
            DmnXMLUtil.writeExtensionElements(decision, xtw);

            DecisionTable decisionTable = decision.getDecisionTable();
            xtw.writeStartElement(ELEMENT_DECISION_TABLE);
            xtw.writeAttribute(ATTRIBUTE_ID, decisionTable.getId());

            if (decisionTable.getHitPolicy() != null) {
                xtw.writeAttribute(ATTRIBUTE_HIT_POLICY, decisionTable.getHitPolicy().toString());
            }

            DmnXMLUtil.writeElementDescription(decisionTable, xtw);
            DmnXMLUtil.writeExtensionElements(decisionTable, xtw);

            for (InputClause clause : decisionTable.getInputs()) {
                xtw.writeStartElement(ELEMENT_INPUT_CLAUSE);
                if (StringUtils.isNotEmpty(clause.getId())) {
                    xtw.writeAttribute(ATTRIBUTE_ID, clause.getId());
                }
                if (StringUtils.isNotEmpty(clause.getLabel())) {
                    xtw.writeAttribute(ATTRIBUTE_LABEL, clause.getLabel());
                }

                DmnXMLUtil.writeElementDescription(clause, xtw);
                DmnXMLUtil.writeExtensionElements(clause, xtw);

                if (clause.getInputExpression() != null) {
                    xtw.writeStartElement(ELEMENT_INPUT_EXPRESSION);
                    xtw.writeAttribute(ATTRIBUTE_ID, clause.getInputExpression().getId());

                    if (StringUtils.isNotEmpty(clause.getInputExpression().getTypeRef())) {
                        xtw.writeAttribute(ATTRIBUTE_TYPE_REF, clause.getInputExpression().getTypeRef());
                    }

                    if (StringUtils.isNotEmpty(clause.getInputExpression().getText())) {
                        xtw.writeStartElement(ELEMENT_TEXT);
                        xtw.writeCharacters(clause.getInputExpression().getText());
                        xtw.writeEndElement();
                    }

                    xtw.writeEndElement();
                }

                xtw.writeEndElement();
            }

            for (OutputClause clause : decisionTable.getOutputs()) {
                xtw.writeStartElement(ELEMENT_OUTPUT_CLAUSE);
                if (StringUtils.isNotEmpty(clause.getId())) {
                    xtw.writeAttribute(ATTRIBUTE_ID, clause.getId());
                }
                if (StringUtils.isNotEmpty(clause.getLabel())) {
                    xtw.writeAttribute(ATTRIBUTE_LABEL, clause.getLabel());
                }
                if (StringUtils.isNotEmpty(clause.getName())) {
                    xtw.writeAttribute(ATTRIBUTE_NAME, clause.getName());
                }
                if (StringUtils.isNotEmpty(clause.getTypeRef())) {
                    xtw.writeAttribute(ATTRIBUTE_TYPE_REF, clause.getTypeRef());
                }

                DmnXMLUtil.writeElementDescription(clause, xtw);
                DmnXMLUtil.writeExtensionElements(clause, xtw);

                xtw.writeEndElement();
            }

            for (DecisionRule rule : decisionTable.getRules()) {
                xtw.writeStartElement(ELEMENT_RULE);
                if (StringUtils.isNotEmpty(rule.getId())) {
                    xtw.writeAttribute(ATTRIBUTE_ID, rule.getId());
                }

                DmnXMLUtil.writeElementDescription(rule, xtw);
                DmnXMLUtil.writeExtensionElements(rule, xtw);

                for (RuleInputClauseContainer container : rule.getInputEntries()) {
                    xtw.writeStartElement(ELEMENT_INPUT_ENTRY);
                    xtw.writeAttribute(ATTRIBUTE_ID, container.getInputEntry().getId());

                    xtw.writeStartElement(ELEMENT_TEXT);
                    xtw.writeCharacters(container.getInputEntry().getText());
                    xtw.writeEndElement();

                    xtw.writeEndElement();
                }

                for (RuleOutputClauseContainer container : rule.getOutputEntries()) {
                    xtw.writeStartElement(ELEMENT_OUTPUT_ENTRY);
                    xtw.writeAttribute(ATTRIBUTE_ID, container.getOutputEntry().getId());

                    xtw.writeStartElement(ELEMENT_TEXT);
                    xtw.writeCharacters(container.getOutputEntry().getText());
                    xtw.writeEndElement();

                    xtw.writeEndElement();
                }

                xtw.writeEndElement();
            }

            xtw.writeEndElement();

            xtw.writeEndElement();
        }

        // end definitions root element
        xtw.writeEndElement();
        xtw.writeEndDocument();

        xtw.flush();

        outputStream.close();

        xtw.close();

        return outputStream.toByteArray();

    } catch (Exception e) {
        LOGGER.error("Error writing BPMN XML", e);
        throw new DmnXMLException("Error writing BPMN XML", e);
    }
}

From source file:org.apache.axiom.om.impl.serialize.StreamingOMSerializer.java

/**
 * @param reader//from w  ww  .  ja  v a  2 s  . c o m
 * @param writer
 * @throws XMLStreamException
 */
protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
    writer.writeCharacters(reader.getText());
}

From source file:org.apache.axis2.databinding.utils.ConverterUtil.java

/**
 * this method writes the xsi:type attrubte and the value to the xmlstreamwriter
 * to serialize the anytype object/* w  w w . j  a v a2s. c  o m*/
 * @param type  - xsd type of the attribute
 * @param value - string value of the object
 * @param xmlStreamWriter
 * @throws XMLStreamException
 */
private static void serializeAnyType(String type, String value, XMLStreamWriter xmlStreamWriter)
        throws XMLStreamException {

    addTypeAttribute(xmlStreamWriter, type);
    xmlStreamWriter.writeCharacters(value);
}