@Component public class XmlHelper extends Object
| Constructor and Description |
|---|
XmlHelper() |
| Modifier and Type | Method and Description |
|---|---|
String |
objectToXml(Object obj)
Returns XML representation of the object.
|
String |
objectToXml(Object obj,
boolean formatted)
Returns XML representation of the object using the herd custom character escape handler.
|
<T> T |
unmarshallXmlToObject(Class<T> classType,
String xmlString)
Unmarshalls the xml into JAXB object.
|
public String objectToXml(Object obj) throws JAXBException
obj - the Java object to be serializedJAXBException - if a JAXB error occurred.public String objectToXml(Object obj, boolean formatted) throws JAXBException
obj - the Java object to be serializedformatted - specifies whether or not the marshalled XML data is formatted with line feeds and indentationJAXBException - if a JAXB error occurred.public <T> T unmarshallXmlToObject(Class<T> classType, String xmlString) throws JAXBException
T - the class type.classType - the class type of JAXB elementxmlString - the xml stringJAXBException - if there is an error in unmarshallingCopyright © 2019. All rights reserved.