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

java.lang.Object
  extended by com.sun.xml.bind.v2.runtime.unmarshaller.StAXConnector
      extended by com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector

 class StAXStreamConnector
extends StAXConnector

Reads XML from StAX XMLStreamReader and feeds events to XmlVisitor.

TODO: Finding the optimized FI implementations is a bit hacky and not very extensible. Can we use the service provider mechnism in general for concrete implementations of StAXConnector.


Field Summary
protected  StringBuilder buffer
          SAX may fire consective characters event, but we don't allow it.
protected  boolean textReported
          Set to true if the text() event is reported, and therefore the following text() event should be suppressed.
 
Fields inherited from class com.sun.xml.bind.v2.runtime.unmarshaller.StAXConnector
context, predictor, tagName, visitor
 
Constructor Summary
protected StAXStreamConnector(javax.xml.stream.XMLStreamReader staxStreamReader, XmlVisitor visitor)
           
 
Method Summary
 void bridge()
           
static StAXConnector create(javax.xml.stream.XMLStreamReader reader, XmlVisitor visitor)
          Creates a StAXConnector from XMLStreamReader.
protected  javax.xml.stream.Location getCurrentLocation()
          Gets the Location.
protected  String getCurrentQName()
          Gets the QName of the current element.
protected  void handleCharacters()
           
 
Methods inherited from class com.sun.xml.bind.v2.runtime.unmarshaller.StAXConnector
fixNull, getQName, handleEndDocument, handleStartDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected final StringBuilder buffer
SAX may fire consective characters event, but we don't allow it. so use this buffer to perform buffering.


textReported

protected boolean textReported
Set to true if the text() event is reported, and therefore the following text() event should be suppressed.

Constructor Detail

StAXStreamConnector

protected StAXStreamConnector(javax.xml.stream.XMLStreamReader staxStreamReader,
                              XmlVisitor visitor)
Method Detail

create

public static StAXConnector create(javax.xml.stream.XMLStreamReader reader,
                                   XmlVisitor visitor)
Creates a StAXConnector from XMLStreamReader. This method checks if the parser is FI parser and acts accordingly.


bridge

public void bridge()
            throws javax.xml.stream.XMLStreamException
Specified by:
bridge in class StAXConnector
Throws:
javax.xml.stream.XMLStreamException

getCurrentLocation

protected javax.xml.stream.Location getCurrentLocation()
Description copied from class: StAXConnector
Gets the Location. Used for implementing the line number information.

Specified by:
getCurrentLocation in class StAXConnector
Returns:
must not null.

getCurrentQName

protected String getCurrentQName()
Description copied from class: StAXConnector
Gets the QName of the current element.

Specified by:
getCurrentQName in class StAXConnector

handleCharacters

protected void handleCharacters()
                         throws javax.xml.stream.XMLStreamException,
                                SAXException
Throws:
javax.xml.stream.XMLStreamException
SAXException