Methods Summary |
---|
public void | defineEntityReplacementText(java.lang.String entityName, java.lang.String replacementText)Not supported.
throw new UnsupportedOperationException();
|
public int | getAttributeCount()
return this.document.currentEvent.getAttributeCount();
|
public java.lang.String | getAttributeName(int index)
return this.document.currentEvent.getAttributeName(index);
|
public java.lang.String | getAttributeNamespace(int index)
return this.document.currentEvent.getAttributeNamespace(index);
|
public java.lang.String | getAttributePrefix(int index)Not supported.
throw new UnsupportedOperationException();
|
public java.lang.String | getAttributeType(int index)
return "CDATA";
|
public java.lang.String | getAttributeValue(int index)
return this.document.currentEvent.getAttributeValue(index);
|
public java.lang.String | getAttributeValue(java.lang.String namespace, java.lang.String name)
return this.document.currentEvent.getAttributeValue(namespace, name);
|
public int | getColumnNumber()Not supported.
// We would have to record the column number in each event.
return -1;
|
public int | getDepth()
return this.document.getDepth();
|
public int | getEventType()
return this.document.currentEvent.getType();
|
public boolean | getFeature(java.lang.String name)
if (name == null) {
// Required by API.
throw new IllegalArgumentException("Null feature name");
}
// We always support namespaces, but no other features.
return name.equals(FEATURE_PROCESS_NAMESPACES) && processNamespaces;
|
public java.lang.String | getInputEncoding()
return this.document.getEncoding();
|
public int | getLineNumber()Not supported.
// We would have to record the line number in each event.
return -1;
|
public java.lang.String | getName()
return this.document.currentEvent.getName();
|
public java.lang.String | getNamespace(java.lang.String prefix)
// In XmlPullParser API, null == default namespace.
if (prefix == null) {
// Internally, we use empty string instead of null.
prefix = "";
}
return document.currentEvent.namespaceStack.uriFor(prefix);
|
public java.lang.String | getNamespace()
return this.document.currentEvent.getNamespace();
|
public int | getNamespaceCount(int depth)
return document.currentEvent.namespaceStack.countAt(depth);
|
public java.lang.String | getNamespacePrefix(int pos)
String prefix = document.currentEvent.namespaceStack.prefixAt(pos);
@SuppressWarnings("StringEquality")
boolean hasPrefix = prefix != "";
return hasPrefix ? prefix : null;
|
public java.lang.String | getNamespaceUri(int pos)
return document.currentEvent.namespaceStack.uriAt(pos);
|
public java.lang.String | getPositionDescription()
return "line " + getLineNumber() + ", column " + getColumnNumber();
|
public java.lang.String | getPrefix()Not supported.
throw new UnsupportedOperationException();
|
public java.lang.Object | getProperty(java.lang.String name)
return null;
|
public java.lang.String | getText()
final StringBuilder builder = this.document.currentEvent.getText();
return builder == null ? null : builder.toString();
|
public char[] | getTextCharacters(int[] holderForStartAndLength)
final StringBuilder builder = this.document.currentEvent.getText();
final int length = builder.length();
char[] characters = new char[length];
builder.getChars(0, length, characters, 0);
holderForStartAndLength[0] = 0;
holderForStartAndLength[1] = length;
return characters;
|
public boolean | isAttributeDefault(int index)
return false;
|
public boolean | isEmptyElementTag()
return this.document.isCurrentElementEmpty();
|
public boolean | isNamespaceProcessingEnabled()Returns true if this parser processes namespaces.
return processNamespaces;
|
public boolean | isWhitespace()
if (getEventType() != TEXT) {
throw new XmlPullParserException("Not on text.");
}
String text = getText();
if (text.length() == 0) {
return true;
}
int length = text.length();
for (int i = 0; i < length; i++) {
if (!Character.isWhitespace(text.charAt(i))) {
return false;
}
}
return true;
|
public int | next()
return this.document.dequeue();
|
public int | nextTag()
int eventType = next();
if (eventType == TEXT && isWhitespace()) {
eventType = next();
}
if (eventType != START_TAG && eventType != END_TAG) {
throw new XmlPullParserException(
"Expected start or end tag", this, null);
}
return eventType;
|
public java.lang.String | nextText()
if (this.document.currentEvent.getType() != START_TAG)
throw new XmlPullParserException("Not on start tag.");
int next = this.document.dequeue();
switch (next) {
case TEXT: return getText();
case END_TAG: return "";
default: throw new XmlPullParserException(
"Unexpected event type: " + TYPES[next]);
}
|
public int | nextToken()Not supported.
throw new UnsupportedOperationException();
|
public void | require(int type, java.lang.String namespace, java.lang.String name)
if (type != getEventType()
|| (namespace != null && !namespace.equals(getNamespace()))
|| (name != null && !name.equals(getName()))) {
throw new XmlPullParserException("expected "
+ TYPES[type] + getPositionDescription());
}
|
public void | setFeature(java.lang.String name, boolean state)
if (name == null) {
// Required by API.
throw new IllegalArgumentException("Null feature name");
}
if (name.equals(FEATURE_PROCESS_NAMESPACES)) {
processNamespaces = state;
return;
}
if (name.equals(FEATURE_RELAXED)) {
relaxed = true;
return;
}
// You're free to turn these features off because we don't support them.
if (!state && (name.equals(FEATURE_REPORT_NAMESPACE_ATTRIBUTES)
|| name.equals(FEATURE_PROCESS_DOCDECL)
|| name.equals(FEATURE_VALIDATION))) {
return;
}
throw new XmlPullParserException("Unsupported feature: " + name);
|
public void | setInput(java.io.Reader in)
this.document = new CharDocument(in, processNamespaces);
|
public void | setInput(java.io.InputStream in, java.lang.String encodingName)
this.document = new ByteDocument(in, encodingName, processNamespaces);
|
public void | setNamespaceProcessingEnabled(boolean processNamespaces)Enables or disables namespace processing. Set to false by default.
this.processNamespaces = processNamespaces;
|
public void | setProperty(java.lang.String name, java.lang.Object value)
if (name == null) {
// Required by API.
throw new IllegalArgumentException("Null feature name");
}
// We don't support any properties.
throw new XmlPullParserException("Properties aren't supported.");
|