This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Need your inputs to generate an xml file, using jaxb marshaller.
Im able to unmarshal the xml file, able to retrieve the values from the xml file for different users. But could not generate the xml file with marshaller object. There is no setter method to add multiple users under the Users tag.
XML file contains 'n' number of 'User' entries under 'Users' tag. The 'UserID' is mandatory field for every User. I'm able to set the values for indivual User like, first name last name and status. But there was no setter method to add individual user to Users list. I'm using xjc command to generate the java objects.
Can you please look into the below sample code and help me out to generate the xml file with different User entries under Users tag.
// users object is the list of user objects UsersType users=objFactory.createUsersType();
// User is the objject to set to Users list User user1=(User)users.getUser();
// setting values for the first user user1.setFirstName("First Name"); user1.setUserId("User Id");
// setting values for the second user user2.setLastName("Last Name"); user2.setUserId("User Id");
// users // Here Im unable to set user1 and user2 objects to list users, which is the final xml file.
// No setter method to set user1 and user2 objects to Users object // example: // users.setUser(user1); (Not available) // users.setUser(user2);(Not available) // How to set the user objects, user1 and user2 to Users object ??