I have a XML and XSD file corresponds to it. I have just started to learn Spring Framework and I use Spring 3. I should write a code that takes that XML file and assigns it to an object at Java. I searched about it but how can I do it with using Spring (maybe some useful tricks or anything else?)
Share
I recently used Spring OXM & JAXB for that. The class is
org.springframework.oxm.jaxb.Jaxb2Marshaller. You can, ofcourse, use any other implementation oforg.springframework.oxm.Unmarshaller.But first You’ll need to generate the objects based on Your XSD. For that I used
maven-jaxb2-plugin.And then configure the marshaller:
Than just: