Serializes descriptor instance to XML
@param descriptor descriptor to be serialized
@return xml representation of descriptor as string
326537
public static String toXml(DeploymentDescriptor descriptor) {
        try {

            Marshaller marshaller = getContext().createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
            marshaller.setProperty(Marshaller.JAXB_SCHEMA_LOCATION, "http://www.jboss.org/jbpm deployment-descriptor.xsd");
            marshaller.setSchema(schema);
            StringWriter stringWriter = new StringWriter();

            // clone the object and cleanup transients
            DeploymentDescriptor clone = ((DeploymentDescriptorImpl) descriptor).clearClone();

            marshaller.marshal(clone, stringWriter);
            String output = stringWriter.toString();

            return output;
        } catch (Exception e) {
            throw new RuntimeException("Unable to generate xml from deployment descriptor", e);
        }
    }
588398
def to_xml_string(str = '')
      str << '<dxf>'
      # Dxf elements have no attributes. All of the instance variables
      # are child elements.
      CHILD_ELEMENTS.each do |element|
        self.send(element).to_xml_string(str) if self.send(element)
      end
      str << '</dxf>'
    end
412006
public static String ObjectToXml(Object object) throws JAXBException {
        JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
        Marshaller marshaller = jaxbContext.createMarshaller();
        StringWriter sw = new StringWriter();
        marshaller.marshal(object, sw);
        return sw.toString();
    }
197731
protected static String serialize(Serializable serializable) throws JMSException {
        if (serializable == null) {
            return null;
        }
        String serializedString;
        ObjectOutputStream objectOutputStream = null;
        try {
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            objectOutputStream = new ObjectOutputStream(bytesOut);
            objectOutputStream.writeObject(serializable);
            objectOutputStream.flush();
            serializedString = Base64.encodeAsString(bytesOut.toByteArray());
        } catch (IOException e) {
            LOG.error("IOException: cannot serialize objectMessage", e);
            throw convertExceptionToMessageFormatException(e);
        } finally {
            if (objectOutputStream != null) {
                try {
                    objectOutputStream.close();
                } catch (IOException e) {
                    LOG.warn(e.getMessage());
                }
            }
        }
        return serializedString;
    }
1187939
public static String getDescriptor(final Class<?> c) {
		StringBuilder sb = new StringBuilder();
        getDescriptor(sb, c);
        return sb.toString();
    }
18872
public static String marshal(Object jaxbElement) {
        StringWriter sw ;
        try {
            Marshaller fm = JAXBContext.newInstance(jaxbElement.getClass()).createMarshaller();
            fm.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            sw = new StringWriter();
            fm.marshal(jaxbElement, sw);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        }
        return sw.toString();
    }
1159018
private static void appendDescriptor(final StringBuilder stringBuilder, final Class<?> clazz) {
    Class<?> currentClass = clazz;
    while (currentClass.isArray()) {
      stringBuilder.append('[');
      currentClass = currentClass.getComponentType();
    }
    if (currentClass.isPrimitive()) {
      char descriptor;
      if (currentClass == Integer.TYPE) {
        descriptor = 'I';
      } else if (currentClass == Void.TYPE) {
        descriptor = 'V';
      } else if (currentClass == Boolean.TYPE) {
        descriptor = 'Z';
      } else if (currentClass == Byte.TYPE) {
        descriptor = 'B';
      } else if (currentClass == Character.TYPE) {
        descriptor = 'C';
      } else if (currentClass == Short.TYPE) {
        descriptor = 'S';
      } else if (currentClass == Double.TYPE) {
        descriptor = 'D';
      } else if (currentClass == Float.TYPE) {
        descriptor = 'F';
      } else if (currentClass == Long.TYPE) {
        descriptor = 'J';
      } else {
        throw new AssertionError();
      }
      stringBuilder.append(descriptor);
    } else {
      stringBuilder.append('L');
      String name = currentClass.getName();
      int nameLength = name.length();
      for (int i = 0; i < nameLength; ++i) {
        char car = name.charAt(i);
        stringBuilder.append(car == '.' ? '/' : car);
      }
      stringBuilder.append(';');
    }
  }
441963
def to_xml_string(str = '')
      str << '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
      str << ('<xdr:wsDr xmlns:xdr="' << XML_NS_XDR << '" xmlns:a="' << XML_NS_A << '">')
      anchors.each { |anchor| anchor.to_xml_string(str) }
      str << '</xdr:wsDr>'
    end
649228
public void setDescriptor(String descriptor)
  {
    _descriptor = descriptor;

    if (_isWrite)
      _jClass.getConstantPool().addUTF8(descriptor);
  }
402886
private void unmarshalDescriptor() throws CmsXmlException, CmsException {

        if (null != m_desc) {

            // unmarshal descriptor
            m_descContent = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_desc));

            // configure messages if wanted
            CmsProperty bundleProp = m_cms.readPropertyObject(m_desc, PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION, true);
            if (!(bundleProp.isNullProperty() || bundleProp.getValue().trim().isEmpty())) {
                m_configuredBundle = bundleProp.getValue();
            }
        }

    }
674238
function serializeToXRD(descriptor) {
  var xml = '<?xml version="1.0" encoding="UTF-8"?>';
  xml += '<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';

  if (descriptor.expires) {
    xml += '<Expires>' + xsdDateTimeString(descriptor.expires) + '</Expires>';
  }

  if (descriptor.subject) {
    xml += '<Subject>' + descriptor.subject + '</Subject>';
  }

  descriptor.aliases.forEach(function(alias) {
    xml += '<Alias>' + alias + '</Alias>';
  });

  descriptor.properties.forEach(function(key, value) {
    if (value) {
      xml += '<Property type="' + key + '">' + value + '</Property>';
    } else {
      xml += '<Property type="' + key + '" xsi:nil="true" />';
    }
  });

  descriptor.links.forEach(function(link) {
    xml += '<Link';
    if (link.rel) { xml += ' rel="' + link.rel + '"'; }
    if (link.href) { xml += ' href="' + link.href + '"'; }
    if (link.template) { xml += ' template="' + link.template + '"'; }
    if (link.type) { xml += ' type="' + link.type + '"'; }
    xml += '>';
  
    link.titles.forEach(function(lang, title) {
      if (lang === '_') {
        xml += '<Title>' + title + '</Title>';
      } else {
        xml += '<Title xml:lang="' + lang + '">' + title + '</Title>';
      }
    });
  
    link.properties.forEach(function(key, value) {
      if (value) {
        xml += '<Property type="' + key + '">' + value + '</Property>';
      } else {
        xml += '<Property type="' + key + '" xsi:nil="true" />';
      }
    });
  
    xml += '</Link>';
  });

  xml += '</XRD>';

  return xml;
}
302044
public <T> String write(final T object, final DataTypeDescriptor<T> descriptor,
			final boolean indent) throws IOException {
		if (descriptor == null) throw new NullPointerException("descriptor");

		StringWriter out = new StringWriter();
		JsonGenerator generator = factory.createGenerator(out);
		if (indent) {
			generator.useDefaultPrettyPrinter();
		}

		write(object, descriptor, generator);
		generator.flush();
		return out.toString();
	}
783716
public String serialize()
   {
      StringBuilder buffer = new StringBuilder("<webservice-description>");
      buffer.append("<webservice-description-name>").append(webserviceDescriptionName).append("</webservice-description-name>");
      buffer.append("<wsdl-file>").append(wsdlFile).append("</wsdl-file>");
      buffer.append("<jaxrpc-mapping-file>").append(jaxrpcMappingFile).append("</jaxrpc-mapping-file>");
      for (PortComponentMetaData pm : portComponents)
         buffer.append(pm.serialize());
      buffer.append("</webservice-description>");
      return buffer.toString();
   }
826833
public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }
1132970
public static <T> TableSink<T> findAndCreateTableSink(Descriptor descriptor) {
		Map<String, String> properties = descriptor.toProperties();

		TableSink tableSink;
		try {
			tableSink = TableFactoryService
				.find(TableSinkFactory.class, properties)
				.createTableSink(properties);
		} catch (Throwable t) {
			throw new TableException("findAndCreateTableSink failed.", t);
		}

		return tableSink;
	}
1186125
public static PropertyIdentifier getIdentifier(final ConfigDescriptor descriptor)
    {
        checkNotNull(descriptor);
        return new PropertyIdentifierImpl(descriptor.getConfigName(), descriptor.getMethod().getDeclaringClass());
    }
318155
public String toXML()
    {
        RepositoryTags tags = RepositoryTags.getInstance();
        String eol = System.getProperty("line.separator");

        // comment on class
        StringBuffer result = new StringBuffer(1024);
        result.append( eol);
        result.append( "  <!-- Mapping for Class ");
        result.append( this.getClassNameOfObject());
        result.append( " -->");
        result.append( eol );

        // opening tag and attributes
        result.append( "  ");
        result.append( tags.getOpeningTagNonClosingById(CLASS_DESCRIPTOR));
        result.append( eol );

        // class
        result.append( "    ");
        result.append( tags.getAttribute(CLASS_NAME, this.getClassNameOfObject()));
        result.append( eol );

        // isolation level is optional
        if (null != getRepository())
        {
            if (getIsolationLevel() != this.getRepository().getDefaultIsolationLevel())
            {
                result.append( "    ");
                result.append( tags.getAttribute(ISOLATION_LEVEL, this.isolationLevelXml()) );
                result.append( eol );
            }
        }

        Class theProxyClass = null;
        try
        {
            theProxyClass = this.getProxyClass();
        }
        catch (Throwable t)
        {
            // Ignore this exception, just try to get the Class object of the
            // proxy class in order to be able to decide, whether the class
            // is a dynamic proxy or not.
        }

        // proxy is optional
        if (theProxyClass != null)
	{
	    if (isDynamicProxy())   // tomdz: What about VirtualProxy ?
            {
        	result.append( "    ");
                result.append( tags.getAttribute(CLASS_PROXY, DYNAMIC_STR));
                result.append( eol );
    	    }
            else
	    {
    	        result.append( "    ");
            result.append( tags.getAttribute(CLASS_PROXY, this.getProxyClassName()));
            result.append( eol );
            }
            result.append( "        ");
        result.append( tags.getAttribute(PROXY_PREFETCHING_LIMIT, "" + this.getProxyPrefetchingLimit()));
        result.append( eol );
	}

        // schema is optional
        if (this.getSchema() != null)
        {
            result.append( "    ");
            result.append( tags.getAttribute(SCHEMA_NAME, this.getSchema()));
            result.append( eol );
        }

        // table name
        if (this.getTableName() != null)
        {
            result.append("    ");
            result.append( tags.getAttribute(TABLE_NAME, this.getTableName()));
            result.append( eol );
        }

        // rowreader is optional
        if (this.getRowReaderClassName() != null)
        {
            result.append( "    ");
            result.append( tags.getAttribute(ROW_READER, this.getRowReaderClassName()));
            result.append( eol );
        }

        //accept-locks is optional, enabled by default
        if (!this.acceptLocks)
        {
            result.append( "        ");
            result.append( tags.getAttribute(ACCEPT_LOCKS, "false"));
            result.append( eol );
        }
        // sequence manager attribute not yet implemented

        // initialization method is optional
        if (this.getInitializationMethod() != null)
        {
            result.append( "    ");
            result.append( tags.getAttribute(INITIALIZATION_METHOD, this.getInitializationMethod().getName()));
            result.append( eol );
        }

        // factory class is optional
        if (this.getFactoryClass() != null)
        {
            result.append( "    ");
            result.append( tags.getAttribute(FACTORY_CLASS, this.getFactoryClass().getName()) );
            result.append( eol );
        }

        //	factory method is optional
        if (this.getFactoryMethod() != null)
        {
            result.append( "    ");
            result.append( tags.getAttribute(FACTORY_METHOD, this.getFactoryMethod().getName()) );
            result.append( eol );
        }

        //reference refresh is optional, disabled by default
        if (isAlwaysRefresh())
        {
            result.append( "    ");
            result.append( tags.getAttribute(REFRESH, "true"));
            result.append( eol );
        }

        result.append( "  >");
        result.append( eol );

        // end of attributes

        // begin of elements
        if (isInterface())
        {
            // extent-class
            for (int i = 0; i < getExtentClassNames().size(); i++)
            {
                result.append( "      ");
                result.append( tags.getOpeningTagNonClosingById(CLASS_EXTENT));
                result.append( " " );
                result.append( tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
                result.append( " />");
                result.append( eol );
            }
        }
        else
        {
            // class extent is optional
            if (isExtent())
            {
                for (int i = 0; i < getExtentClassNames().size(); i++)
                {
                    result.append( "      ");
                    result.append( tags.getOpeningTagNonClosingById(CLASS_EXTENT));
                    result.append( " " );
                    result.append( tags.getAttribute(CLASS_REF, getExtentClassNames().get(i).toString()) );
                    result.append( " />");
                    result.append( eol );
                }
            }

            // write all FieldDescriptors
            FieldDescriptor[] fields = getFieldDescriptions();
            for (int i = 0; i < fields.length; i++)
            {
                result.append( fields[i].toXML() );
            }

            // write optional ReferenceDescriptors
            Vector refs = getObjectReferenceDescriptors();
            for (int i = 0; i < refs.size(); i++)
            {
                result.append( ((ObjectReferenceDescriptor) refs.get(i)).toXML() );
            }

            // write optional CollectionDescriptors
            Vector cols = getCollectionDescriptors();
            for (int i = 0; i < cols.size(); i++)
            {
                result.append( ((CollectionDescriptor) cols.get(i)).toXML() );
            }

            // write optional IndexDescriptors
            for (int i = 0; i < indexes.size(); i++)
            {
                IndexDescriptor indexDescriptor = (IndexDescriptor) indexes.elementAt(i);
                result.append( indexDescriptor.toXML() );
            }

            // Write out the procedures
            if (this.getInsertProcedure() != null)
            {
                result.append( this.getInsertProcedure().toXML() );
            }
            if (this.getUpdateProcedure() != null)
            {
                result.append( this.getUpdateProcedure().toXML() );
            }
            if (this.getDeleteProcedure() != null)
            {
                result.append( this.getDeleteProcedure().toXML() );
            }
        }
        result.append( "  ");
        result.append( tags.getClosingTagById(CLASS_DESCRIPTOR) );
        return result.toString();
    }