List of utility methods to do XML JAXB String to Object
T | XmlToObject(String xml, Class Transforms a XML string to an Object using javax.xml.bind.Unmarshaller. JAXBContext jaxbContext = JAXBContext.newInstance(type); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); T obj = (T) jaxbUnmarshaller.unmarshal(new StringReader(xml)); return obj; |
void | xmlToXhtml(T catalog, StreamSource xslt, StreamResult result) xml To Xhtml try { TransformerFactory.newInstance().newTransformer(xslt) .transform(new JAXBSource(JAXBContext.newInstance(catalog.getClass()), catalog), result); } catch (JAXBException | TransformerException e) { throw new IllegalStateException(e); |