Top Description Fields Constructors Methods
com.sun.istack

public Class XMLStreamReaderToContentHandler

extends Object
Class Inheritance
Imports
org.xml.sax.ContentHandler, .SAXException, .Locator, .Attributes, org.xml.sax.helpers.AttributesImpl, javax.xml.stream.XMLStreamReader, .XMLStreamException, .XMLStreamConstants, javax.xml.namespace.QName

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

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
fragment

If true, not start/endDocument event.

private final String[]
private final ContentHandler
private final XMLStreamReader

Constructor Summary

AccessConstructor and Description
public
XMLStreamReaderToContentHandler(XMLStreamReader
StAX event source
staxCore
,
ContentHandler
SAXevent sink
saxCore
,
boolean eagerQuit, boolean fragment)

public
XMLStreamReaderToContentHandler(XMLStreamReader
StAX event source
staxCore
,
ContentHandler
SAXevent sink
saxCore
,
boolean eagerQuit, boolean fragment, String[]
array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }
inscopeNamespaces
)

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 static String
private Attributes

Returns:

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

Get the attributes associated with the given START_ELEMENT or ATTRIBUTE StAXevent.

private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

eagerQuitback to summary
private final boolean eagerQuit
fragmentback to summary
private final boolean fragment

If true, not start/endDocument event.

inscopeNamespacesback to summary
private final String[] inscopeNamespaces
saxHandlerback to summary
private final ContentHandler saxHandler
staxStreamReaderback to summary
private final XMLStreamReader staxStreamReader

Constructor Detail

XMLStreamReaderToContentHandlerback to summary
public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, boolean eagerQuit, boolean fragment)
Parameters
staxCore:XMLStreamReader

StAX event source

saxCore:ContentHandler

SAXevent sink

See Also
XMLStreamReaderToContentHandler(XMLStreamReader, ContentHandler, boolean, boolean, String[])
XMLStreamReaderToContentHandlerback to summary
public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, boolean eagerQuit, boolean fragment, String[] inscopeNamespaces)

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

Parameters
staxCore:XMLStreamReader

StAX event source

saxCore:ContentHandler

SAXevent sink

inscopeNamespaces:String[]

array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }

Method Detail

bridgeback to summary
public void bridge() throws XMLStreamException
fixNullback to summary
private static String fixNull(String s)
getAttributesback to summary
private Attributes getAttributes()

Get the attributes associated with the given START_ELEMENT or ATTRIBUTE StAXevent.

Returns:Attributes

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

handleAttributeback to summary
private void handleAttribute()
handleCDATAback to summary
private void handleCDATA()
handleCharactersback to summary
private void handleCharacters() throws XMLStreamException
handleCommentback to summary
private void handleComment()
handleDTDback to summary
private void handleDTD()
handleEndDocumentback to summary
private void handleEndDocument() throws SAXException
handleEndElementback to summary
private void handleEndElement() throws XMLStreamException
handleEntityDeclback to summary
private void handleEntityDecl()
handleEntityReferenceback to summary
private void handleEntityReference()
handleNamespaceback to summary
private void handleNamespace()
handleNotationDeclback to summary
private void handleNotationDecl()
handlePIback to summary
private void handlePI() throws XMLStreamException
handleSpaceback to summary
private void handleSpace()
handleStartDocumentback to summary
private void handleStartDocument() throws SAXException
handleStartElementback to summary
private void handleStartElement() throws XMLStreamException