Methods Summary |
---|
void | checkRequiredChildren(org.xml.sax.Locator locator)Throws an exception if a required child was not present.
ArrayList<Element> requiredChildren = this.requiredChilden;
if (requiredChildren != null) {
for (int i = requiredChildren.size() - 1; i >= 0; i--) {
Element child = requiredChildren.get(i);
if (!child.visited) {
throw new BadXmlException(
"Element named " + this + " is missing required"
+ " child element named "
+ child + ".", locator);
}
}
}
|
public android.sax.Element | getChild(java.lang.String localName)Gets the child element with the given name. Uses an empty string as the
namespace.
return getChild("", localName);
|
public android.sax.Element | getChild(java.lang.String uri, java.lang.String localName)Gets the child element with the given name.
if (endTextElementListener != null) {
throw new IllegalStateException("This element already has an end"
+ " text element listener. It cannot have children.");
}
if (children == null) {
children = new Children();
}
return children.getOrCreate(this, uri, localName);
|
public android.sax.Element | requireChild(java.lang.String localName)Gets the child element with the given name. Uses an empty string as the
namespace. We will throw a {@link org.xml.sax.SAXException} at parsing
time if the specified child is missing. This helps you ensure that your
listeners are called.
return requireChild("", localName);
|
public android.sax.Element | requireChild(java.lang.String uri, java.lang.String localName)Gets the child element with the given name. We will throw a
{@link org.xml.sax.SAXException} at parsing time if the specified child
is missing. This helps you ensure that your listeners are called.
Element child = getChild(uri, localName);
if (requiredChilden == null) {
requiredChilden = new ArrayList<Element>();
requiredChilden.add(child);
} else {
if (!requiredChilden.contains(child)) {
requiredChilden.add(child);
}
}
return child;
|
void | resetRequiredChildren()Clears flags on required children.
ArrayList<Element> requiredChildren = this.requiredChilden;
if (requiredChildren != null) {
for (int i = requiredChildren.size() - 1; i >= 0; i--) {
requiredChildren.get(i).visited = false;
}
}
|
public void | setElementListener(ElementListener elementListener)Sets start and end element listeners at the same time.
setStartElementListener(elementListener);
setEndElementListener(elementListener);
|
public void | setEndElementListener(EndElementListener endElementListener)Sets a listener for the end of this element.
if (this.endElementListener != null) {
throw new IllegalStateException(
"End element listener has already been set.");
}
this.endElementListener = endElementListener;
|
public void | setEndTextElementListener(EndTextElementListener endTextElementListener)Sets a listener for the end of this text element.
if (this.endTextElementListener != null) {
throw new IllegalStateException(
"End text element listener has already been set.");
}
if (children != null) {
throw new IllegalStateException("This element already has children."
+ " It cannot have an end text element listener.");
}
this.endTextElementListener = endTextElementListener;
|
public void | setStartElementListener(StartElementListener startElementListener)Sets a listener for the start of this element.
if (this.startElementListener != null) {
throw new IllegalStateException(
"Start element listener has already been set.");
}
this.startElementListener = startElementListener;
|
public void | setTextElementListener(TextElementListener elementListener)Sets start and end text element listeners at the same time.
setStartElementListener(elementListener);
setEndTextElementListener(elementListener);
|
public java.lang.String | toString()
return toString(uri, localName);
|
static java.lang.String | toString(java.lang.String uri, java.lang.String localName)
return "'" + (uri.equals("") ? localName : uri + ":" + localName) + "'";
|