code: private static void serializeObject(final Object obj, final ContentHandler handler) throws SAXException {
      if (obj instanceof Map) {
        serializeMap((Map) obj, handler);
      } else if (obj instanceof List) {
        serializeList((List) obj, handler);
      } else if (obj instanceof Number) {
        if (obj instanceof Double || obj instanceof Float) {
          serializeReal((Number) obj, handler);
        } else {
          serializeInteger((Number) obj, handler);
        }
      } else if (obj instanceof Boolean) {
        serializeBoolean((Boolean) obj, handler);
      } else {
        serializeString(String.valueOf(obj), handler);
      }
    }
docs: Serialize an object using the best available element.
  
  @param obj
  object to serialize.
  @param handler
  destination of serialization events.
  @throws SAXException
  if exception during serialization.