Interface Unmarshaller
- All Known Implementing Classes:
IntrospectingUnmarshaller
public interface Unmarshaller
An unmarshaller takes events as they occur when unmarshalling hierarchically organised
structures in stream form (like e.g. XML) and converts them to Java objects. How
exactly this is done and how the resulting Java object is received, depends on the
implementation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
conclude()
Conclude one resource.void
Set an element's text content.void
End an element.void
reset()
Reset the unmarshaller.void
setLocation
(Location location) Set the current location.void
startElement
(String element, Map<String, String> attributes) Start a new element.
-
Method Details
-
setLocation
Set the current location. This is used for error messages. Implementations should always make a copy of this location to allow event emitters, to put a "live" version here, i.e. one that changes during parsing always reflecting the current location.- Parameters:
location
- The location.
-
startElement
Start a new element.- Parameters:
element
- The element's name.attributes
- A map of attributes as read from the tag.- Throws:
UnmarshalException
- If an error occurs.
-
endElement
End an element.- Throws:
UnmarshalException
- If an error occurs.
-
content
Set an element's text content. This may be called only once per element. Content and sub hierarchies may not be combined.- Parameters:
content
- The text content.- Throws:
UnmarshalException
- If an error occurs.
-
reset
void reset()Reset the unmarshaller. This should be called on the start of each document. -
conclude
Conclude one resource. This should be called at the end of each document.- Throws:
UnmarshalException
- If an error occurs.
-