public class XMLParser
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CHARACTERS
This event type means text has been read.
|
static int |
COMMENT
This event type means a comment has been read.
|
static int |
DTD
This event type means a DTD element has been read.
|
static int |
END_DOCUMENT
This event type means the end of the document has been reached.
|
static int |
END_ELEMENT
This event type means an end element has been read.
|
static int |
ERROR
This event type means an error occurred.
|
static int |
PROCESSING_INSTRUCTION
This event type means a processing instruction has been read.
|
static int |
START_DOCUMENT
This event type is used before reading.
|
static int |
START_ELEMENT
This event type means a start element has been read.
|
| Constructor and Description |
|---|
XMLParser(java.lang.String xml)
Construct a new XML parser.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getAttributeCount()
Get the number of attributes.
|
java.lang.String |
getAttributeLocalName(int index)
Get the local name of the attribute.
|
java.lang.String |
getAttributePrefix(int index)
Get the prefix of the attribute.
|
int |
getEventType()
Get the event type of the current token.
|
java.lang.String |
getLocalName()
Get the local name of the current start or end element.
|
java.lang.String |
getName()
Get the full name of the current start or end element.
|
int |
getPos()
Get the current character position in the XML document.
|
java.lang.String |
getPrefix()
Get the prefix of the current start or end element.
|
java.lang.String |
getRemaining()
Get the remaining XML text of the document.
|
java.lang.String |
getText()
Get the current text.
|
java.lang.String |
getToken()
Get the current token text.
|
boolean |
hasNext()
Check if there are more tags to read.
|
boolean |
isWhiteSpace()
Check if the current character tag only contains spaces or other
non-printable characters.
|
int |
next()
Read the next tag.
|
void |
setHTML(boolean html)
Enable or disable HTML processing.
|
public static final int ERROR
public static final int START_ELEMENT
public static final int END_ELEMENT
public static final int PROCESSING_INSTRUCTION
public static final int CHARACTERS
public static final int COMMENT
public static final int START_DOCUMENT
public static final int END_DOCUMENT
public static final int DTD
public XMLParser(java.lang.String xml)
xml - the documentpublic void setHTML(boolean html)
html - true if HTML processing is enabled.public boolean hasNext()
public int next()
public int getEventType()
public java.lang.String getText()
public java.lang.String getToken()
public int getAttributeCount()
public java.lang.String getAttributePrefix(int index)
index - the index of the attribute (starting with 0)public java.lang.String getAttributeLocalName(int index)
index - the index of the attribute (starting with 0)public java.lang.String getName()
public java.lang.String getLocalName()
public java.lang.String getPrefix()
public boolean isWhiteSpace()
public java.lang.String getRemaining()
public int getPos()