Lets say we want to serialize an EObject to XML. The code is given below. This will print the XML to the error stream.

            EObject eObject = ...;
            Resource resource = new XMLResourceImpl();
            resource.getContents().add(eObject);
            Map options = new HashMap();
            options.put(XMLResource.OPTION_ENCODING, "UTF-8");
            options.put(XMLResource.OPTION_XML_VERSION, "1.0");
            new XMLProcessor().save(System.err, resource, options);