Top Description Fields Constructors Methods
org.eclipse.persistence.oxm

public Class XMLUnmarshallerHandler

extends SAXDocumentBuilder
implements UnmarshallerHandler
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.oxm.UnmarshallerHandler, org.xml.sax.ContentHandler
Imports
org.eclipse.persistence.exceptions.XMLMarshalException, org.eclipse.persistence.internal.oxm.UnmarshallerHandler, org.eclipse.persistence.oxm.XMLUnmarshaller, org.eclipse.persistence.platform.xml.SAXDocumentBuilder, org.w3c.dom.Document, org.xml.sax.SAXException

Class used to unmarshal SAX events to objects.

Create an XMLUnmarshallerHandler from an XMLUnmarshaller.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLUnmarshaller unmarshaller = context.createUnmarshaller();
XMLUnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();

Use the UnmarshallerHandler with an XMLReader
Code Sample
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setNamespaceAware(true);
SAXParser saxParser = saxParserFactory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setContentHandler(xmlUnmarshallerHandler);
FileInputStream inputStream = new FileInputStream("MyFile.xml");
InputSource inputSource = new InputSource(inputStream);
xmlReader.parse(inputSource);
Object result = xmlUnmarshallerHandler.getResult();

XML that can be unmarshalled is XML which has a root tag that corresponds to a default root element on an XMLDescriptor in the TopLink project associated with the XMLContext.

See Also
org.eclipse.persistence.oxm.XMLUnmarshaller

Field Summary

Modifier and TypeField and Description
private boolean
private XMLUnmarshaller
Inherited from org.eclipse.persistence.platform.xml.SAXDocumentBuilder:
documentlocatornamespaceDeclarationsnodesstringBufferxmlPlatform

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public Object

Returns:

the resulting object
getResult
()

Implements org.eclipse.persistence.internal.oxm.UnmarshallerHandler.getResult.

Returns the object that was unmarshalled from the SAX events.
public void
Inherited from org.eclipse.persistence.platform.xml.SAXDocumentBuilder:
addNamespaceDeclarationappendChildNodecharacterscharacterscommentendCDATAendDTDendElementendEntityendPrefixMappinggetDocumentgetInitializedDocumentignorableWhitespaceprocessingInstructionsetDocumentLocatorsetNilskippedEntitystartCDATAstartDTDstartElementstartEntitystartPrefixMapping

Field Detail

endDocumentTriggeredback to summary
private boolean endDocumentTriggered
xmlUnmarshallerback to summary
private XMLUnmarshaller xmlUnmarshaller

Constructor Detail

XMLUnmarshallerHandlerback to summary
pack-priv XMLUnmarshallerHandler(XMLUnmarshaller xmlUnmarshaller)

Method Detail

endDocumentback to summary
public void endDocument() throws SAXException

Overrides org.eclipse.persistence.platform.xml.SAXDocumentBuilder.endDocument.

Implements org.xml.sax.ContentHandler.endDocument.

Doc from org.xml.sax.ContentHandler.endDocument.

Receive notification of the end of a document.

This method is invoked by the parser to signal it has reached the end of the document after successfully completing the parsing process. After the event, the parser will return the control to the application.

Annotations
@Override
Exceptions
SAXException:
any SAX exception, possibly wrapping another exception
getResultback to summary
public Object getResult()

Implements org.eclipse.persistence.internal.oxm.UnmarshallerHandler.getResult.

Returns the object that was unmarshalled from the SAX events.

Returns:Object

the resulting object

Annotations
@Override
Exceptions
XMLMarshalException:
if an error occurred during unmarshalling
startDocumentback to summary
public void startDocument() throws SAXException

Overrides org.eclipse.persistence.platform.xml.SAXDocumentBuilder.startDocument.

Implements org.xml.sax.ContentHandler.startDocument.

Doc from org.xml.sax.ContentHandler.startDocument.

Receive notification of the beginning of a document.

The SAX parser will invoke this method only once, before any other event callbacks (except for setDocumentLocator).

Annotations
@Override
Exceptions
SAXException:
any SAX exception, possibly wrapping another exception