code: public static void writeFullBeanXml(
          Object object, OutputStream outputStream)
      {
          XMLEncoder encoder = XmlEncoders.createVerbose(outputStream);
          encoder.setExceptionListener(new ExceptionListener()
          {
              @Override
              public void exceptionThrown(Exception e)
              {
                  throw new XmlException("Could not encode object", e);
              }
          });
          encoder.writeObject(object);
          encoder.flush();
          encoder.close();
      }
docs: Write the XML describing the given bean to the given output stream,
  as it is done by an <code>XMLEncoder</code>, but including all
  properties, even if they still have their default values. The
  caller is responsible for closing the given stream.
  
  @param object The bean object
  @param outputStream The stream to write to
  @throws XmlException If there is an error while encoding the object