Interface XmlManager

All Known Implementing Classes:
SpincastXmlManager

public interface XmlManager
Provides methods to work with XML strings and objects.
  • Method Details

    • toXml

      String toXml(Object obj)
      Converts an object to XML. If the object to convert is a JsonObject, its elements of type "JsonArray" will have a "isArray='true'" attribute added. This way, the XML can be deserialized back to a JsonObject correctly.
    • toXml

      String toXml(Object obj, boolean pretty)
      Converts an object to XML.
      Parameters:
      pretty - If true, the generated XML will be formatted.
    • fromXml

      JsonObject fromXml(String xml)
      Deserializes a XML to an JsonObject. This will correctly manage the XML generated by toXml(), arrays included.
    • fromXmlToJsonArray

      JsonArray fromXmlToJsonArray(String xml)
      Deserializes a XML to an JsonArray. This will correctly manage the XML generated by toXml(), arrays included.
    • fromXml

      <T> T fromXml(String xml, Class<T> clazz)
      Deserializes a XML to the given Class. Be aware that if you use a default Type like Map<String, Object>, the arrays will probably won't be deserialized correctly. Use the version returning a JsonObject to get the arrays to work out of the box!
    • fromXmlToType

      <T> T fromXmlToType(String xml, Type type)
      Deserializes a XML to the given Type. Be aware that if you use a default Type like Map<String, Object>, the arrays will probably won't be deserialized correctly. Use the version returning a JsonObject to get the arrays to work out of the box!
    • fromXmlInputStream

      <T> T fromXmlInputStream(InputStream inputStream, Class<T> clazz)
      Deserializes a XML inputstream to the given Type. Be aware that if you use a default Type like Map<String, Object>, the arrays will probably won't be deserialized correctly. Use the version returning a JsonObject to get the arrays to work out of the box!