List of usage examples for javax.xml.stream XMLStreamWriter writeStartElement
public void writeStartElement(String localName) throws XMLStreamException;
From source file:com.fiorano.openesb.application.application.PortInstance.java
protected void toJXMLString_1(XMLStreamWriter writer, boolean writeSchema) throws XMLStreamException, FioranoException { if (proxyUsed || !StringUtils.isEmpty(proxyURL) || !ANONYMOUS.equals(proxyUser) || !ANONYMOUS.equals(proxyPassword)) { writer.writeStartElement(ELEM_PROXY); {//from w w w .j a v a 2 s. co m if (proxyUsed) writer.writeAttribute(ATTR_PROXY_USED, String.valueOf(proxyUsed)); writeAttribute(writer, ATTR_PROXY_URL, proxyURL); if (!ANONYMOUS.equals(proxyUser) || !ANONYMOUS.equals(proxyPassword)) { writer.writeStartElement(ELEM_AUTHENTICATION); { if (!ANONYMOUS.equals(proxyUser)) writer.writeAttribute(ATTR_PROXY_USER, proxyUser); if (!ANONYMOUS.equals(proxyPassword)) writer.writeAttribute(ATTR_PROXY_PASSWORD, proxyPassword); } writer.writeEndElement(); } } writer.writeEndElement(); } writer.writeStartElement(ELEM_JMS); { writeAttribute(writer, ATTR_CLIENT_ID, clientID); if (!enabled) writer.writeAttribute(ATTR_ENABLED, String.valueOf(enabled)); if (writeSchema || destinationConfigName == null) { writer.writeStartElement(ELEM_DESTINATION); { if (destinationType != getDefaultDestinationType()) writer.writeAttribute(ATTR_DESTINATION_TYPE, String.valueOf(destinationType)); if (specifiedDestinationUsed) writer.writeAttribute(ATTR_SPECIFIED_DESTINATION_USED, String.valueOf(specifiedDestinationUsed)); writeAttribute(writer, ATTR_DESTINATION, destination); if (isDestinationEncrypted) { writer.writeAttribute(IS_DESTINATION_ENCRYPTED, String.valueOf(isDestinationEncrypted)); writer.writeAttribute(DESTINATION_ENCRYPT_ALGO, encryptionAlgorithm); if (encryptionKey == null || encryptionKey.equals("")) writer.writeAttribute(DESTINATION_ENCRYPT_KEY, ""); else writer.writeAttribute(DESTINATION_ENCRYPT_KEY, encryptionKey); writer.writeAttribute(DESTINATION_ALLOW_PADDING_TO_KEY, String.valueOf(allowPaddingToKey)); writer.writeAttribute(DESTINATION_INITIALIZATION_VECTOR, initializationVector); } } writer.writeEndElement(); } else if (destinationConfigName != null) { writer.writeStartElement(ELEM_DESTINATION_CONFIG_NAME); writer.writeAttribute(ATTR_NAME, destinationConfigName); writer.writeEndElement(); } if (!StringUtils.isEmpty(securityManager) || !ANONYMOUS.equals(user) || !ANONYMOUS.equals(password)) { writer.writeStartElement(ELEM_AUTHENTICATION); { writeAttribute(writer, ATTR_SECURITY_MANAGER, securityManager); if (!ANONYMOUS.equals(user)) writer.writeAttribute(ATTR_USER, user); if (!ANONYMOUS.equals(password)) writer.writeAttribute(ATTR_PASSWORD, password); } writer.writeEndElement(); } toJXMLString_2(writer, writeSchema); } writer.writeEndElement(); if ((writeSchema || workflowConfigName == null)) { // We need to write port properties to stream when passing application launch packet to peer writer.writeStartElement(ELEM_WORKFLOW); writer.writeAttribute(ATTR_WORKFLOW_TYPE, String.valueOf(workflow)); writer.writeAttribute(ATTR_WORKFLOW_DATATYPE, String.valueOf(workflowDataType)); writer.writeAttribute(ATTR_CALLOUT_ENABLED, String.valueOf(calloutEnabled)); for (DBCallOutParameter dbCallOutParameter : dbCallOutParameterList) { dbCallOutParameter.toJXMLString(writer); } writer.writeEndElement(); } else if (workflowConfigName != null) { writer.writeStartElement(ELEM_WORKFLOW_CONFIG_NAME); writer.writeAttribute(ATTR_NAME, workflowConfigName); writer.writeEndElement(); } if ((writeSchema || messageFilterConfigName == null) && (isMessageFilterSet)) { writer.writeStartElement(ELEM_MESSAGE_FILTERS); for (Iterator itr = messageFilters.entrySet().iterator(); itr.hasNext();) { Map.Entry entry = (Map.Entry) itr.next(); writer.writeStartElement(ELEM_MESSAGE_FILTER); writer.writeAttribute(ATTR_MESSAGE_FILTER_NAME, (String) entry.getKey()); writer.writeAttribute(ATTR_MESSAGE_FILTER_VALUE, (String) entry.getValue()); writer.writeEndElement(); } writer.writeEndElement(); } else if (messageFilterConfigName != null) { writer.writeStartElement(ELEM_MESSAGE_FILTER_CONFIG_NAME); writer.writeAttribute(ATTR_NAME, messageFilterConfigName); writer.writeEndElement(); } if (!appContextAction.equalsIgnoreCase(NO_ACTION_APP_CONTEXT)) { writer.writeStartElement(ELEM_APP_CONTEXT_ACTION); writer.writeCharacters(appContextAction); writer.writeEndElement(); } toJXMLString_3(writer, writeSchema); }
From source file:org.gaul.s3proxy.S3ProxyHandler.java
private static void writeSimpleElement(XMLStreamWriter xml, String elementName, String characters) throws XMLStreamException { xml.writeStartElement(elementName);/*from w ww . j a v a 2s . c om*/ xml.writeCharacters(characters); xml.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Creates the profileApplication tag at the end of the model tag. * // w ww .java2 s . co m * @param writer * {@link XMLStreamWriter} of the current XMI file * @throws XMLStreamException */ private void createProfileApplication(XMLStreamWriter writer) throws XMLStreamException { // start profileApplication writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_PROFILEAPPLICATION); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.PROFILEAPPLICATION_TYPE_VALUE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, XMIConstants4SchemaGraph2XMI.TAG_PROFILEAPPLICATION + System.currentTimeMillis()); // create content createExtension(writer, null, null); // create appliedProfile writer.writeEmptyElement(XMIConstants4SchemaGraph2XMI.TAG_APPLIEDPROFILE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.APPLIEDPROFILE_TYPE_VALUE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_HREF, XMIConstants4SchemaGraph2XMI.APPLIEDPROFILE_HREF_VALUE); // end profileApplication writer.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Defines all attributes of type {@link DoubleDomain}, {@link LongDomain}, * {@link MapDomain} or {@link CollectionDomain} which are used in the * {@link SchemaGraph} i.e. contained in * {@link SchemaGraph2XMI#typesToBeDeclaredAtTheEnd}. These definitions are * created in a new UML package, called <code>PrimitiveTypes</code>. This is * necessary because those {@link Domain}s are not UML primitive types and * are not represented by an own <code>packagedElement</code> in the XMI * file./*from w w w .j ava2 s .c o m*/ * * @param writer * {@link XMLStreamWriter} of the current XMI file * @throws XMLStreamException */ private void createTypes(XMLStreamWriter writer) throws XMLStreamException { // start packagedElement writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_PACKAGEDELEMENT); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.PACKAGEDELEMENT_TYPE_VALUE_PACKAGE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, XMIConstants4SchemaGraph2XMI.PACKAGE_PRIMITIVETYPES_NAME); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_NAME, XMIConstants4SchemaGraph2XMI.PACKAGE_PRIMITIVETYPES_NAME); // create entries for domains, which are not defined for (Domain domain : typesToBeDeclaredAtTheEnd) { writer.writeEmptyElement(XMIConstants4SchemaGraph2XMI.TAG_PACKAGEDELEMENT); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.TYPE_VALUE_PRIMITIVETYPE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, domain.get_qualifiedName().replaceAll("\\s", "").replaceAll("<", "_").replaceAll(">", "_")); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_NAME, extractSimpleName(domain.get_qualifiedName())); } // end packagedElement writer.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Creates the representation of the {@link RecordDomain} * <code>recordDomain</code>. This representation consists of an UML class * with stereotype <code><<record>></code>. The components of * <code>recordDomain</code> are represented as attributes of the generated * UML class. Further more all {@link Comment}s attached to * <code>recordDomain</code> are created. * //from w w w . j ava 2 s . c o m * @param writer * {@link XMLStreamWriter} of the current XMI file * @param recordDomain * {@link RecordDomain} the current {@link RecordDomain} * @throws XMLStreamException */ private void createRecordDomain(XMLStreamWriter writer, RecordDomain recordDomain) throws XMLStreamException { // start packagedElement writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_PACKAGEDELEMENT); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.PACKAGEDELEMENT_TYPE_VALUE_CLASS); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, recordDomain.get_qualifiedName()); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_NAME, extractSimpleName(recordDomain.get_qualifiedName())); // create stereotype <<record>> createExtension(writer, recordDomain, "record"); // create comments createComments(writer, recordDomain); // create attributes for (HasRecordDomainComponent hrdc : recordDomain .getHasRecordDomainComponentIncidences(EdgeDirection.OUT)) { createAttribute(writer, hrdc.get_name(), null, (Domain) hrdc.getThat(), recordDomain.get_qualifiedName() + "_" + hrdc.get_name()); } // end packagededElement writer.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Creates the representation of the {@link EnumDomain} * <code>EnumDomain</code>. This representation is a UML enumeration with * stereotype <code><<record>></code>. The constants of * <code>enumDomain</code> are represented as constants of the generated UML * enumeration. Further more all {@link Comment}s attached to * <code>enumDomain</code> are created. * //w w w. ja va 2 s .co m * @param writer * {@link XMLStreamWriter} of the current XMI file * @param enumDomain * {@link EnumDomain} the current {@link EnumDomain} * @throws XMLStreamException */ private void createEnum(XMLStreamWriter writer, EnumDomain enumDomain) throws XMLStreamException { // start packagedElement writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_PACKAGEDELEMENT); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.PACKAGEDELEMENT_TYPE_VALUE_ENUMERATION); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, enumDomain.get_qualifiedName()); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_NAME, extractSimpleName(enumDomain.get_qualifiedName())); // create comments createComments(writer, enumDomain); // create enumeration constants for (String enumConst : enumDomain.get_enumConstants()) { // create ownedLiteral writer.writeEmptyElement(XMIConstants4SchemaGraph2XMI.TAG_OWNEDLITERAL); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.OWNEDLITERAL_TYPE_VALUE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, enumDomain.get_qualifiedName() + "_" + enumConst); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.ATTRIBUTE_NAME, enumConst); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.OWNEDLITERAL_ATTRIBUTE_CLASSIFIER, enumDomain.get_qualifiedName()); } // end packagedElement writer.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Creates the representation of one comment. * //from ww w.ja v a 2 s . c o m * @param writer * {@link XMLStreamWriter} of the current XMI file * @param comment * {@link Comment} which should be represented * @param id * {@link String} the id of the created <code>ownedComment</code> * tag, which represents <code>comment</code> * @param annotatedElement * {@link String} qualified name of the {@link NamedElement} * which is commented * @throws XMLStreamException */ private void createComment(XMLStreamWriter writer, Comment comment, String id, String annotatedElement) throws XMLStreamException { // start ownedComment writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_OWNEDCOMMENT); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.OWNEDCOMMENT_TYPE_VALUE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, id); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.OWNEDCOMMENT_ATTRIBUTE_ANNOTATEDELEMENT, annotatedElement); // start body writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_BODY); // write content writer.writeCharacters(XMIConstants4SchemaGraph2XMI.COMMENT_START + comment.get_text().replaceAll(Pattern.quote("\n"), XMIConstants4SchemaGraph2XMI.COMMENT_NEWLINE) + XMIConstants4SchemaGraph2XMI.COMMENT_END); // end body writer.writeEndElement(); // end ownedComment writer.writeEndElement(); }
From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.SchemaGraph2XMI.java
/** * Creates an constraint with the content <code>constraintContent</code>. * /*from w w w .ja v a 2 s .c o m*/ * @param writer * {@link XMLStreamWriter} of the current XMI file * @param constraintContent * {@link String} the content of the constraint which will be * created * @param id * {@link String} the id of the created <code>ownedRule</code> * tag, which represents <code>constraint</code> * @param constrainedElement * {@link String} qualified name of the * {@link AttributedElementClass} which is constrained * @throws XMLStreamException */ private void createConstraint(XMLStreamWriter writer, String constraintContent, String id, String constrainedElement) throws XMLStreamException { // start ownedRule writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_OWNEDRULE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.OWNEDRULE_TYPE_VALUE); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, id); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.OWNEDRULE_ATTRIBUTE_CONSTRAINEDELEMENT, constrainedElement); // start specification writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_SPECIFICATION); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_TYPE, XMIConstants4SchemaGraph2XMI.TYPE_VALUE_OPAQUEEXPRESSION); writer.writeAttribute(XMIConstants4SchemaGraph2XMI.NAMESPACE_XMI, XMIConstants4SchemaGraph2XMI.XMI_ATTRIBUTE_ID, id + "_" + XMIConstants4SchemaGraph2XMI.TAG_SPECIFICATION); // start and end language writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_LANGUAGE); writer.writeEndElement(); // start body writer.writeStartElement(XMIConstants4SchemaGraph2XMI.TAG_BODY); writer.writeCharacters(constraintContent); // end body writer.writeEndElement(); // end specification writer.writeEndElement(); // end ownedRule writer.writeEndElement(); }
From source file:com.fiorano.openesb.application.aps.Route.java
public void toJXMLString(XMLStreamWriter writer) throws XMLStreamException { //Start Route writer.writeStartElement("Route"); //Add Route Attributes writer.writeAttribute("isP2PRoute", "" + m_isP2PRoute); writer.writeAttribute("isPersistant", "" + m_isPersitant); writer.writeAttribute("isDurable", "" + m_isDurable); writer.writeAttribute("applyTransformationAtSrc", "" + m_applyTransformationAtSrc); //Name//w w w . j ava 2s . c om FioranoStackSerializer.writeElement("Name", m_routeName, writer); //RouteGuid FioranoStackSerializer.writeElement("RouteGUID", m_routeGUID, writer); //TimeToLive FioranoStackSerializer.writeElement("TimeToLive", "" + m_iTimeToLive, writer); //SrcServiceInstance FioranoStackSerializer.writeElement("SrcServiceInstance", m_srcServInst, writer); //SrcPort FioranoStackSerializer.writeElement("SrcPort", m_srcPortName, writer); //TransformationXSL if (m_transformationXSL != null) { writer.writeStartElement("TransformationXSL"); writer.writeCData(m_transformationXSL); writer.writeEndElement(); } //Selectors if (m_selectors != null) { Iterator itr = m_selectors.keySet().iterator(); while (itr.hasNext()) { writer.writeStartElement("Selector"); String type = (String) itr.next(); writer.writeAttribute("type", type); Object val = m_selectors.get(type); String value = null; if (val instanceof String) { value = (String) m_selectors.get(type); } else if (val instanceof XPathDmi) { value = ((XPathDmi) val).getXPath(); HashMap map = ((XPathDmi) val).getNameSpace(); if (map != null) { Set keys = map.keySet(); Iterator iter = keys.iterator(); while (iter.hasNext()) { String key = (String) iter.next(); String keyval = (String) map.get(key); writer.writeAttribute("esb_" + key, keyval); } } } writer.writeCharacters(value); //End Selector writer.writeEndElement(); } } //TgtServiceInstance FioranoStackSerializer.writeElement("TgtServiceInstance", m_trgtServInst, writer); //TgtPort FioranoStackSerializer.writeElement("TgtPort", m_trgtPortName, writer); //LongDescription if (!StringUtils.isEmpty(m_longDescription)) { FioranoStackSerializer.writeElement("LongDescription", m_longDescription, writer); } //ShortDescription if (!StringUtils.isEmpty(m_shortDescription)) { FioranoStackSerializer.writeElement("ShortDescription", m_shortDescription, writer); } if (m_altDestination != null) { m_altDestination.toJXMLString(writer); } if (m_params != null && m_params.size() > 0) { Enumeration enums = m_params.elements(); while (enums.hasMoreElements()) { Param param = (Param) enums.nextElement(); if (!StringUtils.isEmpty(param.getParamName()) && !StringUtils.isEmpty(param.getParamValue())) param.toJXMLString(writer); } } //End Route writer.writeEndElement(); }
From source file:ca.uhn.fhir.parser.XmlParser.java
private void encodeExtension(IBaseResource theResource, XMLStreamWriter theEventWriter, boolean theContainedResource, CompositeChildElement nextChildElem, BaseRuntimeChildDefinition nextChild, IBase nextValue, String childName, String extensionUrl, BaseRuntimeElementDefinition<?> childDef) throws XMLStreamException { BaseRuntimeDeclaredChildDefinition extDef = (BaseRuntimeDeclaredChildDefinition) nextChild; if (extDef.isModifier()) { theEventWriter.writeStartElement("modifierExtension"); } else {/* w w w.ja va 2 s. c o m*/ theEventWriter.writeStartElement("extension"); } String elementId = getCompositeElementId(nextValue); if (isNotBlank(elementId)) { theEventWriter.writeAttribute("id", elementId); } theEventWriter.writeAttribute("url", extensionUrl); encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, null, theContainedResource, nextChildElem); theEventWriter.writeEndElement(); }