public final class XmlUtility
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.io.Serializable> |
create(java.lang.String xml,
java.lang.Class<T> classType)
Helper method to de-serialize XML to an object.
|
static java.lang.String |
descapeStringForXml(java.lang.String valueToDeserialize)
Helper method to decode a string from XML string
Returns the same string if null or empty
|
static java.lang.String |
escapeStringForXml(java.lang.String valueToSerialize)
Helper method to encode a string to XML
Returns the same string if null or empty
|
static java.lang.String |
getRootElementXml(java.lang.String xmlString)
Removes the XML prologue
|
static <T extends java.io.Serializable> |
getRootElementXml(T entity)
Removes the XML prologue
|
static <T extends java.io.Serializable> |
getXml(T entity)
Helper method to serialize an object to XML.
|
public static <T extends java.io.Serializable> java.lang.String getXml(T entity)
throws java.io.IOException,
javax.xml.bind.JAXBException
T - class that implements Serializableentity - Object to serializejava.io.IOException - if errors during serializationjavax.xml.bind.JAXBException - if errors during serializationpublic static <T extends java.io.Serializable> T create(java.lang.String xml,
java.lang.Class<T> classType)
throws javax.xml.bind.JAXBException
T - class that implements Serializablexml - object serialized into valid XMLclassType - Class Type of the object to be de-serialized intojavax.xml.bind.JAXBException - if errors during de-serializationpublic static java.lang.String escapeStringForXml(java.lang.String valueToSerialize)
valueToSerialize - string value to encode into xmlpublic static java.lang.String descapeStringForXml(java.lang.String valueToDeserialize)
valueToDeserialize - string value to decode from xmlpublic static <T extends java.io.Serializable> java.lang.String getRootElementXml(T entity)
entity - object to remove prologuepublic static java.lang.String getRootElementXml(java.lang.String xmlString)
xmlString - string to remove prologueCopyright © 2018. All Rights Reserved.