Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller

pack-priv final Class StAXEventConnector

extends StAXConnector
Class Inheritance
Imports
org.xml.sax.Attributes, .SAXException, org.xml.sax.helpers.AttributesImpl, javax.xml.namespace.QName, javax.xml.stream.Location, .XMLEventReader, .XMLStreamConstants, .XMLStreamException, javax.xml.stream.events.*, java.util.Iterator

This is a simple utility class that adapts StAX events from an XMLEventReader to unmarshaller events on a XmlVisitor, bridging between the two parser technologies.
Author
[email protected]
Version
1.0

Field Summary

Modifier and TypeField and Description
private final AttributesImpl
attrs

Shared and reused Attributes.

private final StringBuilder
buffer

SAX may fire consective characters event, but we don't allow it.

private XMLEvent
event

Current event.

private boolean
private final XMLEventReader
Inherited from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector:
contextpredictortagNamevisitor

Constructor Summary

AccessConstructor and Description
public
StAXEventConnector(XMLEventReader
StAX event source
staxCore
,
XmlVisitor
sink
visitor
)

Construct a new StAX to SAX adapter that will convert a StAX event stream into a SAX event stream.

Method Summary

Modifier and TypeMethod and Description
public void
private Attributes

Returns:

the StAX attributes converted to an org.xml.sax.Attributes
getAttributes
(StartElement event)

Get the attributes associated with the given START_ELEMENT StAXevent.

protected Location
protected String
private void
private void
private void
private boolean
private boolean
isTag(XMLEvent event)

Inherited from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector:
fixNullgetQNamehandleEndDocumenthandleStartDocument

Field Detail

attrsback to summary
private final AttributesImpl attrs

Shared and reused Attributes.

bufferback to summary
private final StringBuilder buffer

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

eventback to summary
private XMLEvent event

Current event.

seenTextback to summary
private boolean seenText
staxEventReaderback to summary
private final XMLEventReader staxEventReader

Constructor Detail

StAXEventConnectorback to summary
public StAXEventConnector(XMLEventReader staxCore, XmlVisitor visitor)

Construct a new StAX to SAX adapter that will convert a StAX event stream into a SAX event stream.

Parameters
staxCore:XMLEventReader

StAX event source

visitor:XmlVisitor

sink

Method Detail

bridgeback to summary
public void bridge() throws XMLStreamException

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector.bridge.

Annotations
@Override
getAttributesback to summary
private Attributes getAttributes(StartElement event)

Get the attributes associated with the given START_ELEMENT StAXevent.

Returns:Attributes

the StAX attributes converted to an org.xml.sax.Attributes

getCurrentLocationback to summary
protected Location getCurrentLocation()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector.getCurrentLocation.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector.getCurrentLocation.

Gets the Location. Used for implementing the line number information.

Annotations
@Override
getCurrentQNameback to summary
protected String getCurrentQName()

Implements abstract org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector.getCurrentQName.

Doc from org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXConnector.getCurrentQName.

Gets the QName of the current element.

Annotations
@Override
handleCharactersback to summary
private void handleCharacters(Characters event) throws SAXException, XMLStreamException
handleEndElementback to summary
private void handleEndElement(EndElement event) throws SAXException
handleStartElementback to summary
private void handleStartElement(StartElement event) throws SAXException
isIgnorableback to summary
private boolean isIgnorable(XMLEvent event)
isTagback to summary
private boolean isTag(XMLEvent event)