public class XMLInputStreamReader extends AbstractXMLReader
Modifier and Type | Field and Description |
---|---|
private XMLEvent |
current |
private StartElement |
currentStart |
private int |
currentType |
private boolean |
endReached |
private static TypeFilter |
filter |
private XMLInputStream |
source |
private Stack |
startStack |
private static XMLInputStreamFactory |
streamFactory |
qnameFactory
CHARACTER_DATA, END_DOCUMENT, END_ELEMENT, START_ELEMENT
Constructor and Description |
---|
XMLInputStreamReader(XMLInputStream source) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the current reader.
|
java.lang.String |
getAttribute(java.lang.String namespaceURI,
java.lang.String localPart)
Returns the value of the attribute with the given name as a String.
|
int |
getEventType()
Returns the integer value indicating the type of the current event.
|
java.lang.String |
getLocalName()
Returns the local name of the current element.
|
java.util.Map |
getNamespaceMap()
Returns a map of the declared prefixes and their associated namespaces
for the current context.
|
java.lang.String |
getNamespaceURI()
Returns the namespace of the current element.
|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Returns namespace bound to the prefix in the current context.
|
java.lang.String |
getText()
returns the text from the current event as a String.
|
boolean |
hasName()
Returns true in the case where the current event has a name (i.e.
|
boolean |
isCharacters()
Returns true iff the current event is character data.
|
boolean |
isEndElement()
Returns true iff the current event is an end element.
|
boolean |
isStartElement()
Returns true if the current event is a start element.
|
int |
next()
Advances the reader one event and returns the type of new event.
|
private int |
process(CharacterData element) |
private int |
process(EndElement element) |
private int |
process(StartElement element) |
void |
require(int type,
java.lang.String namespaceURI,
java.lang.String localPart)
This method confirms that the type and name of the current event match the
values passed in.
|
getQName, getQNameAttribute, getQNameText
private static TypeFilter filter
private static XMLInputStreamFactory streamFactory
private final Stack startStack
private final XMLInputStream source
private XMLEvent current
private StartElement currentStart
private boolean endReached
private int currentType
public XMLInputStreamReader(XMLInputStream source) throws XMLStreamException
XMLStreamException
public int next()
XMLReader
private int process(StartElement element)
private int process(EndElement element) throws XMLStreamException
XMLStreamException
private int process(CharacterData element)
public boolean hasName()
XMLReader
public java.lang.String getNamespaceURI() throws java.lang.IllegalStateException
XMLReader
java.lang.IllegalStateException
- if the current event has no name.public java.lang.String getLocalName() throws java.lang.IllegalStateException
XMLReader
java.lang.IllegalStateException
public void require(int type, java.lang.String namespaceURI, java.lang.String localPart) throws ValidationException
XMLReader
type
- an integer value indicating the expected event type.namespaceURI
- an String valuelocalPart
- an QName value indicating the expected name, if any.ValidationException
- if the type and name do not match.public void close()
XMLReader
public int getEventType()
XMLReader
public boolean isStartElement()
XMLReader
public boolean isEndElement()
XMLReader
public boolean isCharacters()
XMLReader
public java.lang.String getAttribute(java.lang.String namespaceURI, java.lang.String localPart) throws java.lang.IllegalStateException
XMLReader
java.lang.IllegalStateException
- if the current event has no attributes.public java.lang.String getNamespaceURI(java.lang.String prefix)
XMLReader
public java.util.Map getNamespaceMap()
XMLReader
public java.lang.String getText() throws java.lang.IllegalStateException
XMLReader
getText
in interface XMLReader
getText
in class AbstractXMLReader
java.lang.IllegalStateException
- if the current event has no text.