List of usage examples for javax.xml.bind JAXBException printStackTrace
public void printStackTrace(PrintWriter s)
From source file:org.openestate.is24.restapi.examples.RandomRealEstateExample.java
/** * Main function./*from w w w . j a va2 s . com*/ * * @param args * command line arguments */ public static void main(String[] args) { try { final RandomRealEstateFactory factory = new RandomRealEstateFactory(); final Charset charset = Charset.forName("UTF-8"); for (RandomRealEstateFactory.Type type : RandomRealEstateFactory.Type.values()) { System.out.println("----------------------------------------"); System.out.println("example for " + type + ":"); RealEstate realEstate = factory.createRandomObject(type); ByteArrayOutputStream output = null; try { output = new ByteArrayOutputStream(); XmlUtils.writeXml(realEstate, charset.name(), true, output); ByteBuffer buffer = ByteBuffer.wrap(output.toByteArray()); String xml = charset.decode(buffer).toString(); System.out.println(xml.trim()); } finally { IOUtils.closeQuietly(output); } } } catch (JAXBException ex) { System.err.println("XML error!"); ex.printStackTrace(System.err); } }