com.sun.xml.bind.v2.runtime.unmarshaller
Class MTOMDecorator

java.lang.Object
  extended by com.sun.xml.bind.v2.runtime.unmarshaller.MTOMDecorator
All Implemented Interfaces:
XmlVisitor

final class MTOMDecorator
extends Object
implements XmlVisitor

Decorator of XmlVisitor that performs XOP processing. Used to support MTOM.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.xml.bind.v2.runtime.unmarshaller.XmlVisitor
XmlVisitor.TextPredictor
 
Constructor Summary
MTOMDecorator(UnmarshallerImpl parent, XmlVisitor next, AttachmentUnmarshaller au)
           
 
Method Summary
 void endDocument()
           
 void endElement(TagName tagName)
           
 void endPrefixMapping(String prefix)
          Called after XmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify the end of a binding.
 UnmarshallingContext getContext()
          Returns the UnmarshallingContext at the end of the chain.
 XmlVisitor.TextPredictor getPredictor()
          Gets the predictor that can be used for the caller to avoid calling XmlVisitor.text(CharSequence) unnecessarily.
 void startDocument(LocatorEx loc, NamespaceContext nsContext)
          Notifies a start of the document.
 void startElement(TagName tagName)
          Notifies a start tag of a new element.
 void startPrefixMapping(String prefix, String nsUri)
          Called before XmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify a new namespace binding.
 void text(CharSequence pcdata)
          Text events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTOMDecorator

public MTOMDecorator(UnmarshallerImpl parent,
                     XmlVisitor next,
                     AttachmentUnmarshaller au)
Method Detail

startDocument

public void startDocument(LocatorEx loc,
                          NamespaceContext nsContext)
                   throws SAXException
Description copied from interface: XmlVisitor
Notifies a start of the document.

Specified by:
startDocument in interface XmlVisitor
Parameters:
loc - This live object returns the location information as the parsing progresses. must not be null.
nsContext - Some broken XML APIs can't iterate all the in-scope namespace bindings, which makes it impossible to emulate XmlVisitor.startPrefixMapping(String, String) correctly when unmarshalling a subtree. Connectors that use such an API can pass in additional NamespaceContext object that knows about the in-scope namespace bindings. Otherwise (and normally) it is null.

Ideally this object should be immutable and only represent the namespace URI bindings in the context (those done above the element that JAXB started unmarshalling), but it can also work even if it changes as the parsing progress (to include namespaces declared on the current element being parsed.)

Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface XmlVisitor
Throws:
SAXException

startElement

public void startElement(TagName tagName)
                  throws SAXException
Description copied from interface: XmlVisitor
Notifies a start tag of a new element. namespace URIs and local names must be interned.

Specified by:
startElement in interface XmlVisitor
Throws:
SAXException

endElement

public void endElement(TagName tagName)
                throws SAXException
Specified by:
endElement in interface XmlVisitor
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String nsUri)
                        throws SAXException
Description copied from interface: XmlVisitor
Called before XmlVisitor.startElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify a new namespace binding.

Specified by:
startPrefixMapping in interface XmlVisitor
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Description copied from interface: XmlVisitor
Called after XmlVisitor.endElement(com.sun.xml.bind.v2.runtime.unmarshaller.TagName) event to notify the end of a binding.

Specified by:
endPrefixMapping in interface XmlVisitor
Throws:
SAXException

text

public void text(CharSequence pcdata)
          throws SAXException
Description copied from interface: XmlVisitor
Text events.

The caller should consult XmlVisitor.TextPredictor to see if the unmarshaller is expecting any PCDATA. If the above is returning false, the caller is OK to skip any text in XML. The net effect is that we can ignore whitespaces quickly.

Specified by:
text in interface XmlVisitor
Parameters:
pcdata - represents character data. This object can be mutable (such as StringBuilder); it only needs to be fixed while this method is executing.
Throws:
SAXException

getContext

public UnmarshallingContext getContext()
Description copied from interface: XmlVisitor
Returns the UnmarshallingContext at the end of the chain.

Specified by:
getContext in interface XmlVisitor
Returns:
always return the same object, so caching the result is recommended.

getPredictor

public XmlVisitor.TextPredictor getPredictor()
Description copied from interface: XmlVisitor
Gets the predictor that can be used for the caller to avoid calling XmlVisitor.text(CharSequence) unnecessarily.

Specified by:
getPredictor in interface XmlVisitor