Most visited

Recently visited

Added in API level 1

RootElement

public class RootElement
extends Element

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


根XML元素。 这个API的入口点。 并行使用不安全。

例如,传递这个XML:

 <feed xmlns='http://www.w3.org/2005/Atom'>
   <entry>
     <id>bob</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: bob
 

摘要(Summary)

Public constructors

RootElement(String uri, String localName)

用给定的名字构造一个新的根元素。

RootElement(String localName)

用给定的名字构造一个新的根元素。

公共方法(Public methods)

ContentHandler getContentHandler()

获取SAX ContentHandler

继承方法(Inherited methods)

From class android.sax.Element
From class java.lang.Object

Public constructors

RootElement

Added in API level 1
RootElement (String uri, 
                String localName)

用给定的名字构造一个新的根元素。

参数(Parameters)
uri String: the namespace
localName String: the local name

RootElement

Added in API level 1
RootElement (String localName)

用给定的名字构造一个新的根元素。 使用空字符串作为命名空间。

参数(Parameters)
localName String: the local name

公共方法(Public methods)

getContentHandler

Added in API level 1
ContentHandler getContentHandler ()

获取SAX ContentHandler 传递给你的SAX解析器。

返回(Returns)
ContentHandler

Hooray!