Similar to theMarshaller
, there is theorg.springframework.oxm.Unmarshaller
interface.
public interface Unmarshaller {
/**
* Unmarshal the given provided Source into an object graph.
*/
Object unmarshal(Source source) throws XmlMappingException, IOException;
}
This interface also has one method, which reads from the givenjavax.xml.transform.Source
(an XML input abstraction), and returns the object read. As with Result, Source is a tagging interface that has three concrete implementations. Each wraps a different XML representation, as indicated in the table below.
Source implementation | Wraps XML representation |
---|---|
DOMSource |
org.w3c.dom.Node |
SAXSource |
org.xml.sax.InputSource , andorg.xml.sax.XMLReader |
StreamSource |
java.io.File ,java.io.InputStream , orjava.io.Reader |
Even though there are two separate marshalling interfaces (Marshaller
andUnmarshaller
), all implementations found in Spring-WS implement both in one class. This means that you can wire up one marshaller class and refer to it both as a marshaller and an unmarshaller in yourapplicationContext.xml
.