javax.xml.stream
Interface XMLStreamReader
public
interface
XMLStreamReader
extends XMLStreamConstants
Interface implemented by an XML parser.
Method Summary |
void | close()
Frees any resources used by this parser.
|
int | getAttributeCount()
Returns the number of attributes on this element.
|
String | getAttributeLocalName(int index)
Returns the local-name of the attribute at the given index. |
QName | getAttributeName(int index)
Returns the QName of the attribute at the given index. |
String | getAttributeNamespace(int index)
Returns the namespace URI of the attribute at the given index. |
String | getAttributePrefix(int index)
Returns the namespace prefix of the attribute at the given index. |
String | getAttributeType(int index)
Returns the type of the attribute at the specified index. |
String | getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value for the given attribute. |
String | getAttributeValue(int index)
Returns the normalized value of the attribute at the given index. |
String | getCharacterEncodingScheme()
Returns the encoding declared in the XML declaration. |
String | getElementText()
Returns the text content of a text-only element.
|
String | getEncoding()
Returns the input encoding. |
int | getEventType()
Returns the type of the current event. |
String | getLocalName()
Returns the local-name of the current element. |
Location | getLocation()
Returns the current location of the parser cursor in the underlying
input source. |
QName | getName()
Returns the QName of the current element.
|
NamespaceContext | getNamespaceContext()
Returns the namespace context for the current position. |
int | getNamespaceCount()
Returns the number of namespaces declared on this event.
|
String | getNamespacePrefix(int index)
Returns the prefix of the namespace at the given index, or null if this
is the default namespace declaration. |
String | getNamespaceURI(String prefix)
Returns the namespace URI for the given prefix. |
String | getNamespaceURI(int index)
Returns the URI of the namespace at the given index. |
String | getNamespaceURI()
Returns the namespace URI of the current element. |
String | getPIData()
Returns the data of the current processing instruction event. |
String | getPITarget()
Returns the target of the current processing instruction event. |
String | getPrefix()
Returns the namespace prefix of the current element. |
Object | getProperty(String name)
Returns the implementation-specific feature or property of the given
name. |
String | getText()
Returns the string value of the current event. |
char[] | getTextCharacters()
Returns the string value of the current event as a character array. |
int | getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
Copies the string value of the current event into the specified
character array. |
int | getTextLength()
Returns the length of the characters in the text character array. |
int | getTextStart()
Returns the offset of the first character in the text character array. |
String | getVersion()
Returns the XML version declared in the XML declaration. |
boolean | hasName()
Indicates whether the current event has a name. |
boolean | hasNext()
Indicates whether there are any remaining events to be read. |
boolean | hasText()
Indicates whether the current event has text. |
boolean | isAttributeSpecified(int index)
Indicates whether the attribute at the given index was specified in the
underlying XML source or created by default. |
boolean | isCharacters()
Indicates whether the current event is character data. |
boolean | isEndElement()
Indicates whether the current event is END_ELEMENT. |
boolean | isStandalone()
Returns the standalone flag declared in the XML declaration. |
boolean | isStartElement()
Indicates whether the current event is START_ELEMENT. |
boolean | isWhiteSpace()
Indicates whether the current event is ignorable whitespace. |
int | next()
Returns the next parsing event. |
int | nextTag()
Skips any ignorable whitespace, comments, and processing instructions
until a START_ELEMENT or END_ELEMENT event is encountered. |
void | require(int type, String namespaceURI, String localName)
Tests whether the current event is of the given type and namespace. |
boolean | standaloneSet()
Indicates whether the standalone flag was set in the document. |
public void close()
Frees any resources used by this parser.
This method will not close the underlying input source.
public int getAttributeCount()
Returns the number of attributes on this element.
This method can only be invoked on a START_ELEMENT event.
public String getAttributeLocalName(int index)
Returns the local-name of the attribute at the given index.
public QName getAttributeName(int index)
Returns the QName of the attribute at the given index.
public String getAttributeNamespace(int index)
Returns the namespace URI of the attribute at the given index.
public String getAttributePrefix(int index)
Returns the namespace prefix of the attribute at the given index.
public String getAttributeType(int index)
Returns the type of the attribute at the specified index.
public String getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value for the given attribute.
public String getAttributeValue(int index)
Returns the normalized value of the attribute at the given index.
public String getCharacterEncodingScheme()
Returns the encoding declared in the XML declaration.
public String getElementText()
Returns the text content of a text-only element.
When invoked, the current event must be START_ELEMENT.
On completion, the current event will be END_ELEMENT.
public String getEncoding()
Returns the input encoding.
public int getEventType()
Returns the type of the current event.
public String getLocalName()
Returns the local-name of the current element.
Returns the current location of the parser cursor in the underlying
input source.
public QName getName()
Returns the QName of the current element.
This method is only valid on a START_ELEMENT or END_ELEMENT event.
public NamespaceContext getNamespaceContext()
Returns the namespace context for the current position.
public int getNamespaceCount()
Returns the number of namespaces declared on this event.
This method is only valid on a START_ELEMENT, END_ELEMENT, or NAMESPACE
event.
public String getNamespacePrefix(int index)
Returns the prefix of the namespace at the given index, or null if this
is the default namespace declaration.
public String getNamespaceURI(String prefix)
Returns the namespace URI for the given prefix.
public String getNamespaceURI(int index)
Returns the URI of the namespace at the given index.
public String getNamespaceURI()
Returns the namespace URI of the current element.
public String getPIData()
Returns the data of the current processing instruction event.
public String getPITarget()
Returns the target of the current processing instruction event.
public String getPrefix()
Returns the namespace prefix of the current element.
public Object getProperty(String name)
Returns the implementation-specific feature or property of the given
name.
public String getText()
Returns the string value of the current event.
public char[] getTextCharacters()
Returns the string value of the current event as a character array.
public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
Copies the string value of the current event into the specified
character array.
public int getTextLength()
Returns the length of the characters in the text character array.
public int getTextStart()
Returns the offset of the first character in the text character array.
public String getVersion()
Returns the XML version declared in the XML declaration.
public boolean hasName()
Indicates whether the current event has a name.
public boolean hasNext()
Indicates whether there are any remaining events to be read.
public boolean hasText()
Indicates whether the current event has text.
public boolean isAttributeSpecified(int index)
Indicates whether the attribute at the given index was specified in the
underlying XML source or created by default.
public boolean isCharacters()
Indicates whether the current event is character data.
public boolean isEndElement()
Indicates whether the current event is END_ELEMENT.
public boolean isStandalone()
Returns the standalone flag declared in the XML declaration.
public boolean isStartElement()
Indicates whether the current event is START_ELEMENT.
public boolean isWhiteSpace()
Indicates whether the current event is ignorable whitespace.
public int next()
Returns the next parsing event.
public int nextTag()
Skips any ignorable whitespace, comments, and processing instructions
until a START_ELEMENT or END_ELEMENT event is encountered.
Throws: XMLStreamException if an event of any other type is
encountered
public void require(int type, String namespaceURI, String localName)
Tests whether the current event is of the given type and namespace.
Throws: XMLStreamException if the test fails
public boolean standaloneSet()
Indicates whether the standalone flag was set in the document.