Build 1.0_r1(from source)

Class RootElement

  extended by android.sax.Element
      extended by android.sax.RootElement

public class RootElement
extends Element

The root XML element. The entry point for this API. Not safe for concurrent use.

For example, passing this XML:

 <feed xmlns=''>
to this code:
 static final String ATOM_NAMESPACE = "";

 RootElement root = new RootElement(ATOM_NAMESPACE, "feed");
 Element entry = root.getChild(ATOM_NAMESPACE, "entry");
 entry.getChild(ATOM_NAMESPACE, "id").setEndTextElementListener(
   new EndTextElementListener() {
     public void end(String body) {
       System.out.println("Entry ID: " + body);

 XMLReader reader = ...;
would output:
 Entry ID: bob

Nested Class Summary
(package private)  class RootElement.Handler
Field Summary
(package private)  RootElement.Handler handler
Fields inherited from class android.sax.Element
children, depth, endElementListener, endTextElementListener, localName, parent, requiredChilden, startElementListener, uri, visited
Constructor Summary
RootElement(String localName)
          Constructs a new root element with the given name.
RootElement(String uri, String localName)
          Constructs a new root element with the given name.
Method Summary
 ContentHandler getContentHandler()
          Gets the SAX ContentHandler.
Methods inherited from class android.sax.Element
checkRequiredChildren, getChild, getChild, requireChild, requireChild, resetRequiredChildren, setElementListener, setEndElementListener, setEndTextElementListener, setStartElementListener, setTextElementListener, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


final RootElement.Handler handler
Constructor Detail


public RootElement(String uri,
                   String localName)
Constructs a new root element with the given name.

uri - the namespace
localName - the local name


public RootElement(String localName)
Constructs a new root element with the given name. Uses an empty string as the namespace.

localName - the local name
Method Detail


public ContentHandler getContentHandler()
Gets the SAX ContentHandler. Pass this to your SAX parser.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature