public class XmlMapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlMapper.CollectionWrapper
封装Root Element 是 Collection的情况.
|
| Constructor and Description |
|---|
XmlMapper() |
| Modifier and Type | Method and Description |
|---|---|
static Marshaller |
createMarshaller(Class clazz,
String encoding)
创建Marshaller并设定encoding(可为null).
|
static Unmarshaller |
createUnmarshaller(Class clazz)
创建UnMarshaller.
|
static <T> T |
fromXml(String xml,
Class<T> clazz)
Xml->Java Object.
|
protected static JAXBContext |
getJaxbContext(Class clazz) |
static String |
toXml(Collection<?> root,
String rootName,
Class clazz)
Java Collection->Xml without encoding, 特别支持Root Element是Collection的情形.
|
static String |
toXml(Collection<?> root,
String rootName,
Class clazz,
String encoding)
Java Collection->Xml with encoding, 特别支持Root Element是Collection的情形.
|
static String |
toXml(Object root)
Java Object->Xml without encoding.
|
static String |
toXml(Object root,
Class clazz,
String encoding)
Java Object->Xml with encoding.
|
static String |
toXml(Object root,
String encoding)
Java Object->Xml with encoding.
|
public static String toXml(Object root, Class clazz, String encoding)
public static String toXml(Collection<?> root, String rootName, Class clazz)
public static String toXml(Collection<?> root, String rootName, Class clazz, String encoding)
public static Marshaller createMarshaller(Class clazz, String encoding)
public static Unmarshaller createUnmarshaller(Class clazz)
protected static JAXBContext getJaxbContext(Class clazz)
Copyright © 2018. All rights reserved.