Class SAXConnector
- java.lang.Object
-
- com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector
-
- All Implemented Interfaces:
UnmarshallerHandler,ContentHandler
public final class SAXConnector extends Object implements UnmarshallerHandler
Receives SAX events and convert them to our internal events.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description SAXConnector(XmlVisitor next, LocatorEx externalLocator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] buf, int start, int len)voidendDocument()voidendElement(String uri, String localName, String qName)voidendPrefixMapping(String prefix)UnmarshallingContextgetContext()ObjectgetResult()Obtains the unmarshalled result.voidignorableWhitespace(char[] buf, int start, int len)voidprocessingInstruction(String target, String data)voidsetDocumentLocator(Locator locator)voidskippedEntity(String name)voidstartDocument()voidstartElement(String uri, String local, String qname, Attributes atts)voidstartPrefixMapping(String prefix, String uri)
-
-
-
Constructor Detail
-
SAXConnector
public SAXConnector(XmlVisitor next, LocatorEx externalLocator)
- Parameters:
externalLocator- If the caller is producing SAX events from sources other than Unicode and angle brackets, the caller can override the default SAXLocatorobject by this object to provide better location information.
-
-
Method Detail
-
getResult
public Object getResult() throws JAXBException, IllegalStateException
Description copied from interface:UnmarshallerHandlerObtains the unmarshalled result. This method can be called only after this handler receives the endDocument SAX event.- Specified by:
getResultin interfaceUnmarshallerHandler- Returns:
- always return a non-null valid object which was unmarshalled.
- Throws:
JAXBException- if there is any unmarshalling error. Note that the implementation is allowed to throw SAXException during the parsing when it finds an error.IllegalStateException- if this method is called before this handler receives the endDocument event.
-
getContext
public UnmarshallingContext getContext()
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocatorin interfaceContentHandler
-
startDocument
public void startDocument() throws SAXException- Specified by:
startDocumentin interfaceContentHandler- Throws:
SAXException
-
endDocument
public void endDocument() throws SAXException- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri) throws SAXException
- Specified by:
startPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
endPrefixMapping
public void endPrefixMapping(String prefix) throws SAXException
- Specified by:
endPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
startElement
public void startElement(String uri, String local, String qname, Attributes atts) throws SAXException
- Specified by:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
characters
public final void characters(char[] buf, int start, int len)- Specified by:
charactersin interfaceContentHandler
-
ignorableWhitespace
public final void ignorableWhitespace(char[] buf, int start, int len)- Specified by:
ignorableWhitespacein interfaceContentHandler
-
processingInstruction
public void processingInstruction(String target, String data)
- Specified by:
processingInstructionin interfaceContentHandler
-
skippedEntity
public void skippedEntity(String name)
- Specified by:
skippedEntityin interfaceContentHandler
-
-