Write the object to XML format
186459
public void writeXml(String path, XMLOutputter doc) throws IOException {
    doc.startTag(RemoteException.class.getSimpleName());
    doc.attribute("path", path);
    doc.attribute("class", getClassName());
    String msg = getLocalizedMessage();
    int i = msg.indexOf("\n");
    if (i >= 0) {
      msg = msg.substring(0, i);
    }
    doc.attribute("message", msg.substring(msg.indexOf(":") + 1).trim());
    doc.endTag();
  }
1362993
def write(self, path):
        """"""
        with open(path, 'wb') as f:
            f.write(self.getXML())
176248
def write(self):
        

        none_type = type(None)

        # Format attributes for writing
        attrs = self.attribute_string()

        # Place holder if field value is NoneType
        for attr in self.__dict__.keys():
            if type(attr) == none_type:
                setattr(self, attr, '.')

        # Format entry for writing
        fstr = '{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}{9}'\
               .format(self.seqid, self.source, self.type, str(self.start),
                       str(self.end), self._score_str, self.strand, 
                       self.phase, attrs, os.linesep)

        return fstr
432918
function toXML(obj) {
  var xml = ''
  for (var prop in obj) {
    xml += `<${prop}>${obj[prop]}</${prop}>`
  }
  return xml
}
744049
def writePlistToString(rootObject):
    ''''''
    plistData, error = (
        NSPropertyListSerialization.
        dataFromPropertyList_format_errorDescription_(
            rootObject, NSPropertyListXMLFormat_v1_0, None))
    if plistData is None:
        if error:
            error = error.encode('ascii', 'ignore')
        else:
            error = "Unknown error"
        raise NSPropertyListSerializationException(error)
    else:
        return str(plistData)
1331119
def toxml(self):
        

        return '<With ' + \
          (' instance="{0}"'.format(self.instance) if self.instance else '') +\
          (' list="{0}"'.format(self.list) if self.list else '') + \
          (' index="{0}"'.format(self.index) if self.index else '') + \
          ' as="{1}"/>'.format(self.instance, self.as_)
844528
@Override
   public void writeXmlBody(Definition def, Writer out) throws IOException
   {
      writeConnectorVersion(out);

      int indent = 1;
      writeIndent(out, indent);
      out.write("<display-name>Display Name</display-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<vendor-name>Red Hat Inc</vendor-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<spec-version>1.0</spec-version>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<eis-type>Test RA</eis-type>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<version>0.1</version>");
      writeEol(out);

      writeIndent(out, indent);
      out.write("<resourceadapter>");
      writeEol(out);

      writeOutbound(def, out, indent + 1);

      writeIndent(out, indent);
      out.write("</resourceadapter>");
      writeEol(out);
      out.write("</connector>");
      writeEol(out);
   }
312483
function formatXML(xmltemplate, fields) {
            var params = {
                email: self.email,
                password: self.password,
                account: self.account,
                role: self.role
            };
            for (var i in fields) {
                params[i] = fields[i];
            }
            return format(xmltemplate, params);
        }
500315
def xml(self, indent=4, **kwargs):
        
        writer = StringIO()
        self.write(writer, indent=indent, **kwargs)
        return writer.getvalue()
68169
@Override
    public void writeToObject(Object object) {
        try {
            Method method = BeanUtils.getWriteMethod(object.getClass(), getName());
            if (method != null) {
                method.invoke(object, new Object[]{getValue()});
            }
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        } catch (IllegalArgumentException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
1119495
public void writeObject(Object object)
        throws IOException
    {
        if (object == null) {
            writeNull();
            return;
        }

        Serializer serializer;

        serializer = _serializerFactory.getSerializer(object.getClass());

        serializer.writeObject(object, this);
    }
331245
function(obj, options) {
        obj = this.toContext(obj);
        return OpenLayers.Format.XML.VersionedOGC.prototype.write.apply(this,
            arguments);
    }
205249
public void write() throws IOException {
        OutputStream outStream = null;
        XMLStreamWriter out = null;
        try {
            outStream = new FileOutputStream(jobFile);
            out = XMLOutputFactory.newInstance().createXMLStreamWriter(outStream, "UTF-8");
            out.writeStartDocument();
            out.writeStartElement(ELEMENT_JOB);
            for (final Map.Entry<String, Object> e: prop.entrySet()) {
                out.writeStartElement(ELEMENT_PROPERTY);
                out.writeAttribute(ATTRIBUTE_NAME, e.getKey());
                if (e.getValue() instanceof String) {
                    out.writeStartElement(ELEMENT_STRING);
                    out.writeCharacters(e.getValue().toString());
                    out.writeEndElement(); //string
                } else if (e.getValue() instanceof Set) {
                    out.writeStartElement(ELEMENT_SET);
                    final Set<?> s = (Set<?>) e.getValue();
                    for (final Object o: s) {
                        out.writeStartElement(ELEMENT_STRING);
                        out.writeCharacters(o.toString());
                        out.writeEndElement(); //string
                    }
                    out.writeEndElement(); //set
                } else if (e.getValue() instanceof Map) {
                    out.writeStartElement(ELEMENT_MAP);
                    final Map<?, ?> s = (Map<?, ?>) e.getValue();
                    for (final Map.Entry<?, ?> o: s.entrySet()) {
                        out.writeStartElement(ELEMENT_ENTRY);
                        out.writeAttribute(ATTRIBUTE_KEY, o.getKey().toString());
                        out.writeStartElement(ELEMENT_STRING);
                        out.writeCharacters(o.getValue().toString());
                        out.writeEndElement(); //string
                        out.writeEndElement(); //entry
                    }
                    out.writeEndElement(); //string
                } else {
                    out.writeStartElement(e.getValue().getClass().getName());
                    out.writeCharacters(e.getValue().toString());
                    out.writeEndElement(); //string
                }
                out.writeEndElement(); //property
            }
            out.writeStartElement(ELEMENT_FILES);
            for (final FileInfo i: files.values()) {
                out.writeStartElement(ELEMENT_FILE);
                if (i.src != null) {
                    out.writeAttribute(ATTRIBUTE_SRC, i.src.toString());
                }
                out.writeAttribute(ATTRIBUTE_URI, i.uri.toString());
                out.writeAttribute(ATTRIBUTE_PATH, i.file.getPath());
                if (i.result != null) {
                    out.writeAttribute(ATTRIBUTE_RESULT, i.result.toString());
                }
                if (i.format != null) {
                    out.writeAttribute(ATTRIBUTE_FORMAT, i.format);
                }
                try {
                    for (Map.Entry<String, Field> e: attrToFieldMap.entrySet()) {
                        final boolean v = e.getValue().getBoolean(i);
                        if (v) {
                            out.writeAttribute(e.getKey(), Boolean.TRUE.toString());
                        }
                    }
                } catch (final IllegalAccessException ex) {
                    throw new RuntimeException(ex);
                }
                out.writeEndElement(); //file
            }
            out.writeEndElement(); //files
            out.writeEndElement(); //job
            out.writeEndDocument();
        } catch (final IOException e) {
            throw new IOException("Failed to write file: " + e.getMessage());
        } catch (final XMLStreamException e) {
            throw new IOException("Failed to serialize job file: " + e.getMessage());
        } finally {
            if (out != null) {
                try {
                    out.close();
                } catch (final XMLStreamException e) {
                    throw new IOException("Failed to close file: " + e.getMessage());
                }
            }
            if (outStream != null) {
                try {
                    outStream.close();
                } catch (final IOException e) {
                    throw new IOException("Failed to close file: " + e.getMessage());
                }
            }
        }
        lastModified = jobFile.lastModified();
    }
1228289
def to_xml(node, pretty=False):
    
    fout = Sio()
    etree = et.ElementTree(node)

    etree.write(fout)
    xml = fout.getvalue()
    if pretty:
        xml = pretty_xml(xml, True)
    return xml
129224
public void write(EntityType type) throws ODataRenderException {

        LOG.debug("Writing type {} of type {}", type.getName(), type.getMetaType());
        try {
            xmlWriter.writeStartElement(ENTITY_TYPE);
            if (!isNullOrEmpty(type.getBaseTypeName())) {
                xmlWriter.writeAttribute(BASE_TYPE, type.getBaseTypeName());
            }
            if (type.isOpen()) {
                xmlWriter.writeAttribute(OPEN_TYPE, Boolean.toString(type.isOpen()));
            }
            if (type.hasStream()) {
                xmlWriter.writeAttribute(HAS_STREAM, Boolean.toString(type.hasStream()));
            }
            xmlWriter.writeAttribute(NAME, type.getName());
            if (type.isAbstract()) {
                xmlWriter.writeAttribute(ABSTRACT, "true");
            }
            xmlWriter.writeStartElement(ENTITY_TYPE_KEY);
            for (PropertyRef propertyRef : type.getKey().getPropertyRefs()) {
                xmlWriter.writeStartElement(PROPERTY_REF);
                xmlWriter.writeAttribute(NAME, propertyRef.getPath());
                xmlWriter.writeEndElement();
            }
            xmlWriter.writeEndElement();

            visitProperties(entityDataModel, type, property -> {
                try {
                    propertyWriter.write(property);
                } catch (XMLStreamException e) {
                    throw new ODataRenderException("Error while writing property: " + property.getName(), e);
                }
            });
            xmlWriter.writeEndElement();
        } catch (XMLStreamException e) {
            throw new ODataRenderException("Error while writing entity type: " + type.getName(), e);
        }

    }
1136165
@Override
    public final void xmlWriteRawOn(FormattedWriter writer, boolean callbackToItem) throws IOException
    {
        synchronized (_startLock)
        {
            if (_state == MessageStoreState.STATE_STARTED)
            {
                _xmlWriteRawOn(writer, callbackToItem);
            }
            else
            {
                writer.startTag(XML_MESSAGE_STORE);
                writer.indent();
                writer.newLine();
                writer.write(XML_CANNOT_BE_WRITTEN);
                writer.outdent();
                writer.newLine();
                writer.endTag(XML_MESSAGE_STORE);
            }
        }
    }
1220420
public void write(Writer out)
            throws XmlModelWriterException, IOException
    {
        try
        {
            DOMSource domSource = new DOMSource(_doc);
            StreamResult streamResult = new StreamResult(out);
            TransformerFactory tf = TransformerFactory.newInstance();
            tf.setAttribute("indent-number", new Integer(INDENT_LEN));
            Transformer serializer = tf.newTransformer();
            if (_publicID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, _publicID);
            }
            if (_systemID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, _systemID);
            }
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
            serializer.transform(domSource, streamResult);
        }
        catch (TransformerException e)
        {
            throw new XmlModelWriterException(e);
        }
    }