Top Description Methods
org.jvnet.staxex

public Interface XMLStreamReaderEx

extends XMLStreamReader
Imports
javax.xml.stream.XMLStreamReader, .XMLStreamException

XMLStreamReader extended for reading binary data.

Some producer of infoset (in particular, such as FastInfoset, XOP decoder), uses a native format that enables efficient treatment of binary data. For ordinary infoset consumer (that just uses XMLStreamReader, those binary data will just look like base64-encoded string, but this interface allows consumers of such infoset to access this raw binary data. Such infoset producer may choose to implement this additoinal interface, to expose this functionality.

Consumers that are capable of using this interface can query XMLStreamReader if it supports this by simply downcasting it to this interface like this:

XMLStreamReader reader = ...;
if( reader instanceof XMLStreamReaderEx ) {
  // this reader supports binary data exchange
  ...
} else {
  // noop
  ...
}

Also note that it is also allowed for the infoset producer to implement this interface in such a way that getPCDATA() always delegate to getText(), although it's not desirable.

This interface is a private contract between such producers and consumers to allow them to exchange binary data without converting it to base64.

Authors
Kohsuke Kawaguchi, Paul Sandoz
See Also
XMLStreamWriterEx

Method Summary

Modifier and TypeMethod and Description
public String
getElementTextTrim()

Works like getElementText() but trims the leading and trailing whitespace.

public NamespaceContextEx
getNamespaceContext()

Redeclares javax.xml.stream.XMLStreamReader.getNamespaceContext.

Returns a read only namespace context for the current position.

public CharSequence

Returns:

The CharSequence that represents the character infoset items at the current position.

The CharSequence is normally a String, but can be any other CharSequence implementation. For binary data, however, use of Base64Data is recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)

The object returned from this method belongs to the parser, and its content is guaranteed to be the same only until the next() method is invoked.

getPCDATA
()

Works like getText() but hides the actual data representation.

Inherited from javax.xml.stream.XMLStreamReader:
closegetAttributeCountgetAttributeLocalNamegetAttributeNamegetAttributeNamespacegetAttributePrefixgetAttributeTypegetAttributeValuegetAttributeValuegetCharacterEncodingSchemegetElementTextgetEncodinggetEventTypegetLocalNamegetLocationgetNamegetNamespaceCountgetNamespacePrefixgetNamespaceURIgetNamespaceURIgetNamespaceURIgetPIDatagetPITargetgetPrefixgetPropertygetTextgetTextCharactersgetTextCharactersgetTextLengthgetTextStartgetVersionhasNamehasNexthasTextisAttributeSpecifiedisCharactersisEndElementisStandaloneisStartElementisWhiteSpacenextnextTagrequirestandaloneSet

Method Detail

getElementTextTrimback to summary
public String getElementTextTrim() throws XMLStreamException

Works like getElementText() but trims the leading and trailing whitespace.

The parser can often do this more efficiently than getElementText().trim().

Exceptions
XMLStreamException:
for errors
See Also
getElementText()
getNamespaceContextback to summary
public NamespaceContextEx getNamespaceContext()

Redeclares javax.xml.stream.XMLStreamReader.getNamespaceContext.

Doc from javax.xml.stream.XMLStreamReader.getNamespaceContext.

Returns a read only namespace context for the current position. The context is transient and only valid until a call to next() changes the state of the reader.

Annotations
@Override
getPCDATAback to summary
public CharSequence getPCDATA() throws XMLStreamException

Works like getText() but hides the actual data representation.

Returns:CharSequence

The CharSequence that represents the character infoset items at the current position.

The CharSequence is normally a String, but can be any other CharSequence implementation. For binary data, however, use of Base64Data is recommended (so that the consumer interested in seeing it as binary data may take advantage of mor efficient data representation.)

The object returned from this method belongs to the parser, and its content is guaranteed to be the same only until the next() method is invoked.

Exceptions
XMLStreamException:
for other errors. TODO: fix the dependency to JAXB internal class.
IllegalStateException:
if the parser is not pointing at characters infoset item.