private void tabAddDoctor_SaveActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_tabAddDoctor_SaveActionPerformed try { Doctors doctors = new Doctors(); doctors.setVisible(true); } catch (SQLException ex) { Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex); } } // GEN-LAST:event_tabAddDoctor_SaveActionPerformed
@Test public void shouldMarshallAListOfDoctors() throws JAXBException { Doctors doctors = new Doctors(); doctors.add(new Doctor("John", "Smith", "*****@*****.**", "1234565")); doctors.add(new Doctor("Joe", "Doe", "*****@*****.**", "1234566")); StringWriter writer = new StringWriter(); JAXBContext context = JAXBContext.newInstance(Doctors.class); Marshaller m = context.createMarshaller(); m.marshal(doctors, writer); System.out.println("XML : " + writer.toString()); }