Marshaling: -
Marshalling creates an XML document from a content tree.
To marshal a content tree,
Unmarshalling an XML document means creating a tree of content objects that represents the content and organization of the document.
To unmarshal an XML document,
Click to get Java Training
Regards,
Get more Java Training from author’s blog
Marshalling creates an XML document from a content tree.
To marshal a content tree,
- Create a JAXBContext object
- Create a Marshaller object (Marshaller marshaller = jaxbContext.createMarshaller();)
- Set required properties using setProperty method of Marshaller marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
- Call the marshal method marshaller.marshal(collection, new FileOutputStream("jaxbOutput.xml"));
Unmarshalling an XML document means creating a tree of content objects that represents the content and organization of the document.
To unmarshal an XML document,
- Create a JAXBContext object(JAXBContext jaxbContext = JAXBContext.newInstance("package name ");
- Create an Unmarshaller object Unmarshaller unmarshaller = jc.createUnmarshaller();
- Call the unmarshal method unmarshaller.unmarshal(new File( "xml name"));
- Use the get methods in the schema-derived classes to access the XML data
Click to get Java Training
Regards,
Get more Java Training from author’s blog
Great and Useful Article.
ReplyDeleteOnline Java Course
Java Online Training
Java Course Online
J2EE training
online J2EE training
Best Recommended books for Spring framework
Java Interview Questions
Java Training Institutes in Chennai
Java Training in Chennai
J2EE Training in Chennai
java j2ee training institutes in chennai
Java Course in Chennai