Ejemplo n.º 1
0
 /**
  * Creates a new DomElement object.
  *
  * @param contentType_QNAME the content type_ qname
  * @param class1 the class1
  * @param object the object
  * @param value the value
  * @return the element
  */
 private String createElement(
     String contentType_QNAME, Class<?> class1, Object object, Object value) {
   if (value != null) {
     StringWriter writer = new StringWriter();
     try {
       XmlSerializer serializer = XML_SERIALIZER_FACTORY.newSerializer();
       serializer.setOutput(writer);
       serializer = serializer.startTag(null, contentType_QNAME);
       if (class1.equals(InviteConnectType.class)) {
         XppUtils.setElementValue(serializer, ((InviteConnectType) value).value());
       } else if (class1.equals(NetworkUpdateReturnType.class)) {
         XppUtils.setElementValue(serializer, ((NetworkUpdateReturnType) value).value());
       } else if (class1.equals(NetworkUpdateContentType.class)) {
         XppUtils.setElementValue(serializer, ((NetworkUpdateContentType) value).value());
       } else {
         XppUtils.setElementValue(serializer, String.valueOf(value));
       }
       serializer.endTag(null, contentType_QNAME);
       serializer.flush();
     } catch (Exception e) {
       LOG.log(Level.SEVERE, "An error occurred while creating xml content.", e);
     }
     return writer.toString();
   } else {
     return null;
   }
 }