Top Description Inners Fields Constructors Methods
org.springframework.util.xml

pack-priv Class StaxEventHandler

extends AbstractStaxHandler
Class Inheritance
Imports
java.util.ArrayList, .List, .Map, javax.xml.namespace.QName, javax.xml.stream.Location, .XMLEventFactory, .XMLEventWriter, .XMLStreamException, javax.xml.stream.events.Attribute, .Namespace, org.xml.sax.Attributes, .Locator, org.xml.sax.ext.LexicalHandler, org.springframework.lang.Nullable

SAX org.xml.sax.ContentHandler and LexicalHandler that writes to a javax.xml.stream.util.XMLEventConsumer.
Author
Arjen Poutsma
Since
4.0.3

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final XMLEventFactory
private final XMLEventWriter

Constructor Summary

AccessConstructor and Description
public
StaxEventHandler(XMLEventWriter
the writer to write events to
eventWriter
)

Construct a new instance of the StaxEventContentHandler that writes to the given XMLEventWriter.

public
StaxEventHandler(XMLEventWriter
the writer to write events to
eventWriter
,
XMLEventFactory
the factory used to create events
factory
)

Construct a new instance of the StaxEventContentHandler that uses the given event factory to create events and writes to the given XMLEventConsumer.

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected void
protected void
protected void
protected void
private List<Attribute>
private List<Namespace>
getNamespaces(Map<String, String> namespaceMappings)

protected void
protected void
public void
setDocumentLocator(Locator
an object that can return the location of any SAX document event
locator
)

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Receive an object for locating the origin of SAX document events.
protected void
protected void
protected void
Inherited from org.springframework.util.xml.AbstractStaxHandler:
characterscommentendCDATAendDocumentendDTDendElementendEntityendPrefixMappingignorableWhitespaceisNamespaceDeclarationprocessingInstructionskippedEntitystartCDATAstartDocumentstartDTDstartElementstartEntitystartPrefixMappingtoQName

Field Detail

eventFactoryback to summary
private final XMLEventFactory eventFactory
eventWriterback to summary
private final XMLEventWriter eventWriter

Constructor Detail

StaxEventHandlerback to summary
public StaxEventHandler(XMLEventWriter eventWriter)

Construct a new instance of the StaxEventContentHandler that writes to the given XMLEventWriter. A default XMLEventFactory will be created.

Parameters
eventWriter:XMLEventWriter

the writer to write events to

StaxEventHandlerback to summary
public StaxEventHandler(XMLEventWriter eventWriter, XMLEventFactory factory)

Construct a new instance of the StaxEventContentHandler that uses the given event factory to create events and writes to the given XMLEventConsumer.

Parameters
eventWriter:XMLEventWriter

the writer to write events to

factory:XMLEventFactory

the factory used to create events

Method Detail

cDataInternalback to summary
protected void cDataInternal(String data) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.cDataInternal.

Annotations
@Override
charactersInternalback to summary
protected void charactersInternal(String data) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.charactersInternal.

Annotations
@Override
commentInternalback to summary
protected void commentInternal(String comment) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.commentInternal.

Annotations
@Override
dtdInternalback to summary
protected void dtdInternal(String dtd) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.dtdInternal.

Annotations
@Override
endDocumentInternalback to summary
protected void endDocumentInternal() throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.endDocumentInternal.

Annotations
@Override
endElementInternalback to summary
protected void endElementInternal(QName name, Map<String, String> namespaceMapping) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.endElementInternal.

Annotations
@Override
getAttributesback to summary
private List<Attribute> getAttributes(Attributes attributes)
getNamespacesback to summary
private List<Namespace> getNamespaces(Map<String, String> namespaceMappings)
ignorableWhitespaceInternalback to summary
protected void ignorableWhitespaceInternal(String data) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.ignorableWhitespaceInternal.

Annotations
@Override
processingInstructionInternalback to summary
protected void processingInstructionInternal(String target, String data) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.processingInstructionInternal.

Annotations
@Override
setDocumentLocatorback to summary
public void setDocumentLocator(Locator locator)

Implements org.xml.sax.ContentHandler.setDocumentLocator.

Doc from org.xml.sax.ContentHandler.setDocumentLocator.

Receive an object for locating the origin of SAX document events.

SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the ContentHandler interface.

The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.

Note that the locator will return correct information only during the invocation SAX event callbacks after startDocument returns and before endDocument is called. The application should not attempt to use it at any other time.

Parameters
locator:Locator

an object that can return the location of any SAX document event

Annotations
@Override
skippedEntityInternalback to summary
protected void skippedEntityInternal(String name)

Implements abstract org.springframework.util.xml.AbstractStaxHandler.skippedEntityInternal.

Annotations
@Override
startDocumentInternalback to summary
protected void startDocumentInternal() throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.startDocumentInternal.

Annotations
@Override
startElementInternalback to summary
protected void startElementInternal(QName name, Attributes atts, Map<String, String> namespaceMapping) throws XMLStreamException

Implements abstract org.springframework.util.xml.AbstractStaxHandler.startElementInternal.

Annotations
@Override
org.springframework.util.xml back to summary

private final Class StaxEventHandler.LocatorLocationAdapter

extends Object
implements Location
Class Inheritance
  • java.lang.Object
  • org.springframework.util.xml.StaxEventHandler.LocatorLocationAdapter
All Implemented Interfaces
javax.xml.stream.Location

Field Summary

Modifier and TypeField and Description
private final Locator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public int
getCharacterOffset()

Implements javax.xml.stream.Location.getCharacterOffset.

Return the byte or character offset into the input source this location is pointing to.
public int
getColumnNumber()

Implements javax.xml.stream.Location.getColumnNumber.

Return the column number where the current event ends, returns -1 if none is available.
public int
getLineNumber()

Implements javax.xml.stream.Location.getLineNumber.

Return the line number where the current event ends, returns -1 if none is available.
public String
getPublicId()

Implements javax.xml.stream.Location.getPublicId.

Returns the public ID of the XML
public String
getSystemId()

Implements javax.xml.stream.Location.getSystemId.

Returns the system ID of the XML
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

locatorback to summary
private final Locator locator

Constructor Detail

LocatorLocationAdapterback to summary
public LocatorLocationAdapter(Locator locator)

Method Detail

getCharacterOffsetback to summary
public int getCharacterOffset()

Implements javax.xml.stream.Location.getCharacterOffset.

Doc from javax.xml.stream.Location.getCharacterOffset.

Return the byte or character offset into the input source this location is pointing to. If the input source is a file or a byte stream then this is the byte offset into that stream, but if the input source is a character media then the offset is the character offset. Returns -1 if there is no offset available.

Returns:int

the current offset

Annotations
@Override
getColumnNumberback to summary
public int getColumnNumber()

Implements javax.xml.stream.Location.getColumnNumber.

Doc from javax.xml.stream.Location.getColumnNumber.

Return the column number where the current event ends, returns -1 if none is available.

Returns:int

the current column number

Annotations
@Override
getLineNumberback to summary
public int getLineNumber()

Implements javax.xml.stream.Location.getLineNumber.

Doc from javax.xml.stream.Location.getLineNumber.

Return the line number where the current event ends, returns -1 if none is available.

Returns:int

the current line number

Annotations
@Override
getPublicIdback to summary
public String getPublicId()

Implements javax.xml.stream.Location.getPublicId.

Doc from javax.xml.stream.Location.getPublicId.

Returns the public ID of the XML

Returns:String

the public ID, or null if not available

Annotations
@Override
getSystemIdback to summary
public String getSystemId()

Implements javax.xml.stream.Location.getSystemId.

Doc from javax.xml.stream.Location.getSystemId.

Returns the system ID of the XML

Returns:String

the system ID, or null if not available

Annotations
@Override