List of utility methods to do XML JAXB Unmarshaller
Object | unmarshal(String packageName, InputStream inputStream) unmarshal Unmarshaller unmarshaller = createUnmarshaller(packageName);
return unmarshaller.unmarshal(inputStream);
|
Object | unmarshal(String string, Class> clazz) unmarshal JAXBContext jaxbContext = JAXBContext.newInstance(clazz); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); return unmarshaller.unmarshal(new StringReader(string)); |
T | unmarshal(String xml, Class unmarshal StringReader sr = null; try { sr = new StringReader(xml.toString()); return JAXB.unmarshal(sr, c); } catch (DataBindingException e) { e.printStackTrace(); return null; } finally { ... |
T | unmarshal(String xml, Class Parse an XML file into a container class. Unmarshaller unmarshaller = JAXBContext.newInstance(clazz).createUnmarshaller(); return clazz.cast(unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()))); |
T | unmarshal(String xml, Class unmarshal return JAXB.unmarshal(new StringReader(xml), clazz); |
String | unmarshal(T entity) unmarshal JAXBContext ctx = JAXBContext.newInstance(entity.getClass()); Marshaller marshaller = ctx.createMarshaller(); StringWriter entityXml = new StringWriter(); marshaller.marshal(entity, entityXml); String entityString = entityXml.toString(); return entityString; |
T | unmarshalByContent(Class unmarshal By Content Reader reader = null; try { reader = new StringReader(xmlContent); JAXBContext context = JAXBContext.newInstance(clazz); return (T) context.createUnmarshaller().unmarshal(reader); } catch (Exception e) { throw new RuntimeException( "Failed to unmarshal object for class:" + clazz + " xmlContent:" + xmlContent, e); ... |
Element | unmarshalDOMElement(byte[] input) unmarshal DOM Element DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new ByteArrayInputStream(input)); return doc.getDocumentElement(); |
Object | unmarshalFromReader(Reader reader, Class> c) unmarshal From Reader Object result = null;
JAXBContext jc = JAXBContext.newInstance(c);
Unmarshaller um = jc.createUnmarshaller();
result = um.unmarshal(reader);
return result;
|
T | unmarshalFromString(Class clz, String input) unmarshal From String JAXBContext context = JAXBContext.newInstance(clz); Unmarshaller unmarshaller = context.createUnmarshaller(); T unobj = (T) unmarshaller.unmarshal(new StreamSource(new StringReader(input.toString()))); return unobj; |