public class XMLUnmarshallerHandler extends SAXDocumentBuilder
Class used to unmarshal SAX events to objects.
Create an XMLUnmarshallerHandler from an XMLUnmarshaller. Use the UnmarshallerHandler with an XMLReader 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.
Code Sample
XMLContext context = new XMLContext("mySessionName");
XMLUnmarshaller unmarshaller = context.createUnmarshaller();
XMLUnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();
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();
XMLUnmarshaller| Modifier and Type | Method and Description |
|---|---|
void |
endDocument() |
java.lang.Object |
getResult()
Returns the object that was unmarshalled from the SAX events.
|
void |
startDocument() |
appendChildNode, characters, characters, endElement, endPrefixMapping, getDocument, getInitializedDocument, ignorableWhitespace, processingInstruction, setDocumentLocator, setNil, skippedEntity, startElement, startPrefixMappingpublic void endDocument()
throws org.xml.sax.SAXException
endDocument in interface org.xml.sax.ContentHandlerendDocument in class SAXDocumentBuilderorg.xml.sax.SAXExceptionpublic void startDocument()
throws org.xml.sax.SAXException
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class SAXDocumentBuilderorg.xml.sax.SAXExceptionpublic java.lang.Object getResult()
XMLMarshalException - if an error occurred during unmarshallingEclipseLink 2.4.2, "build v20130514-5956486" API Reference