Use of JCP site is subject to the
JCP Terms of Use and the
Oracle Privacy Policy
|
javax.xml.stream
|
Valid methods for each state | |
---|---|
Event Type | Valid Methods |
All States | hasNext ,
getEventType ,
getLocation ,
close
|
START_DTD
|
next ,
getName ,
getPublicIdentifier ,
getSystemIdentifier
|
END_DTD
|
|
ENTITY_DECLARATION
|
next ,
getName ,
getPublicIdentifier ,
getSystemIdentifier
getText ,
getTextCharacters ,
getTextStart ,
getTextLength
|
UNPARSED_ENTITY_DECLARATION
|
next ,
getName ,
getPublicIdentifier ,
getSystemIdentifier ,
getNotationName
|
NOTATION_DECLARATION
|
next ,
getName ,
getPublicIdentifier ,
getSystemIdentifier
|
COMMENT
|
next ,
getText ,
getTextCharacters ,
getTextStart ,
getTextLength
|
PROCESSING_INSTRUCTION
|
next ,
getPITarget ,
getPIData
|
XMLStreamConstants
,
XMLStreamReader
Field Summary | |
static int |
COMMENT
Indicates an event is a comment. |
static int |
END_DTD
Indicates an event is the end of a DTD. |
static int |
ENTITY_DECLARATION
Indicates an event is a parsed entity declaration. |
static int |
NOTATION_DECLARATION
Indicates an event is a notation declaration. |
static int |
PROCESSING_INSTRUCTION
Indicates an event is a processing instruction. |
static int |
START_DTD
Indicates an event is the start of a DTD. |
static int |
UNPARSED_ENTITY_DECLARATION
Indicates an event is an unparsed entity declaration. |
Method Summary | |
void |
close()
Terminates DTD processing, skipping all DTD related events up to END_DTD . |
int |
getEventType()
Returns an integer code that indicates the type of the event at the current cursor location. |
Location |
getLocation()
Returns the current location of the processor. |
String |
getNotationName()
Returns the notation name. |
String |
getPIData()
Returns the data section of a processing instruction. |
String |
getPITarget()
Returns the target of a processing instruction. |
String |
getPublicIdentifier()
Returns the public identifier. |
String |
getName()
Returns the name as a String. |
String |
getSystemIdentifier()
Returns the system identifier. |
String |
getText()
Returns the current value of the parse event as a string. |
char[] |
getTextCharacters()
Returns an array which contains the characters from this event. |
int |
getTextLength()
Returns the length of the sequence of characters for the current event within the text character array. |
int |
getTextStart()
Returns the offset into the text character array at which the first character of the data for the current event is located. |
boolean |
hasNext()
Returns true if there are more parsing events
and false if there are no more events. |
int |
next()
Returns next DTD parsing event. |
Field Detail |
public static final int START_DTD
getName
returns the root element's qualified name, and methods getPublicIdentifier
and getSystemIdentifier
return the document's public and system identifiers.
public static final int END_DTD
hasNext
returns false
, and method getEventType
returns END_DTD
.
This event marks the end of the valid lifecycle of the DTDStreamReader
instance, so any method call other than next
,
hasNext
,
getEventType
,
close
,
or getLocation
on this interface will throw java.lang.IllegalStateException.
public static final int ENTITY_DECLARATION
If the getTextLength
method returns a negative value, the event represents an external
parsed entity: method getName
returns the unparsed entity name, methods getPublicIdentifier
and getSystemIdentifier
return the entity's public and system identifiers, and methods getText
and getTextCharacters
return null and empty array, respectively.
If the getTextLength
method returns a positive value, then the event represents an internal
parsed entity: method getName
returns the unparsed entity name, methods getText
or getTextCharacters
return the replacement text of an internal parsed entity, and methods getPublicIdentifier
and getSystemIdentifier
return null.
public static final int UNPARSED_ENTITY_DECLARATION
getName
returns the unparsed entity name, methods getPublicIdentifier
and getSystemIdentifier
return the public identifier and the system identifier of an unparsed
entity, and the method getNotationName
returns the name of the notation which identifies the format of the
unparsed entity.
public static final int NOTATION_DECLARATION
getName
returns the notation name, the methods getPublicIdentifier
and getSystemIdentifier
return the public identifier and the system identifier of the notation.
public static final int PROCESSING_INSTRUCTION
getPITarget
returns the processing instruction target and the method getPIData
returns the processing instruction data section.
public static final int COMMENT
getText
or getTextCharacters
return the character data of the comment, and the methods getTextStart
and getTextLength
return the index of the first character and the number of characters in
the character array returned by the getTextCharacters
method.
Method Detail |
public int next()
throws XMLStreamException
NoSuchElementException
- if this is called when hasNext()
returns false
XMLStreamException
- if there is an error processing the underlying DTD sourcepublic boolean hasNext()
throws XMLStreamException
true
if there are more
parsing events and false
if there are no more
events. This method will return false
if the
current state of the DTDStreamReader is END_DTD
true
if there are more events,
false
otherwise XMLStreamException
- if there is a fatal error detecting the next statepublic int getEventType()
public String getText()
COMMENT
or the replacement value for an ENTITY_DECLARATION
.
This method returns null
if there is no text
available.
null
if
there is no text available IllegalStateException
- if this state is not a valid text state.public char[] getTextCharacters()
IllegalStateException
- if this state is not a valid text state.public int getTextStart()
IllegalStateException
- if this state is not a valid text state.public int getTextLength()
-1
if there is no text available.
-1
IllegalStateException
- if this state is not a valid text state.public Location getLocation()
Location
that returns -1
for each of the lineNumber,
columnNumber, and characterOffset, and null
for each of the publicId and systemId. The location information is only
valid until next()
is called.
Location
objectpublic String getPITarget()
null
IllegalStateException
- if this method is not valid in the current state.public String getPIData()
null
IllegalStateException
- if this method is not valid in the current state.public String getName()
IllegalStateException
- if this state is not a valid text state.public String getPublicIdentifier()
IllegalStateException
- if this method is not valid in the current state.public String getSystemIdentifier()
IllegalStateException
- if this method is not valid in the current state.public String getNotationName()
IllegalStateException
- if this method is not valid in the current state.public void close()
throws XMLStreamException
END_DTD
.
This method does not close the underlying input source. If this method
is called when current state is already END_DTD
,
this method does nothing. Once this method has been invoked, method hasNext()
returns false
, method getEventType()
returns END_DTD
and any other method call except next()
or getLocation()
on this interface generates an java.lang.IllegalStateException
.
XMLStreamException
- if there is an error processing the underlying DTD source
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |