Package org.spincast.core.xml
Interface XmlManager
- All Known Implementing Classes:
SpincastXmlManager
public interface XmlManager
Provides methods to work with
XML strings and objects.-
Method Summary
Modifier and TypeMethodDescriptionDeserializes a XML to anJsonObject.<T> TDeserializes a XML to the given Class.<T> TfromXmlInputStream(InputStream inputStream, Class<T> clazz) Deserializes a XML inputstream to the given Type.fromXmlToJsonArray(String xml) Deserializes a XML to anJsonArray.<T> TfromXmlToType(String xml, Type type) Deserializes a XML to the given Type.Converts an object to XML.Converts an object to XML.
-
Method Details
-
toXml
Converts an object to XML. If the object to convert is aJsonObject, its elements of type "JsonArray" will have a "isArray='true'" attribute added. This way, the XML can be deserialized back to aJsonObjectcorrectly. -
toXml
Converts an object to XML.- Parameters:
pretty- Iftrue, the generated XML will be formatted.
-
fromXml
Deserializes a XML to anJsonObject. This will correctly manage the XML generated by toXml(), arrays included. -
fromXmlToJsonArray
Deserializes a XML to anJsonArray. This will correctly manage the XML generated by toXml(), arrays included. -
fromXml
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 aJsonObjectto get the arrays to work out of the box! -
fromXmlToType
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 aJsonObjectto get the arrays to work out of the box! -
fromXmlInputStream
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 aJsonObjectto get the arrays to work out of the box!
-