Thread: Help in XML
View Single Post
  #3 (permalink)  
Old 04-21-2007, 08:13 PM
pegitha pegitha is offline
Member
 
Join Date: Apr 2007
Location: Indiana
Posts: 84
pegitha is on a distinguished road
Send a message via Skype™ to pegitha
Jaxb is a great package for generating xml files. I put some sample code below. But, it depends on exactly how you are obtaining the data to put into your xml file. If you do not have the data anyplace you are going to have to enter it, maybe in a database , then use jaxb to format it into xml files. Anyway, maybe you can explain in detail what you are doing so we can offer specific help.
Here is some generic jaxb code:
Code:
JAXBContext jaxbContext = JAXBContext.newInstance(MyBean.class); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty("jaxb.formatted.output",new Boolean(true)); //gather data method would be here, fill in your beans File xml = new File(baseDir, "myXMLFIle.xml"); marshaller.marshal( listOfBeans, new FileOutputStream(xml));
Reply With Quote