Android
android.sax
public class

android.sax.RootElement

java.lang.Object
android.sax.Element
android.sax.RootElement

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

For example, passing this XML:

 <feed xmlns='http://www.w3.org/2005/Atom'>
   <entry>
     <id>crazybob</id>
   </entry>
 </feed>
 
to this code:
 static final String ATOM_NAMESPACE = "http://www.w3.org/2005/Atom";

 ...
 
 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 = ...;
 reader.setContentHandler(root.getContentHandler());
 reader.parse(...);
 
would output:
 Entry ID: crazybob
 

Summary

Public Constructors

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

Public Methods

          ContentHandler  getContentHandler()
Gets the SAX ContentHandler.
Methods inherited from class android.sax.Element
Methods inherited from class java.lang.Object

Details

Public Constructors

public RootElement(String uri, String localName)

Constructs a new root element with the given name.

Parameters

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.

Parameters

localName the local name

Public Methods

public ContentHandler getContentHandler()

Gets the SAX ContentHandler. Pass this to your SAX parser.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48