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.
org.eclipse.persistence.oxm.XMLUnmarshaller
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private XMLUnmarshaller |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | endDocument()
Overrides org. Implements org. |
| public Object | Returns: the resulting objectImplements org. |
| public void | startDocument()
Overrides org. Implements org. |
| endDocumentTriggered | back to summary |
|---|---|
| private boolean endDocumentTriggered | |
| xmlUnmarshaller | back to summary |
|---|---|
| private XMLUnmarshaller xmlUnmarshaller | |
| XMLUnmarshallerHandler | back to summary |
|---|---|
| pack-priv XMLUnmarshallerHandler(XMLUnmarshaller xmlUnmarshaller) | |
| endDocument | back to summary |
|---|---|
| public void endDocument() throws SAXException Overrides org. Implements org. Doc from org. 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.
| |
| getResult | back to summary |
|---|---|
| public Object getResult() Implements org. Returns the object that was unmarshalled from the SAX events.
| |
| startDocument | back to summary |
|---|---|
| public void startDocument() throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the beginning of a document. The SAX parser will invoke this method only once, before any
other event callbacks (except for
| |