javax.xml.bind.helpers
public abstract class AbstractUnmarshallerImpl extends Object implements Unmarshaller
This is an abstract default implementation of an {@link javax.xml.bind.Unmarshaller}. Subclasses only need to implement {@link javax.xml.bind.Unmarshaller#getUnmarshallerHandler()}, {@link javax.xml.bind.Unmarshaller#unmarshal(org.w3c.dom.Node)}, and {@link #unmarshal(org.xml.sax.XMLReader, org.xml.sax.InputSource)}.
Since: JAXB1.0
Constructor Summary | |
---|---|
AbstractUnmarshallerImpl() Creates a new instance of AbstractUnmarshallerImpl. |
Method Summary | |
---|---|
protected UnmarshalException | createUnmarshalException(SAXException pException) Helper method to concert a {@link org.xml.sax.SAXException} into an {@link javax.xml.bind.UnmarshalException}. |
ValidationEventHandler | getEventHandler() |
Object | getProperty(String pName) Always throws a {@link javax.xml.bind.PropertyException}, because the default implementation does not support any properties. |
protected XMLReader | getXMLReader() Creates a configured {@link org.xml.sax.XMLReader}. |
boolean | isValidating() |
void | setEventHandler(ValidationEventHandler pHandler) |
void | setProperty(String pName, Object pValue) Always throws a {@link javax.xml.bind.PropertyException}, because the default implementation does not support any properties. |
void | setValidating(boolean pValidating) |
Object | unmarshal(Source pSource) |
protected abstract Object | unmarshal(XMLReader pReader, InputSource pSource) Unmarshals an object by using the given instance
of {@link org.xml.sax.XMLReader} to parse the XML
document read from the byte or character stream
given by the {@link org.xml.sax.InputSource}
The implementation should call the method {@link org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)} in order to pass errors provided by the SAX parser to the {@link javax.xml.bind.ValidationEventHandler} provided by the client. |
Object | unmarshal(InputSource pSource) |
Object | unmarshal(URL pURL) |
Object | unmarshal(File pFile) |
Object | unmarshal(InputStream pSource) |
Creates a new instance of AbstractUnmarshallerImpl.
Helper method to concert a {@link org.xml.sax.SAXException} into an {@link javax.xml.bind.UnmarshalException}.
Parameters: pException If the parameter contains a nested instance of {@link javax.xml.bind.UnmarshalException}, throws that instance. Otherwise wraps the parameter in a new {@link javax.xml.bind.UnmarshalException} and throws that.
Always throws a {@link javax.xml.bind.PropertyException}, because the default implementation does not support any properties. If you want to change this, override the class.
Throws: IllegalArgumentException The property name was null. PropertyException The name was not null. :-)
Creates a configured {@link org.xml.sax.XMLReader}. Unmarshaller is not re-entrant, so we will use a single instance of {@link org.xml.sax.XMLReader}.
Throws: JAXBException Encapsulates a {@link javax.xml.parsers.ParserConfigurationException}
Always throws a {@link javax.xml.bind.PropertyException}, because the default implementation does not support any properties. If you want to change this, override the class.
Throws: IllegalArgumentException The property name was null. PropertyException The name was not null. :-)
Unmarshals an object by using the given instance
of {@link org.xml.sax.XMLReader} to parse the XML
document read from the byte or character stream
given by the {@link org.xml.sax.InputSource}
pSource
.
The implementation should call the method {@link org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)} in order to pass errors provided by the SAX parser to the {@link javax.xml.bind.ValidationEventHandler} provided by the client.
Throws: JAXBException An error occurred while unmarshalling the JAXB object.